From: Eric P. <th...@us...> - 2004-02-26 03:12:28
|
Update of /cvsroot/sandboss/sand/apps/basics/build/generate/org/sandev/generator In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10241 Modified Files: InstanceGeneratorBase.java Log Message: In the reference resolution methods, we were using an AuthUser param called "user". Unfortunately if we are trying to resolve a field named "user", the templated code doesn't compile. So essentially whatever variable name we use here ends up sort of a reserved word. Switched this to "au" since I don't think we are going to have any reference fields named that in a data model. Index: InstanceGeneratorBase.java =================================================================== RCS file: /cvsroot/sandboss/sand/apps/basics/build/generate/org/sandev/generator/InstanceGeneratorBase.java,v retrieving revision 1.48 retrieving revision 1.49 diff -C2 -d -r1.48 -r1.49 *** InstanceGeneratorBase.java 11 Nov 2003 23:48:35 -0000 1.48 --- InstanceGeneratorBase.java 26 Feb 2004 02:56:59 -0000 1.49 *************** *** 989,995 **** out.println(" * not available, it's not critical (hence the name)."); out.println(" */"); ! out.println(" public " + classname + "[] resolve" + capfield + "ReferencesNonCrit(IDLookup lookup,AuthUser user) {"); out.println(" try {"); ! out.println(" return resolve" + capfield + "References(lookup,user);"); out.println(" } catch(SandException e) {"); out.println(" //note that we skipped this problem"); --- 989,995 ---- out.println(" * not available, it's not critical (hence the name)."); out.println(" */"); ! out.println(" public " + classname + "[] resolve" + capfield + "ReferencesNonCrit(IDLookup lookup,AuthUser au) {"); out.println(" try {"); ! out.println(" return resolve" + capfield + "References(lookup,au);"); out.println(" } catch(SandException e) {"); out.println(" //note that we skipped this problem"); *************** *** 1004,1008 **** out.println(" * looking them up. "); out.println(" */"); ! out.println(" public " + classname + "[] resolve" + capfield + "References(IDLookup lookup,AuthUser user)"); out.println(" throws SandException"); out.println(" {"); --- 1004,1008 ---- out.println(" * looking them up. "); out.println(" */"); ! out.println(" public " + classname + "[] resolve" + capfield + "References(IDLookup lookup,AuthUser au)"); out.println(" throws SandException"); out.println(" {"); *************** *** 1010,1014 **** out.println(" for(int i=0;i<" + fieldname + ".length;i++) {"); out.println(" SandInstanceMessage sim=lookup.getInstance("); ! out.println(" \"" + classname + "\"," + fieldname + "[i],user);"); out.println(" while((sim!=null)&&(!(sim instanceof " + classname + "))) {"); out.println(" sim=sim.convertToSuperstructClass(); }"); --- 1010,1014 ---- out.println(" for(int i=0;i<" + fieldname + ".length;i++) {"); out.println(" SandInstanceMessage sim=lookup.getInstance("); ! out.println(" \"" + classname + "\"," + fieldname + "[i],au);"); out.println(" while((sim!=null)&&(!(sim instanceof " + classname + "))) {"); out.println(" sim=sim.convertToSuperstructClass(); }"); *************** *** 1023,1029 **** out.println(" * the detail is not available, it's not critical (hence the name)."); out.println(" */"); ! out.println(" public " + classname + " resolve" + capfield + "ReferenceNonCrit(IDLookup lookup,AuthUser user) {"); out.println(" try {"); ! out.println(" return resolve" + capfield + "Reference(lookup,user);"); out.println(" } catch(SandException e) {"); out.println(" " + classname + " retval=new " + classname + "();"); --- 1023,1029 ---- out.println(" * the detail is not available, it's not critical (hence the name)."); out.println(" */"); ! out.println(" public " + classname + " resolve" + capfield + "ReferenceNonCrit(IDLookup lookup,AuthUser au) {"); out.println(" try {"); ! out.println(" return resolve" + capfield + "Reference(lookup,au);"); out.println(" } catch(SandException e) {"); out.println(" " + classname + " retval=new " + classname + "();"); *************** *** 1037,1045 **** out.println(" * Converts a reference to an instance by looking it up."); out.println(" */"); ! out.println(" public " + classname + " resolve" + capfield + "Reference(IDLookup lookup,AuthUser user)"); out.println(" throws SandException"); out.println(" {"); out.println(" SandInstanceMessage sim=lookup.getInstance("); ! out.println(" \"" + classname + "\"," + fieldname + ",user);"); out.println(" while((sim!=null)&&(!(sim instanceof " + classname + "))) {"); out.println(" sim=sim.convertToSuperstructClass(); }"); --- 1037,1045 ---- out.println(" * Converts a reference to an instance by looking it up."); out.println(" */"); ! out.println(" public " + classname + " resolve" + capfield + "Reference(IDLookup lookup,AuthUser au)"); out.println(" throws SandException"); out.println(" {"); out.println(" SandInstanceMessage sim=lookup.getInstance("); ! out.println(" \"" + classname + "\"," + fieldname + ",au);"); out.println(" while((sim!=null)&&(!(sim instanceof " + classname + "))) {"); out.println(" sim=sim.convertToSuperstructClass(); }"); *************** *** 1065,1071 **** out.println(" * not available, it's not critical (hence the name)."); out.println(" */"); ! out.println(" public " + refclass + "[] resolve" + capfield + "ReferencesNonCrit(NameLookup lookup,AuthUser user) {"); out.println(" try {"); ! out.println(" return resolve" + capfield + "References(lookup,user);"); out.println(" } catch(SandException e) {"); out.println(" //note that we skipped this problem"); --- 1065,1071 ---- out.println(" * not available, it's not critical (hence the name)."); out.println(" */"); ! out.println(" public " + refclass + "[] resolve" + capfield + "ReferencesNonCrit(NameLookup lookup,AuthUser au) {"); out.println(" try {"); ! out.println(" return resolve" + capfield + "References(lookup,au);"); out.println(" } catch(SandException e) {"); out.println(" //note that we skipped this problem"); *************** *** 1080,1084 **** out.println(" * looking them up. "); out.println(" */"); ! out.println(" public " + refclass + "[] resolve" + capfield + "References(NameLookup lookup,AuthUser user)"); out.println(" throws SandException"); out.println(" {"); --- 1080,1084 ---- out.println(" * looking them up. "); out.println(" */"); ! out.println(" public " + refclass + "[] resolve" + capfield + "References(NameLookup lookup,AuthUser au)"); out.println(" throws SandException"); out.println(" {"); *************** *** 1086,1090 **** out.println(" for(int i=0;i<" + fieldname + ".length;i++) {"); out.println(" retval[i]=(" + refclass + ")"); ! out.println(" lookup.getInstance(\"" + refclass + "\",\"" + reffield + "\"," + fieldname + "[i],user); }"); out.println(" return retval;"); out.println(" }"); } --- 1086,1090 ---- out.println(" for(int i=0;i<" + fieldname + ".length;i++) {"); out.println(" retval[i]=(" + refclass + ")"); ! out.println(" lookup.getInstance(\"" + refclass + "\",\"" + reffield + "\"," + fieldname + "[i],au); }"); out.println(" return retval;"); out.println(" }"); } *************** *** 1096,1102 **** out.println(" * display. If the detail is not available, it's not critical."); out.println(" */"); ! out.println(" public " + refclass + " resolve" + capfield + "ReferenceNonCrit(NameLookup lookup,AuthUser user) {"); out.println(" try {"); ! out.println(" return resolve" + capfield + "Reference(lookup,user);"); out.println(" } catch(SandException e) {"); out.println(" " + refclass + " retval=new " + refclass + "();"); --- 1096,1102 ---- out.println(" * display. If the detail is not available, it's not critical."); out.println(" */"); ! out.println(" public " + refclass + " resolve" + capfield + "ReferenceNonCrit(NameLookup lookup,AuthUser au) {"); out.println(" try {"); ! out.println(" return resolve" + capfield + "Reference(lookup,au);"); out.println(" } catch(SandException e) {"); out.println(" " + refclass + " retval=new " + refclass + "();"); *************** *** 1109,1117 **** out.println(" * Converts a reference to an instance by looking it up."); out.println(" */"); ! out.println(" public " + refclass + " resolve" + capfield + "Reference(NameLookup lookup,AuthUser user)"); out.println(" throws SandException"); out.println(" {"); out.println(" return (" + refclass + ")"); ! out.println(" lookup.getInstance(\"" + refclass + "\",\"" + reffield + "\"," + fieldname + ",user);"); out.println(" }"); } out.println(""); --- 1109,1117 ---- out.println(" * Converts a reference to an instance by looking it up."); out.println(" */"); ! out.println(" public " + refclass + " resolve" + capfield + "Reference(NameLookup lookup,AuthUser au)"); out.println(" throws SandException"); out.println(" {"); out.println(" return (" + refclass + ")"); ! out.println(" lookup.getInstance(\"" + refclass + "\",\"" + reffield + "\"," + fieldname + ",au);"); out.println(" }"); } out.println(""); *************** *** 1927,1931 **** out.println(" public String[] referenceValidate(String[] locations,String prefix,"); out.println(" IDLookup idlookup,NameLookup namelookup,"); ! out.println(" AuthUser user)"); out.println(" throws SandException"); out.println(" {"); --- 1927,1931 ---- out.println(" public String[] referenceValidate(String[] locations,String prefix,"); out.println(" IDLookup idlookup,NameLookup namelookup,"); ! out.println(" AuthUser au)"); out.println(" throws SandException"); out.println(" {"); *************** *** 1944,1948 **** notnull="get" + capfield + "()>0"; } if(isArray) { ! out.println(" Object[] " + fieldname + "References=resolve" + capfield + "References(" + lookup + ",user);"); out.println(" for(int i=0;i<" + fieldname + "References.length;i++) {"); out.println(" //System.out.println(\"refcheck \" + prefix + \"" + fieldname + "[\" + i + \"]\");"); --- 1944,1948 ---- notnull="get" + capfield + "()>0"; } if(isArray) { ! out.println(" Object[] " + fieldname + "References=resolve" + capfield + "References(" + lookup + ",au);"); out.println(" for(int i=0;i<" + fieldname + "References.length;i++) {"); out.println(" //System.out.println(\"refcheck \" + prefix + \"" + fieldname + "[\" + i + \"]\");"); *************** *** 1953,1957 **** out.println(" //System.out.println(\"refcheck \" + prefix + \"" + fieldname + "\");"); out.println(" if((" + notnull + ")&&"); ! out.println(" (resolve" + capfield + "Reference(" + lookup + ",user)==null)) {"); out.println(" //System.out.println(\"BADREF \" + prefix + \"" + fieldname + "\");"); out.println(" locations=ArrayUtils.append(locations,prefix + \"" + fieldname + "\"); }"); } } --- 1953,1957 ---- out.println(" //System.out.println(\"refcheck \" + prefix + \"" + fieldname + "\");"); out.println(" if((" + notnull + ")&&"); ! out.println(" (resolve" + capfield + "Reference(" + lookup + ",au)==null)) {"); out.println(" //System.out.println(\"BADREF \" + prefix + \"" + fieldname + "\");"); out.println(" locations=ArrayUtils.append(locations,prefix + \"" + fieldname + "\"); }"); } } *************** *** 1961,1969 **** out.println(" for(int i=0;i<" + fieldname + "Elements.length;i++) {"); out.println(" locations=((Resolvable)(" + fieldname + "Elements[i])).referenceValidate(locations,"); ! out.println(" prefix + \"" + fieldname + "[\" + i + \"].\",idlookup,namelookup,user); }"); } else { out.println(" if(get" + capfield + "()!=null) {"); out.println(" locations=((Resolvable)(get" + capfield + "())).referenceValidate(locations,"); ! out.println(" prefix + \"" + fieldname + ".\",idlookup,namelookup,user); }"); } } } out.println(" return locations;"); out.println(" }"); --- 1961,1969 ---- out.println(" for(int i=0;i<" + fieldname + "Elements.length;i++) {"); out.println(" locations=((Resolvable)(" + fieldname + "Elements[i])).referenceValidate(locations,"); ! out.println(" prefix + \"" + fieldname + "[\" + i + \"].\",idlookup,namelookup,au); }"); } else { out.println(" if(get" + capfield + "()!=null) {"); out.println(" locations=((Resolvable)(get" + capfield + "())).referenceValidate(locations,"); ! out.println(" prefix + \"" + fieldname + ".\",idlookup,namelookup,au); }"); } } } out.println(" return locations;"); out.println(" }"); |