You can subscribe to this list here.
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(89) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(9) |
Feb
(6) |
Mar
(22) |
Apr
(34) |
May
(43) |
Jun
(48) |
Jul
(96) |
Aug
(64) |
Sep
(30) |
Oct
(12) |
Nov
(17) |
Dec
(21) |
2007 |
Jan
(61) |
Feb
(24) |
Mar
(51) |
Apr
(54) |
May
(41) |
Jun
(57) |
Jul
(16) |
Aug
(12) |
Sep
(29) |
Oct
(143) |
Nov
(57) |
Dec
(193) |
2008 |
Jan
(92) |
Feb
(54) |
Mar
(34) |
Apr
(50) |
May
(71) |
Jun
(3) |
Jul
(16) |
Aug
(16) |
Sep
(11) |
Oct
(13) |
Nov
(8) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
(9) |
Apr
(36) |
May
(10) |
Jun
(2) |
Jul
(13) |
Aug
(15) |
Sep
(5) |
Oct
(2) |
Nov
(13) |
Dec
(4) |
2010 |
Jan
(5) |
Feb
(2) |
Mar
(6) |
Apr
(1) |
May
|
Jun
(1) |
Jul
|
Aug
(24) |
Sep
(14) |
Oct
(8) |
Nov
(4) |
Dec
(9) |
2011 |
Jan
(4) |
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
(2) |
Jul
(1) |
Aug
(4) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(1) |
From: Eric P. <th...@us...> - 2009-08-06 20:54:46
|
Update of /cvsroot/sandev/sand/platform/tools/src/org/sandev/tools/HTTP In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2322 Modified Files: AbstractXHTMLFormAdaptor.java Log Message: modePath "FINDING.LISTING" is distinct from endsWith ".FINDING.LISTING" Index: AbstractXHTMLFormAdaptor.java =================================================================== RCS file: /cvsroot/sandev/sand/platform/tools/src/org/sandev/tools/HTTP/AbstractXHTMLFormAdaptor.java,v retrieving revision 1.74 retrieving revision 1.75 diff -C2 -d -r1.74 -r1.75 *** AbstractXHTMLFormAdaptor.java 3 Jun 2009 21:05:39 -0000 1.74 --- AbstractXHTMLFormAdaptor.java 6 Aug 2009 20:54:37 -0000 1.75 *************** *** 1319,1322 **** --- 1319,1338 ---- * Workhorse method for the dumpFormContext method without the boolean * override. + * + * LISTING can mean either a collection or an instance display. + * If rootMsg is null, then there is no instance selected so we + * have to display the collection. If the modePath is + * xxx.FINDING.LISTING then we have a root message and we are + * trying to find a reference in order to add or update one of the + * field data members. If we are just generally querying around, + * then modePath can be just "FINDING.LISTING". To distinguish + * between these cases we test to see if the modePath endsWith + * ".FINDING.LISTING". The initial period makes sure we pick up + * on the field add/update case without blocking us from + * displaying an instance in the pure query case. -ep 6aug09 + * + * See also XHTMLScreenAdaptor.getFormModeString which has + * equivalent logic for determining if we are displaying a + * collection or a single instance. */ protected String dumpFormContext(PrintWriter out,String formName, *************** *** 1340,1348 **** break; default: //listing.. if((uifc.getRootMsg()==null)|| ! (uifc.getModePath().endsWith("FINDING.LISTING"))) { findCollDisplay=DUMPMODE_READONLY; } else { currMsgDisplay=DUMPMODE_READONLY; } } } String prefix=formName + DELIMITER + "UIFormContext" + DELIMITER; ErrorInfo[] eis=uifc.getOutputText(); --- 1356,1370 ---- break; default: //listing.. + String modePath=uifc.getModePath(); + debug("dumpFormContext LISTING modePath: " + modePath + + ", rootMsg: " + uifc.getRootMsg()); if((uifc.getRootMsg()==null)|| ! (modePath.endsWith(".FINDING.LISTING"))) { findCollDisplay=DUMPMODE_READONLY; } else { currMsgDisplay=DUMPMODE_READONLY; } } } + debug(" currMsgDisplay: " + currMsgDisplay); + debug("findQueryDisplay: " + findQueryDisplay); + debug(" findCollDisplay: " + findCollDisplay); String prefix=formName + DELIMITER + "UIFormContext" + DELIMITER; ErrorInfo[] eis=uifc.getOutputText(); |
From: Eric P. <th...@us...> - 2009-08-06 20:53:35
|
Update of /cvsroot/sandev/sand/platform/tools/src/org/sandev/tools/HTTP In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv2090 Modified Files: XHTMLScreenAdaptor.java Log Message: modePath "FINDING.LISTING" is distinct from endsWith ".FINDING.LISTING" Index: XHTMLScreenAdaptor.java =================================================================== RCS file: /cvsroot/sandev/sand/platform/tools/src/org/sandev/tools/HTTP/XHTMLScreenAdaptor.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** XHTMLScreenAdaptor.java 29 Jul 2009 12:58:23 -0000 1.31 --- XHTMLScreenAdaptor.java 6 Aug 2009 20:53:24 -0000 1.32 *************** *** 983,987 **** /** * Returns collection, listing or editing depending on the display ! * mode indicated by the uifc. */ protected String getFormModeString(UIFormContext uifc) { --- 983,990 ---- /** * Returns collection, listing or editing depending on the display ! * mode indicated by the uifc. See the comments in ! * AbstractXHTMLFormAdaptor.dumpFormContext for more info on ! * distinguishing between a collection listing and an individual ! * item listing. */ protected String getFormModeString(UIFormContext uifc) { *************** *** 994,998 **** return "editing"; } //new instance or existing instance edit if((uifc.getRootMsg()==null)|| ! (uifc.getModePath().endsWith("FINDING.LISTING"))) { return "collection"; } //collection display return "listing"; --- 997,1001 ---- return "editing"; } //new instance or existing instance edit if((uifc.getRootMsg()==null)|| ! (uifc.getModePath().endsWith(".FINDING.LISTING"))) { return "collection"; } //collection display return "listing"; |
From: Eric P. <th...@us...> - 2009-08-06 20:52:11
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1880 Modified Files: UIFormContext.java Log Message: no FIND action supported if FINDING.LISTING Index: UIFormContext.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util/UIFormContext.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** UIFormContext.java 9 Jul 2009 23:14:28 -0000 1.24 --- UIFormContext.java 6 Aug 2009 20:51:59 -0000 1.25 *************** *** 364,368 **** (!((modePath.endsWith("ADDING"))|| //not looking for a ref (modePath.endsWith("UPDATING"))|| ! (modePath.endsWith("FINDING")))))) { disableAction(ACTION_FIND); } } if(actionSupported(ACTION_CANCEL)) { --- 364,370 ---- (!((modePath.endsWith("ADDING"))|| //not looking for a ref (modePath.endsWith("UPDATING"))|| ! (modePath.endsWith("FINDING")))))|| ! //just searching, cancel to return to query form ! (modePath.equals("FINDING.LISTING"))) { disableAction(ACTION_FIND); } } if(actionSupported(ACTION_CANCEL)) { *************** *** 371,375 **** //a mode previous to ADDING which we can return to (modePath.indexOf("ADDING")>2)|| ! //or we're listing some stuff we found (modePath.endsWith("FINDING.LISTING"))|| //or we're finding, but there's a previous mode to return to --- 373,377 ---- //a mode previous to ADDING which we can return to (modePath.indexOf("ADDING")>2)|| ! //or we're listing some instances we found (modePath.endsWith("FINDING.LISTING"))|| //or we're finding, but there's a previous mode to return to *************** *** 805,808 **** --- 807,811 ---- public static String dumpQuery(SandQueryMessage sqm) { String retval=sqm.getShortName(); + retval+=" "; SandAttrVal[] savs=sqm.getMatchInfo(); if(savs.length==0) { |
From: Eric P. <th...@us...> - 2009-08-06 20:50:27
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1371 Modified Files: AbstractFormManager.java Log Message: Dealing with modePath "FINDING.LISTING" separate from ".FINDING.LISTING" Index: AbstractFormManager.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util/AbstractFormManager.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** AbstractFormManager.java 25 Jul 2009 18:39:07 -0000 1.42 --- AbstractFormManager.java 6 Aug 2009 20:50:11 -0000 1.43 *************** *** 409,412 **** --- 409,414 ---- { trace(0,"AbstractFormManager.doActionSelect"); + SandInstanceMessage foundinst= + uifc.getFindCollection().getElements()[uifc.getFindCollIndex()]; String modePath=uifc.getModePath(); if((modePath.endsWith("ADDING.FINDING.LISTING"))|| *************** *** 414,424 **** ////record the change in the currInst SandInstanceMessage parent=uifc.getCurrInst(); - SandInstanceMessage foundinst= - uifc.getFindCollection().getElements()[uifc.getFindCollIndex()]; wrappedGenAdd("doActionSelect: ",uifc,parent,foundinst); ////pop state back into ADDING/UPDATING ! uifc.popModeStack(); ! uifc.popModeStack(); ! uifc.popPosition(); uifc.setCurrClass(uifc.getCurrInst().getShortName()); uifc.setFindQuery(null); --- 416,424 ---- ////record the change in the currInst SandInstanceMessage parent=uifc.getCurrInst(); wrappedGenAdd("doActionSelect: ",uifc,parent,foundinst); ////pop state back into ADDING/UPDATING ! uifc.popModeStack(); //now AddOrUpdate.FINDING ! uifc.popModeStack(); //now AddOrUpdate ! uifc.popPosition(); //back to containing struct from field uifc.setCurrClass(uifc.getCurrInst().getShortName()); uifc.setFindQuery(null); *************** *** 426,434 **** uifc.setFindCollIndex(0); } else { ! uifc.setCurrInst( ! uifc.getFindCollection().getElements()[uifc.getFindCollIndex()]); uifc.setRootMsg(uifc.getCurrInst()); uifc.initPosition(uifc.getCurrInst().getShortName()); uifc.setCurrClass(uifc.getCurrInst().getShortName()); } owner.doActionDisplayHook(uifc); } --- 426,436 ---- uifc.setFindCollIndex(0); } else { ! trace(1,"selecting index " + uifc.getFindCollIndex() + " of " + ! uifc.getFindQuery() + " modePath: " + modePath); ! uifc.setCurrInst(foundinst); uifc.setRootMsg(uifc.getCurrInst()); uifc.initPosition(uifc.getCurrInst().getShortName()); uifc.setCurrClass(uifc.getCurrInst().getShortName()); } + UIFormContext.debugDump("doActionSelect post-proc, pre-hook:",uifc); owner.doActionDisplayHook(uifc); } *************** *** 780,784 **** uifc.setFindQuery(null); //clear finding query uifc.popPosition(); } //remove field identifier ! else if(modePath.endsWith("FINDING.LISTING")) { uifc.popModeStack(); //return to FINDING mode uifc.popModeStack(); //return to UPDATING/ADDING mode --- 782,786 ---- uifc.setFindQuery(null); //clear finding query uifc.popPosition(); } //remove field identifier ! else if(modePath.endsWith(".FINDING.LISTING")) { uifc.popModeStack(); //return to FINDING mode uifc.popModeStack(); //return to UPDATING/ADDING mode *************** *** 791,794 **** --- 793,800 ---- uifc.popPosition(); } uifc.evalPosition(); } //reset currInst info + else if(modePath.equals("FINDING.LISTING")) { + uifc.setRootMsg(null); //unroot us from the instance + uifc.setCurrInst(null); //we are viewing + uifc.popModeStack(); } //return to FINDING else { throw new UIFormManagerException("unknown cancel situation."); } *************** *** 1750,1754 **** } else if(level==1) { ! System.out.println(text); } } --- 1756,1760 ---- } else if(level==1) { ! //System.out.println(text); } } |
From: Eric P. <th...@us...> - 2009-07-29 12:58:36
|
Update of /cvsroot/sandev/sand/platform/tools/src/org/sandev/tools/HTTP In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30395 Modified Files: XHTMLScreenAdaptor.java Log Message: Factored loadSpecifiedInstance and extended it to be able to handle driving a find or add operation for an array field. Index: XHTMLScreenAdaptor.java =================================================================== RCS file: /cvsroot/sandev/sand/platform/tools/src/org/sandev/tools/HTTP/XHTMLScreenAdaptor.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** XHTMLScreenAdaptor.java 23 Apr 2008 22:38:52 -0000 1.30 --- XHTMLScreenAdaptor.java 29 Jul 2009 12:58:23 -0000 1.31 *************** *** 438,442 **** loadUIAction(uifc,uiri,link,owner,user,uwl); } if(i==primaryFormIndex) { ! loadSpecifiedInstance(uifc,owner,user); } } //uifc.debugDump(" *** reconstructed form: " + link.getName() + " ***",uifc); link.setFormState(uifc); --- 438,442 ---- loadUIAction(uifc,uiri,link,owner,user,uwl); } if(i==primaryFormIndex) { ! initCustomAction(uifc,owner,user); } } //uifc.debugDump(" *** reconstructed form: " + link.getName() + " ***",uifc); link.setFormState(uifc); *************** *** 453,462 **** /** ! * If a particular instance was specified in the URL parameters, then ! * initialize the current form with it. This method also handles ! * partial specifications and buttons. */ ! protected void loadSpecifiedInstance(UIFormContext uifc,UIFormOwner owner, ! AuthUser user) throws UIScreenAdaptorException { --- 453,462 ---- /** ! * If a button was specified in the URL params, then set up to handle ! * it. This handles custom actions and tab selection, then calls ! * to handle more specified instance param driving. */ ! protected void initCustomAction(UIFormContext uifc,UIFormOwner owner, ! AuthUser user) throws UIScreenAdaptorException { *************** *** 464,476 **** if((button!=null)&&(!button.equals(""))) { debug(owner,"loadSpecifiedInstance: button " + button + ! " specified in URL."); int action=uifc.actionLabelToValue(button); ! if(action>uifc.ACTION_CUSTOM) { uifc.setAction(action); } ! else { uifc.setAction(UIFormContext.ACTION_CUSTOM); ! selectTab(uifc,button); uifc.clearOutputText(); //clear for button name uifc.appendInfo(button); } } String classname=uifc.getParam("class"); if((classname==null)||(classname.equals(""))) { --- 464,495 ---- if((button!=null)&&(!button.equals(""))) { debug(owner,"loadSpecifiedInstance: button " + button + ! " specified in URL."); //driving action via params.. int action=uifc.actionLabelToValue(button); ! if(action>uifc.ACTION_CUSTOM) { //defined action: edit, find etc uifc.setAction(action); } ! else { //not defined, presumably custom uifc.setAction(UIFormContext.ACTION_CUSTOM); ! selectTab(uifc,button); //select form tab if that's what it was uifc.clearOutputText(); //clear for button name uifc.appendInfo(button); } } + //At this point custom action setup and form tab selection is done. + //Check if we are driving more explicitely. + loadSpecifiedInstance(uifc,owner,user); + } + + + /** + * If a particular instance was specified in the URL parameters, + * then initialize the current form with it and handle setup of + * standard actions. Advanced driving requires that you specify + * the class and uniqueID of the instance we will be working with. + * That allows for jumping to pretty much anything, and helps to + * avoid having this processing conflict with the custom form + * buttons and tabs set up in the UI definition. + */ + protected void loadSpecifiedInstance(UIFormContext uifc,UIFormOwner owner, + AuthUser user) + throws UIScreenAdaptorException + { String classname=uifc.getParam("class"); if((classname==null)||(classname.equals(""))) { *************** *** 491,516 **** uifc.appendWarning(classname + " " + id + " not found."); } else { ! uifc.setRootMsg(spm); ! uifc.setCurrInst(spm); ! uifc.setCurrClass(spm.getShortName()); ! String position=uifc.getParam("pos"); ! if((position!=null)&&(!position.trim().equals(""))) { ! debug(owner,"loadSpecifiedInstance: pos " + position + ! " specified in URL."); ! uifc.initPosition(position); ! uifc.evalPosition(); } ! else { ! uifc.initPosition(spm.getShortName()); } ! if(uifc.getAction()!=UIFormContext.ACTION_CUSTOM) { ! uifc.setAction(UIFormContext.ACTION_UNDEFINED); } ! uifc.setModePath("LISTING"); ! if((button!=null)&&(button.equals("edit"))) { uifc.setModePath("LISTING.UPDATING"); ! debug(owner,"loadSpecifiedInstance calling edit hook"); ! owner.doActionEditHook(uifc); } ! else { ! debug(owner,"loadSpecifiedInstance calling display hook"); ! owner.doActionDisplayHook(uifc); } } ! debug(owner,"loadSpecifiedInstance complete."); } --- 510,561 ---- uifc.appendWarning(classname + " " + id + " not found."); } else { ! initSpecifiedInstance(uifc,owner,user,spm); } ! } ! ! ! /** ! * Given an instance, initialize our form with it as specified by ! * the URL parameters. ! */ ! protected void initSpecifiedInstance(UIFormContext uifc,UIFormOwner owner, ! AuthUser user,SandPersistMessage spm) ! { ! uifc.setRootMsg(spm); ! uifc.setCurrInst(spm); ! uifc.setCurrClass(spm.getShortName()); ! String position=uifc.getParam("pos"); ! if((position!=null)&&(!position.trim().equals(""))) { ! debug(owner,"loadSpecifiedInstance: pos " + position + ! " specified in URL."); ! uifc.initPosition(position); ! uifc.evalPosition(); } //go to the specified subpart ! else { //just init with at the top level of the instance ! uifc.initPosition(spm.getShortName()); } ! //at this point we have the correctly initialized instance ! String field=uifc.getParam("field"); ! String findclass=uifc.getParam("findclass"); ! switch(uifc.getAction()) { ! case UIFormContext.ACTION_CUSTOM: ! return; //owner will handle it ! case UIFormContext.ACTION_EDIT: ! uifc.setModePath("LISTING.UPDATING"); ! debug(owner,"loadSpecifiedInstance calling edit hook"); ! owner.doActionEditHook(uifc); ! break; ! case UIFormContext.ACTION_FIND: ! case UIFormContext.ACTION_NEW: ! if((field!=null)&&(!field.trim().equals(""))&& ! (findclass!=null)&&(!findclass.trim().equals(""))) { uifc.setModePath("LISTING.UPDATING"); ! debug(owner,"initSpecifiedInstance edit hook before find"); ! owner.doActionEditHook(uifc); ! uifc.setCurrClass(findclass); ! uifc.pushPosition(field + "[-1]"); //append ! break; } //otherwise fall through to default processing below ! default: //action not handle, reset and display ! uifc.setAction(UIFormContext.ACTION_UNDEFINED); ! uifc.setModePath("LISTING"); ! debug(owner,"loadSpecifiedInstance calling display hook"); ! owner.doActionDisplayHook(uifc); } } |
From: Eric P. <th...@us...> - 2009-07-26 14:41:13
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7845 Modified Files: StringUtil.java Log Message: Added isJavaIdentifier utility method. Tired of this being hard to find when I need it. Index: StringUtil.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util/StringUtil.java,v retrieving revision 1.31 retrieving revision 1.32 diff -C2 -d -r1.31 -r1.32 *** StringUtil.java 9 Jul 2009 01:39:15 -0000 1.31 --- StringUtil.java 26 Jul 2009 14:40:59 -0000 1.32 *************** *** 1332,1335 **** --- 1332,1351 ---- } + + /** + * Returns true if the given string is a valid java identifier, false + * otherwise. + */ + public static boolean isJavaIdentifier(String str) + { + if((str==null)||(str.length()==0)|| + (!Character.isJavaIdentifierStart(str.charAt(0)))) { + return false; } + for(int i=1;i<str.length();i++) { + if(!Character.isJavaIdentifierPart(str.charAt(i))) { + return false; } } + return true; + } + } |
From: Eric P. <th...@us...> - 2009-07-25 18:39:23
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv7201 Modified Files: AbstractFormManager.java Log Message: Factored doActionFind for clarity. In the case where there is an error processing the find, stay on the find form to allow giving the user another try. This allows inadequate match restrictions to be reported so the user so they can revise their query. In any case this seems better than just displaying the default crash screen. Index: AbstractFormManager.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util/AbstractFormManager.java,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** AbstractFormManager.java 9 Jul 2009 23:13:15 -0000 1.41 --- AbstractFormManager.java 25 Jul 2009 18:39:07 -0000 1.42 *************** *** 612,617 **** trace(0,"AbstractFormManager.doActionFind"); owner.doActionFindHook(uifc); ! String modePath=uifc.getModePath(); ! trace(1,"modePath: " + modePath); //don't ask to resolve when we come back after hitting the find //button on the query form. --- 612,617 ---- trace(0,"AbstractFormManager.doActionFind"); owner.doActionFindHook(uifc); ! //String modePath=uifc.getModePath(); ! //trace(1,"modePath: " + modePath); //don't ask to resolve when we come back after hitting the find //button on the query form. *************** *** 638,668 **** case RC_DONE: //we know what class trace(1," doActionFind RC_DONE"); ! String queryType="none"; ! SandQueryMessage sqm=uifc.getFindQuery(); ! if(sqm!=null) { ! queryType=sqm.getShortName().substring( ! 0,sqm.getShortName().lastIndexOf("Query")); } ! trace(1," doActionFind queryType: " + queryType); ! if((sqm==null)|| ! (!queryType.equals(uifc.getCurrClass()))|| ! (!modePath.endsWith("FINDING"))) { ! trace(1," doActionFind do query form"); ! uifc.setFindQuery(null); ! uifc.setFindCollection(null); ! if(!modePath.endsWith("FINDING")) { ! uifc.pushModeStack(UIFormInitializer.MODESTACK_FINDING); } ! return; } ! if(modePath.endsWith("LISTING.FINDING")) { ! trace(1," doActionFind popping back to LISTING"); ! uifc.popModeStack(); } //just "LISTING" again ! else { ! trace(1," doActionFind pushing LISTING"); ! uifc.pushModeStack(UIFormInitializer.MODESTACK_LISTING); } ! trace(1," doActionFind calling owner.formFind"); ! sqm.setPagination(SandQueryMessage.PAGE_ALL); //you want this ! uifc.setFindCollection(owner.formFind(sqm,uifc)); ! uifc.setFindCollIndex(0); //start at the beginning ! if(uifc.getFindCollMaxDisplay()<=0) { ! uifc.setFindCollMaxDisplay(20); } break; default: --- 638,642 ---- case RC_DONE: //we know what class trace(1," doActionFind RC_DONE"); ! doActionFindResolved(uifc,owner); break; default: *************** *** 673,676 **** --- 647,702 ---- /** + * Workhorse for doActionFind which assumes that the query class has + * been resolved already. See the comments there for more info. + */ + protected void doActionFindResolved(UIFormContext uifc,UIFormOwner owner) + { + owner.doActionFindHook(uifc); + String modePath=uifc.getModePath(); + String queryType="none"; + SandQueryMessage sqm=uifc.getFindQuery(); + if(sqm!=null) { + queryType=sqm.getShortName().substring( + 0,sqm.getShortName().lastIndexOf("Query")); } + trace(1," doActionFindResolved queryType: " + queryType); + //find form display case: + if((sqm==null)|| + (!queryType.equals(uifc.getCurrClass()))|| + (!modePath.endsWith("FINDING"))) { + trace(1," doActionFindResolved do query form"); + uifc.setFindQuery(null); + uifc.setFindCollection(null); + if(!modePath.endsWith("FINDING")) { + uifc.pushModeStack(UIFormInitializer.MODESTACK_FINDING); } + return; } + //find form processing case: + if(modePath.endsWith("LISTING.FINDING")) { + trace(1," doActionFindResolved popping back to LISTING"); + uifc.popModeStack(); } //just "LISTING" again + else { + trace(1," doActionFindResolved pushing LISTING"); + uifc.pushModeStack(UIFormInitializer.MODESTACK_LISTING); } + trace(1," doActionFindResolved calling owner.formFind"); + sqm.setPagination(SandQueryMessage.PAGE_ALL); //you want paging + try { + uifc.setFindCollection(owner.formFind(sqm,uifc)); + uifc.setFindCollIndex(0); //start at the beginning + if(uifc.getFindCollMaxDisplay()<=0) { + uifc.setFindCollMaxDisplay(20); } + } catch(Exception e) { + //the exception may be benign (e.g. inadequate query information) + //so we redisplay the find form to give them another shot + //e.printStackTrace(); + String err=e.getMessage(); + if(e.getCause()!=null) { + err=e.getCause().getMessage(); } + uifc.appendError(err); + if(uifc.getModePath().endsWith("FINDING.LISTING")) { + uifc.popModeStack(); } //redisplay find form + } + } + + + /** * The user cancels the current operation. This method is called * anytime the user clicks the "cancel" button, except for in a *************** *** 1724,1728 **** } else if(level==1) { ! //System.out.println(text); } } --- 1750,1754 ---- } else if(level==1) { ! System.out.println(text); } } |
From: Eric P. <th...@us...> - 2009-07-24 17:59:51
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/structs In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23243 Modified Files: CacheStatsStruct.java ServerDeclarationStruct.java StatsStruct.java Log Message: Added some help to the fields. Index: ServerDeclarationStruct.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/structs/ServerDeclarationStruct.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** ServerDeclarationStruct.java 29 Aug 2008 19:39:03 -0000 1.3 --- ServerDeclarationStruct.java 24 Jul 2009 17:59:35 -0000 1.4 *************** *** 1,5 **** /* * SAND development/deployment environment ! * Copyright (C) 2002,2007-2008 SAND Services Inc. * * This library is free software; you can redistribute it and/or --- 1,5 ---- /* * SAND development/deployment environment ! * Copyright (C) 2002,2007-2009 SAND Services Inc. * * This library is free software; you can redistribute it and/or *************** *** 44,47 **** --- 44,49 ---- * @sand.stringlength 20 128 * @sand.flags unique + * @sand.help + * The name of the server for SAND Configuration purposes. */ protected String servername; *************** *** 49,53 **** /** ! *Additional descriptive information useful for identifying this * server. Optional. * --- 51,55 ---- /** ! * Additional descriptive information useful for identifying this * server. Optional. * *************** *** 55,58 **** --- 57,63 ---- * @sand.invalid "SANDEV_INVALID_DESCRIPTION" * @sand.stringlength 255 4096 + * @sand.help + * Additional descriptive information useful for identifying this + * server. Optional. */ protected String description; *************** *** 75,78 **** --- 80,88 ---- * @sand.invalid "SANDEV_INVALID_SERVERID" * @sand.stringlength 30 80 + * @sand.help + * A unique identifier for this server. When determining which + * nodes out of a configuration should be loaded for a particular + * machine, the SAND environment checks the ID of the machine it is + * running on against this value. */ protected String serverID; Index: StatsStruct.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/structs/StatsStruct.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** StatsStruct.java 29 Aug 2008 19:39:03 -0000 1.2 --- StatsStruct.java 24 Jul 2009 17:59:35 -0000 1.3 *************** *** 1,5 **** /* * SAND development/deployment environment ! * Copyright (C) 2002,2008 SAND Services Inc. * * This library is free software; you can redistribute it and/or --- 1,5 ---- /* * SAND development/deployment environment ! * Copyright (C) 2002,2008,2009 SAND Services Inc. * * This library is free software; you can redistribute it and/or *************** *** 56,59 **** --- 56,62 ---- /** * A collection of statistics represented in name/value form. + * + * @sand.help + * A collection of statistics represented in name/value form. */ protected SandAttrVal[] data; Index: CacheStatsStruct.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/structs/CacheStatsStruct.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** CacheStatsStruct.java 29 Aug 2008 19:39:03 -0000 1.4 --- CacheStatsStruct.java 24 Jul 2009 17:59:35 -0000 1.5 *************** *** 1,5 **** /* * SAND development/deployment environment ! * Copyright (C) 2007-2008 SAND Services Inc. * * This library is free software; you can redistribute it and/or --- 1,5 ---- /* * SAND development/deployment environment ! * Copyright (C) 2007-2009 SAND Services Inc. * * This library is free software; you can redistribute it and/or *************** *** 62,65 **** --- 62,68 ---- /** * The summary cache items by class. + * + * @sand.help + * The summary cache items by class. */ protected CacheMemSummaryStruct[] items; *************** *** 78,81 **** --- 81,87 ---- /** * The oldest messages in the cache. + * + * @sand.help + * The oldest messages in the cache. */ protected CacheItemSummaryStruct[] oldest; |
From: Eric P. <th...@us...> - 2009-07-24 17:59:18
|
Update of /cvsroot/sandev/sand/apps/ui/src/org/sandev/ui/structs In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv23130 Modified Files: ScreenStruct.java Log Message: Added some help to the fields. Index: ScreenStruct.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/ui/src/org/sandev/ui/structs/ScreenStruct.java,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** ScreenStruct.java 29 Aug 2008 20:03:44 -0000 1.4 --- ScreenStruct.java 24 Jul 2009 17:59:08 -0000 1.5 *************** *** 1,5 **** /* * SAND development/deployment environment ! * Copyright (C) 2003,2007-2008 SAND Services Inc. * * This library is free software; you can redistribute it and/or --- 1,5 ---- /* * SAND development/deployment environment ! * Copyright (C) 2003,2007-2009 SAND Services Inc. * * This library is free software; you can redistribute it and/or *************** *** 51,54 **** --- 51,56 ---- * @sand.flags unique * @sand.invalid "" + * @sand.help + * A unique name identifying this screen. */ protected String name; *************** *** 66,69 **** --- 68,73 ---- * @sand.invalid "INVALID_TEMPLATE_NAME" * @sand.stringlength 20 127 + * @sand.help + * The name of the rendering template. */ protected String template; *************** *** 84,87 **** --- 88,93 ---- * @sand.default DEFAULT * @sand.invalid -1 + * @sand.help + * The display transmission security for this screen. */ protected int security; *************** *** 91,94 **** --- 97,103 ---- * The links to display on this screen. Links to things other than * screens are handled in template transformation. + * + * @sand.help + * The links to display on this screen. */ protected LinkStruct[] links; *************** *** 104,107 **** --- 113,119 ---- * * @sand.default 0 + * @sand.help + * The index of the link which functions as the primary form for the + * screen. */ protected int primaryFormIndex; |
From: Eric P. <th...@us...> - 2009-07-24 17:58:21
|
Update of /cvsroot/sandev/sand/platform/tools/build/generate/org/sandev/generator In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv22933 Modified Files: XHTMLFormGenerator.java Log Message: Added some optional debugging code in case you want to track down missing help statements. Commented out to prevent excessive noise for apps not using help. Index: XHTMLFormGenerator.java =================================================================== RCS file: /cvsroot/sandev/sand/platform/tools/build/generate/org/sandev/generator/XHTMLFormGenerator.java,v retrieving revision 1.47 retrieving revision 1.48 diff -C2 -d -r1.47 -r1.48 *** XHTMLFormGenerator.java 3 Jun 2009 21:06:32 -0000 1.47 --- XHTMLFormGenerator.java 24 Jul 2009 17:58:04 -0000 1.48 *************** *** 464,467 **** --- 464,470 ---- GeneralTagHelp gth=GeneralTagHelp.getGeneralTagHelp(fd); String tipText=gth.getTipText(); + //"@sand.help first argument - help text - not found" details: + //if(tipText.equals("")) { + // System.out.println("No help found for " + fd); } FieldTagMetatype ftm=FieldTagMetatype.getFieldTagMetatype(fd); String fieldMetatype=""; |
From: Eric P. <th...@us...> - 2009-07-09 23:14:33
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv30080 Modified Files: UIFormContext.java Log Message: Do not display add or delete buttons if you already have too many contexts pushed onto the stack. Index: UIFormContext.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util/UIFormContext.java,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** UIFormContext.java 2 Apr 2009 23:56:30 -0000 1.23 --- UIFormContext.java 9 Jul 2009 23:14:28 -0000 1.24 *************** *** 351,357 **** --- 351,361 ---- if(actionSupported(ACTION_ADD)) { if((currClass==null)||(currClass.equals(""))) { + disableAction(ACTION_ADD); } + if(modePath.endsWith("ADDING.FINDING.LISTING")) { //too deep disableAction(ACTION_ADD); } } if(actionSupported(ACTION_DELETE)) { if((currClass==null)||(currClass.equals(""))) { + disableAction(ACTION_DELETE); } + if(modePath.endsWith("ADDING.FINDING.LISTING")) { //too deep disableAction(ACTION_DELETE); } } if(actionSupported(ACTION_FIND)) { |
From: Eric P. <th...@us...> - 2009-07-09 23:13:24
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29815 Modified Files: AbstractFormManager.java Log Message: Added capability for doActionCancel to be able to haul itself out of an extra level of UPDATING.ADDING.FINDING.LISTING just so if we are there at least the cancel button will do something other than crash. Index: AbstractFormManager.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util/AbstractFormManager.java,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** AbstractFormManager.java 9 Jul 2009 01:42:20 -0000 1.40 --- AbstractFormManager.java 9 Jul 2009 23:13:15 -0000 1.41 *************** *** 732,735 **** --- 732,736 ---- trace(0,"AbstractFormManager.doActionCancel"); String modePath=uifc.getModePath(); + System.out.println("doActionCancel modePath: " + modePath); if(uifc.getMode()==UIFormInitializer.MODESTACK_UPDATING) { uifc.setUpdates(null); //get rid of any interim edits *************** *** 759,762 **** --- 760,767 ---- uifc.setFindCollection(null); //clear the collection we found uifc.popPosition(); //remove field identifier + modePath=uifc.getModePath(); + if(modePath.endsWith("UPDATING.ADDING")) { //still too deep + uifc.popModeStack(); + uifc.popPosition(); } uifc.evalPosition(); } //reset currInst info else { |
From: Eric P. <th...@us...> - 2009-07-09 01:42:28
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29369 Modified Files: AbstractFormManager.java Log Message: Turn on pagination support for all find queries. Index: AbstractFormManager.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util/AbstractFormManager.java,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** AbstractFormManager.java 2 Apr 2009 23:57:02 -0000 1.39 --- AbstractFormManager.java 9 Jul 2009 01:42:20 -0000 1.40 *************** *** 660,663 **** --- 660,664 ---- uifc.pushModeStack(UIFormInitializer.MODESTACK_LISTING); } trace(1," doActionFind calling owner.formFind"); + sqm.setPagination(SandQueryMessage.PAGE_ALL); //you want this uifc.setFindCollection(owner.formFind(sqm,uifc)); uifc.setFindCollIndex(0); //start at the beginning |
From: Eric P. <th...@us...> - 2009-07-09 01:41:02
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29223 Modified Files: MatchUtil.java Log Message: Added wildcardify utility method and recognition of ILIKE operator. Index: MatchUtil.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util/MatchUtil.java,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** MatchUtil.java 29 Aug 2008 19:04:44 -0000 1.7 --- MatchUtil.java 9 Jul 2009 01:40:40 -0000 1.8 *************** *** 474,478 **** (expr.startsWith("!="))|| (expr.startsWith("="))|| ! (expr.startsWith("LIKE("))) { return true; } return false; --- 474,479 ---- (expr.startsWith("!="))|| (expr.startsWith("="))|| ! (expr.startsWith("LIKE("))|| ! (expr.startsWith("ILIKE("))) { return true; } return false; *************** *** 671,673 **** --- 672,697 ---- } + + /** + * Insert wildcards around and through the given matchval, + * returning the result. This yields a maximally matchable value + * for the text given. + */ + public static String wildcardify(String matchval) + { + StringBuffer sbuf=new StringBuffer(); + String[] toks=tokenize(matchval); + for(int i=0;i<toks.length;i++) { + if(isOperator(toks[i])) { + ; //separate operators not compatible with wildcard matching + } + else { + if(!(toks[i].startsWith("*"))) { + sbuf.append("*"); } + sbuf.append(toks[i]); + if(!(toks[i].endsWith("*"))) { + sbuf.append("*"); } } } + return sbuf.toString(); + } + } |
From: Eric P. <th...@us...> - 2009-07-09 01:39:20
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv29009 Modified Files: StringUtil.java Log Message: Added haveValue generic utility method. Index: StringUtil.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util/StringUtil.java,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** StringUtil.java 21 May 2009 17:09:02 -0000 1.30 --- StringUtil.java 9 Jul 2009 01:39:15 -0000 1.31 *************** *** 1306,1309 **** --- 1306,1320 ---- + /** + * Return true if a non-empty value for text was given, false otherwise. + */ + public static boolean haveValue(String text) + { + if((text==null)||(text.trim().equals(""))) { + return false; } + return true; + } + + /** * Return true if both strings are null, or if they are both not |
From: Eric P. <th...@us...> - 2009-07-09 01:36:55
|
Update of /cvsroot/sandev/sand/platform/tools/build/generate/org/sandev/generator In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28669 Modified Files: SQLQueryProcessorGenerator.java Log Message: Extend the wildcard matching to ignore case for PostgreSQL. MySQL does this by default. Index: SQLQueryProcessorGenerator.java =================================================================== RCS file: /cvsroot/sandev/sand/platform/tools/build/generate/org/sandev/generator/SQLQueryProcessorGenerator.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** SQLQueryProcessorGenerator.java 22 May 2009 21:13:48 -0000 1.15 --- SQLQueryProcessorGenerator.java 9 Jul 2009 01:36:52 -0000 1.16 *************** *** 453,457 **** out.println(" if((sav.getAttr().equals(\"" + fields[i].name() + "\"))&&"); out.println(" (val!=null)&&(val.indexOf(\"*\")>=0)) {"); ! out.println(" val=\"LIKE(\" + val.replace('*','%') + \")\"; }"); } } out.println(" if((val==null)||(val.equals(\"\"))) {"); --- 453,460 ---- out.println(" if((sav.getAttr().equals(\"" + fields[i].name() + "\"))&&"); out.println(" (val!=null)&&(val.indexOf(\"*\")>=0)) {"); ! String likeop="LIKE"; //MySQL is case insensitive by default ! if(structmap instanceof PostgreSQLStructMapper) { ! likeop="ILIKE"; } //case insensitive ! out.println(" val=\"" + likeop + "(\" + val.replace('*','%') + \")\"; }"); } } out.println(" if((val==null)||(val.equals(\"\"))) {"); |
From: Eric P. <th...@us...> - 2009-07-09 01:35:16
|
Update of /cvsroot/sandev/sand/platform/tools/src/org/sandev/tools/UIProcessor In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv28379 Modified Files: XHTMLSandUIServlet.java Log Message: There are times when you want the uniqueID of the current user, so provide convenient access with the rest of the login info. Index: XHTMLSandUIServlet.java =================================================================== RCS file: /cvsroot/sandev/sand/platform/tools/src/org/sandev/tools/UIProcessor/XHTMLSandUIServlet.java,v retrieving revision 1.34 retrieving revision 1.35 diff -C2 -d -r1.34 -r1.35 *** XHTMLSandUIServlet.java 2 Sep 2008 15:37:27 -0000 1.34 --- XHTMLSandUIServlet.java 9 Jul 2009 01:35:08 -0000 1.35 *************** *** 1322,1329 **** --- 1322,1337 ---- "href=\"" + targetURL + "\">" + target + "</a>"); out.println(" </span>"); + //dump the user login class out.println(" <span class=\"userLoginClass\" id=\"userLoginClass\">"); out.println(" <b class=\"fieldname\" id=\"classShortName\">" + classname + "</b>"); out.println(" </span>"); + //dump the uniqueID + out.println(" <span class=\"userLoginField\" id=\"uniqueID\">"); + out.println(" <b class=\"fieldname\" id=\"uniqueID\">uniqueID</b>"); + out.println(" <code class=\"fieldvalue\" id=\"uniqueID\">" + + user.getUniqueID() + "</code>"); + out.println(" <br class=\"fieldLineBreak\"/></span>"); + //dump all the summary fields for(int i=0;i<fields.length;i++) { String field=fields[i]; |
From: Eric P. <th...@us...> - 2009-06-03 21:06:51
|
Update of /cvsroot/sandev/sand/platform/tools/build/generate/org/sandev/generator In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11270 Modified Files: XHTMLFormGenerator.java Log Message: Handle sourceofupload metatype field declarations. Index: XHTMLFormGenerator.java =================================================================== RCS file: /cvsroot/sandev/sand/platform/tools/build/generate/org/sandev/generator/XHTMLFormGenerator.java,v retrieving revision 1.46 retrieving revision 1.47 diff -C2 -d -r1.46 -r1.47 *** XHTMLFormGenerator.java 2 Apr 2009 23:55:58 -0000 1.46 --- XHTMLFormGenerator.java 3 Jun 2009 21:06:32 -0000 1.47 *************** *** 1493,1497 **** if(isBasic(fieldType)) { out.println(" key=prefix + \"" + fieldName + "\";"); ! out.println(" value=getParam(params,key.intern());"); if(ftf.hasFlagDynamicSelect()) { out.println(" choices=loadArrayAssociation(prefix,params,\"" + fieldName + "\");"); --- 1493,1500 ---- if(isBasic(fieldType)) { out.println(" key=prefix + \"" + fieldName + "\";"); ! if(fieldMetatype.startsWith("sourceofupload")) { ! out.println(" value=getSourceFileValue(params,key.intern());"); } ! else { ! out.println(" value=getParam(params,key.intern());"); } if(ftf.hasFlagDynamicSelect()) { out.println(" choices=loadArrayAssociation(prefix,params,\"" + fieldName + "\");"); |
From: Eric P. <th...@us...> - 2009-06-03 21:05:45
|
Update of /cvsroot/sandev/sand/platform/tools/src/org/sandev/tools/HTTP In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv11050 Modified Files: AbstractXHTMLFormAdaptor.java Log Message: Handle sourceofupload metatype fields. These have no editing display, and the value is read first from the original source file name set as a side effect of the multipart submission, then from the field value if nothing was uploaded. Index: AbstractXHTMLFormAdaptor.java =================================================================== RCS file: /cvsroot/sandev/sand/platform/tools/src/org/sandev/tools/HTTP/AbstractXHTMLFormAdaptor.java,v retrieving revision 1.73 retrieving revision 1.74 diff -C2 -d -r1.73 -r1.74 *** AbstractXHTMLFormAdaptor.java 2 Apr 2009 23:52:53 -0000 1.73 --- AbstractXHTMLFormAdaptor.java 3 Jun 2009 21:05:39 -0000 1.74 *************** *** 3361,3364 **** --- 3361,3366 ---- throws UIFormAdaptorException { + if("sourceofupload".equals(metatype)) { + return; } //input gathered as a side effect, no edit display if(value==null) { value=""; } *************** *** 3875,3878 **** --- 3877,3896 ---- } + + /** + * Check if there is a source file name from file upload + * processing and get the value for that. If not available then + * get the parameter value from the map. + */ + protected String getSourceFileValue(Map params,String key) + { + String altkey="SAND_UploadedFileSource"; + String value=getParam(params,altkey.intern()); + if(value!=null) { + return value; } + value=getParam(params,key.intern()); + return value; + } + } |
From: Eric P. <th...@us...> - 2009-05-22 21:18:29
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/structs In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1987 Modified Files: SandQueryMessage.java Log Message: Defined a prefix used when passing a SQL query function through as an attribute in a match expression. Provides for back end handling and for authorization screening. Index: SandQueryMessage.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/structs/SandQueryMessage.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** SandQueryMessage.java 3 Apr 2009 00:00:04 -0000 1.6 --- SandQueryMessage.java 22 May 2009 21:18:16 -0000 1.7 *************** *** 203,206 **** --- 203,217 ---- /** + * A prefix used to indicate that a match attribute is actually a + * call to a function defined in the underlying persistence + * mechanism. By default function calls are not authorized, but + * they can be allowed through on a case by case basis to take + * advantage of database query functions. This flag precedes any + * query function call so it is clearly flagged. + */ + public final static String PERSISTFUNCTION = "SANDPersist.function: "; + + + /** * Error message when a function is specified without operands */ |
From: Eric P. <th...@us...> - 2009-05-22 21:16:28
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/DataManager In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1780 Modified Files: DataManagerNode.java DataManagerNodeDecl.java Log Message: Added access to the AuthFilter from here so we can use it to security check persistence functions. Index: DataManagerNodeDecl.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/DataManager/DataManagerNodeDecl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** DataManagerNodeDecl.java 21 Jul 2008 17:03:32 -0000 1.3 --- DataManagerNodeDecl.java 22 May 2009 21:16:19 -0000 1.4 *************** *** 151,153 **** --- 151,164 ---- protected String persisterDataSource; + + /** + * The fully qualified name of the AuthFilter class to use when + * checking authorization. + * + * @sand.default "org.sandev.basics.Authorizer.DummyAuthFilter" + * @sand.invalid "AUTHORIZER_INVALID_AUTHFILTER" + * @sand.stringlength 60 120 + */ + protected String authFilterClassName; + } Index: DataManagerNode.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/DataManager/DataManagerNode.java,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** DataManagerNode.java 18 Oct 2007 22:49:35 -0000 1.5 --- DataManagerNode.java 22 May 2009 21:16:19 -0000 1.6 *************** *** 34,37 **** --- 34,38 ---- import org.sandev.basics.util.IDLookup; import org.sandev.basics.util.AuthUser; + import org.sandev.basics.util.AuthFilter; import org.sandev.basics.nodecommon.Controllable; *************** *** 89,92 **** --- 90,107 ---- + /** + * Our AuthFilter, used for checking messages to ensure they don't + * have any unauthorized low level persistence calls. + */ + protected AuthFilter authFilter=null; + /** initializing accessor for authFilter */ + public AuthFilter getAuthFilter() + { + if(authFilter==null) { + authFilter=instantiateAuthFilter(); } + return authFilter; + } + + //////////////////////////////////////// // info methods *************** *** 416,419 **** --- 431,465 ---- + /** + * Instantiate a new AuthFilter. If for any reason we can't instantiate + * the class we were configured with, we log an error and return null. + */ + protected AuthFilter instantiateAuthFilter() { + AuthFilter af=null; + String afClassName=getAuthFilterClassName(); + if((afClassName==null)||(afClassName.equals(""))) { + return null; } + try { + Class afclass=Class.forName(afClassName); + Class[] cparams=null; + java.lang.reflect.Constructor afctor=afclass.getConstructor(cparams); + Object[] ctorargs=null; + Object afobj=afctor.newInstance(ctorargs); + af=(AuthFilter)afobj; + } catch(ClassNotFoundException e) { + log(LOGERROR,"Could not find class " + afClassName + ": " + e); + } catch(NoSuchMethodException e) { + log(LOGERROR,"No default ctor for class " + afClassName + ": " + e); + } catch(java.lang.reflect.InvocationTargetException e) { + log(LOGERROR,"Could not call default ctor for class " + afClassName + ": " + e); + } catch(IllegalAccessException e) { + log(LOGERROR,"Could not access class " + afClassName + ": " + e); + } catch(InstantiationException e) { + log(LOGERROR,"Could not instantiate " + afClassName + ": " + e); + } + return af; + } + + //////////////////////////////////////// // utilities |
From: Eric P. <th...@us...> - 2009-05-22 21:13:55
|
Update of /cvsroot/sandev/sand/platform/tools/build/generate/org/sandev/generator In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1531 Modified Files: SQLQueryProcessorGenerator.java Log Message: Added the ability to specify a persistence function as an attribute of a query. Sometimes you just need to pass through a SQL function call... Index: SQLQueryProcessorGenerator.java =================================================================== RCS file: /cvsroot/sandev/sand/platform/tools/build/generate/org/sandev/generator/SQLQueryProcessorGenerator.java,v retrieving revision 1.14 retrieving revision 1.15 diff -C2 -d -r1.14 -r1.15 *** SQLQueryProcessorGenerator.java 2 Apr 2009 23:54:50 -0000 1.14 --- SQLQueryProcessorGenerator.java 22 May 2009 21:13:48 -0000 1.15 *************** *** 160,163 **** --- 160,165 ---- out.println("import org.sandev.basics.util.MessageUtil;"); out.println("import org.sandev.basics.util.StringUtil;"); + out.println("import org.sandev.basics.util.AuthFilter;"); + out.println("import org.sandev.basics.util.AuthFilterBase;"); out.println(); writeMessageImports(out,decls); *************** *** 297,301 **** out.println(" strbuf.append(\", count(" + tablename + ".uniqueID) \"); }"); out.println(" strbuf.append(" + uncapName + "QueryConnector);"); ! out.println(" get" + name + "SQL(strbuf,list);"); out.println(" if(query.getFunction()==SandQueryMessage.FUNCTION_DATA) {"); FieldDoc[] fields=getFields(cd,true,CONTEXT_PERSISTENCE); --- 299,303 ---- out.println(" strbuf.append(\", count(" + tablename + ".uniqueID) \"); }"); out.println(" strbuf.append(" + uncapName + "QueryConnector);"); ! out.println(" get" + name + "SQL(strbuf,list,dm);"); out.println(" if(query.getFunction()==SandQueryMessage.FUNCTION_DATA) {"); FieldDoc[] fields=getFields(cd,true,CONTEXT_PERSISTENCE); *************** *** 429,433 **** out.println(" * are generated from forms, so they should be consistent. "); out.println(" */"); ! out.println(" public static void get" + name + "SQL(StringBuffer buf,List list)"); out.println(" throws SQLException"); out.println(" {"); --- 431,436 ---- out.println(" * are generated from forms, so they should be consistent. "); out.println(" */"); ! out.println(" public static void get" + name + "SQL(StringBuffer buf,List list,"); ! out.println(" DataManagerNode dm)"); out.println(" throws SQLException"); out.println(" {"); *************** *** 454,460 **** out.println(" if((val==null)||(val.equals(\"\"))) {"); out.println(" continue; } //unspecified match value"); ! out.println(" String attr=sav.getAttr();"); out.println(" int dotindex=attr.indexOf(\".\");"); ! out.println(" if(dotindex<0) { //match in current table"); out.println(" if(attr.equals(EXOP)) {"); out.println(" buf.append(\" \" + val + \" \"); }"); --- 457,468 ---- out.println(" if((val==null)||(val.equals(\"\"))) {"); out.println(" continue; } //unspecified match value"); ! out.println(" String attr=sav.getAttr().trim();"); out.println(" int dotindex=attr.indexOf(\".\");"); ! out.println(" if(attr.startsWith(SandQueryMessage.PERSISTFUNCTION)) {"); ! out.println(" attr=attr.substring(SandQueryMessage.PERSISTFUNCTION.length());"); ! out.println(" securityCheckQueryFunction(\"" + name + "\",attr,val,dm);"); ! out.println(" buf.append(attr);"); ! out.println(" buf.append(val); }"); ! out.println(" else if(dotindex<0) { //match in current table"); out.println(" if(attr.equals(EXOP)) {"); out.println(" buf.append(\" \" + val + \" \"); }"); *************** *** 658,662 **** if(!isArray) { out.println(" if((handleClassSubselect(\"" + parentTable + "." + refField + "\",buf,"); ! out.println(" " + fieldName + "Clause))&&"); out.println(" (!" + fieldName + "Clause.isEmpty())) {"); out.println(" buf.append(\" AND \"); }"); --- 666,670 ---- if(!isArray) { out.println(" if((handleClassSubselect(\"" + parentTable + "." + refField + "\",buf,"); ! out.println(" " + fieldName + "Clause,dm))&&"); out.println(" (!" + fieldName + "Clause.isEmpty())) {"); out.println(" buf.append(\" AND \"); }"); *************** *** 666,670 **** out.println(" buf.append(\"FROM " + childTable + " \");"); out.println(" buf.append(\"WHERE " + childTable + "." + childUID + " != 0 AND \");"); ! out.println(" get" + childmsg + "SQL(buf," + fieldName + "Clause);"); out.print(" buf.append(\" )\"); }"); } else { --- 674,678 ---- out.println(" buf.append(\"FROM " + childTable + " \");"); out.println(" buf.append(\"WHERE " + childTable + "." + childUID + " != 0 AND \");"); ! out.println(" get" + childmsg + "SQL(buf," + fieldName + "Clause,dm);"); out.print(" buf.append(\" )\"); }"); } else { *************** *** 679,683 **** out.println(" buf.append(\"FROM " + childTable + " \");"); out.println(" buf.append(\"WHERE " + childTable + "." + childUID + " != 0 AND \");"); ! out.println(" get" + childmsg + "SQL(buf," + fieldName + "Clause);"); out.println(" buf.append(\" )\");"); out.print(" buf.append(\" )\");"); } } --- 687,691 ---- out.println(" buf.append(\"FROM " + childTable + " \");"); out.println(" buf.append(\"WHERE " + childTable + "." + childUID + " != 0 AND \");"); ! out.println(" get" + childmsg + "SQL(buf," + fieldName + "Clause,dm);"); out.println(" buf.append(\" )\");"); out.print(" buf.append(\" )\");"); } } *************** *** 853,857 **** out.println("protected static boolean handleClassSubselect(String fieldspec,"); out.println(" StringBuffer buf,"); ! out.println(" List clauses)"); out.println(" throws SQLException"); out.println("{"); --- 861,866 ---- out.println("protected static boolean handleClassSubselect(String fieldspec,"); out.println(" StringBuffer buf,"); ! out.println(" List clauses,"); ! out.println(" DataManagerNode dm)"); out.println(" throws SQLException"); out.println("{"); *************** *** 871,875 **** out.println(" if(wroteOutput) {"); out.println(" buf.append(\" AND \"); }"); ! out.println(" wroteOutput=writeClassSubselect(fieldspec,buf,classname,subclause);"); out.println(" iter.remove(); } }"); out.println(" return wroteOutput;"); --- 880,885 ---- out.println(" if(wroteOutput) {"); out.println(" buf.append(\" AND \"); }"); ! out.println(" wroteOutput=writeClassSubselect(fieldspec,buf,classname,"); ! out.println(" subclause,dm);"); out.println(" iter.remove(); } }"); out.println(" return wroteOutput;"); *************** *** 883,887 **** out.println(" */"); out.println("protected static boolean writeClassSubselect(String fieldspec,StringBuffer buf,"); ! out.println(" String classname,List subclause)"); out.println(" throws SQLException"); out.println("{"); --- 893,898 ---- out.println(" */"); out.println("protected static boolean writeClassSubselect(String fieldspec,StringBuffer buf,"); ! out.println(" String classname,List subclause,"); ! out.println(" DataManagerNode dm)"); out.println(" throws SQLException"); out.println("{"); *************** *** 897,901 **** out.println(" buf.append(\"FROM " + tablename + " \");"); out.println(" buf.append(\"WHERE " + tablename + ".uniqueID != 0\");"); ! out.println(" get" + classname + "SQL(buf,subclause);"); out.println(" buf.append(\" )\");"); out.println(" wroteOutput=true; }"); } --- 908,912 ---- out.println(" buf.append(\"FROM " + tablename + " \");"); out.println(" buf.append(\"WHERE " + tablename + ".uniqueID != 0\");"); ! out.println(" get" + classname + "SQL(buf,subclause,dm);"); out.println(" buf.append(\" )\");"); out.println(" wroteOutput=true; }"); } *************** *** 1121,1137 **** out.println(""); out.println(" /**"); out.println(" * Make sure the given value isn't some kind of embedded SQL call"); ! out.println(" * trying to hack around in the db. The account used to access"); ! out.println(" * the database must also be appropriately restricted."); out.println(" */"); out.println(" protected static void securityCheckValue(String value)"); out.println(" throws SQLException"); out.println(" {"); ! out.println(" //This method currently does nothing."); ! out.println(" //TODO: consider adding some code in here to trap 'select',"); ! out.println(" // 'update' etc. statements if we want to show this in"); ! out.println(" // the demo, provided we can define some examples that"); ! out.println(" // make it through matchExprToSQLWork parsing. Also"); ! out.println(" // consider a pluggable interface here"); out.println(" }"); out.println(""); --- 1132,1168 ---- out.println(""); out.println(" /**"); + out.println(" * Throw if the given function call is not allowed for the given"); + out.println(" * message class."); + out.println(" */"); + out.println(" protected static void securityCheckQueryFunction(String msgClass,"); + out.println(" String attr,String val,"); + out.println(" DataManagerNode dm)"); + out.println(" throws SQLException"); + out.println(" {"); + out.println(" AuthFilter af=dm.getAuthFilter();"); + out.println(" if(!(af instanceof AuthFilterBase)) {"); + out.println(" return; } //older app and/or messaging secured dm"); + out.println(" AuthFilterBase afb=(AuthFilterBase)af;"); + out.println(" if(!afb.allowPersistenceFunction(msgClass,attr,val)) {"); + out.println(" throw new SQLException(\"Function not authorized for \" + msgClass + \": \" + attr + val ); }"); + out.println(" }"); + out.println(""); + out.println(""); + out.println(" /**"); out.println(" * Make sure the given value isn't some kind of embedded SQL call"); ! out.println(" * trying to hack around in the db. This is in addition to"); ! out.println(" * restrictions on the account used to acces the database."); out.println(" */"); out.println(" protected static void securityCheckValue(String value)"); out.println(" throws SQLException"); out.println(" {"); ! out.println(" //Currently this method does nothing because we haven't found"); ! out.println(" //any case where it has been possible to pass anything harmful"); ! out.println(" //through the matchExprToSQLWork parsing and reconstruction."); ! out.println(" //Unquoted things tend to not parse, and quoted things get"); ! out.println(" //written as quoted values, so basically this doesn't appear"); ! out.println(" //to be a valid SQL injection vector. This method is being"); ! out.println(" //left here to document this assumption and provide a place to"); ! out.println(" //take action if it turns out to be wrong."); out.println(" }"); out.println(""); |
From: Eric P. <th...@us...> - 2009-05-22 21:12:27
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv1266 Modified Files: AuthFilterBase.java Log Message: Added the allowPersistenceFunction to screen against SQL injection attacks. This is to balance out the added ability to the SQL persister to actually understand function calls which previously were not. Index: AuthFilterBase.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util/AuthFilterBase.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** AuthFilterBase.java 29 Apr 2009 13:16:10 -0000 1.6 --- AuthFilterBase.java 22 May 2009 21:12:12 -0000 1.7 *************** *** 198,201 **** --- 198,219 ---- + /** + * Return true if the given persistence function should be + * allowed, false otherwise. Persistence functions are things + * like embedded SQL that gets passed through for execution as + * part of a WHERE clause. In that case the clause would + * typically be constructed by concatenating the given attr/val. + * + * If your app makes use of this persistence functions in queries, + * then you will need to override this method to verify that what + * is getting passed through is allowable. + */ + public boolean allowPersistenceFunction(String className, + String attr,String val) + { + return false; + } + + //////////////////////////////////////// // AuthFilter interface implementation |
From: Eric P. <th...@us...> - 2009-05-21 17:09:10
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18639 Modified Files: StringUtil.java Log Message: Added an equivalent method that returns true if both strings are null or if their contained values are equal. Factors out the null checking which is otherwise sort of annoying. Index: StringUtil.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util/StringUtil.java,v retrieving revision 1.29 retrieving revision 1.30 diff -C2 -d -r1.29 -r1.30 *** StringUtil.java 6 May 2009 14:40:11 -0000 1.29 --- StringUtil.java 21 May 2009 17:09:02 -0000 1.30 *************** *** 1305,1308 **** --- 1305,1324 ---- } + + /** + * Return true if both strings are null, or if they are both not + * null and the values are are equivalent. + */ + public static boolean equivalent(String str1,String str2) + { + if((str1==null)&&(str2==null)) { + return true; } + else if((str1==null)||(str2==null)) { + return false; } + else if(str1.equals(str2)) { + return true; } + return false; + } + } |
From: Eric P. <th...@us...> - 2009-05-21 17:06:59
|
Update of /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util In directory fdv4jf1.ch3.sourceforge.com:/tmp/cvs-serv18326 Modified Files: MessageUtil.java Log Message: Made the hadErrors method static so you can call it without an instance. Index: MessageUtil.java =================================================================== RCS file: /cvsroot/sandev/sand/apps/basics/src/org/sandev/basics/util/MessageUtil.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** MessageUtil.java 2 Apr 2009 23:58:55 -0000 1.12 --- MessageUtil.java 21 May 2009 17:06:49 -0000 1.13 *************** *** 104,108 **** * Return true if the given AggregateUpdate contains errors. */ ! public boolean hasErrors(AggregateUpdate au) { ErrorInfo[] notices=au.getNotices(); --- 104,108 ---- * Return true if the given AggregateUpdate contains errors. */ ! public static boolean hasErrors(AggregateUpdate au) { ErrorInfo[] notices=au.getNotices(); |