Changes for page EOF-Using EOF-EOGenerator
Last modified by Pascal Robert on 2012/01/21 22:03
From version 27.1
edited by Quinton Dolan
on 2007/07/09 06:52
on 2007/07/09 06:52
Change comment:
There is no comment for this version
To version 30.1
edited by Pascal Robert
on 2012/01/21 22:03
on 2012/01/21 22:03
Change comment:
There is no comment for this version
Summary
-
Page properties (3 modified, 0 added, 0 removed)
Details
- Page properties
-
- Title
-
... ... @@ -1,1 +1,1 @@ 1 - Programming__WebObjects-EOF-Using EOF-EOGenerator1 +EOF-Using EOF-EOGenerator - Author
-
... ... @@ -1,1 +1,1 @@ 1 -XWiki. qdolan1 +XWiki.probert - Content
-
... ... @@ -1,14 +1,22 @@ 1 -|=Contents 2 -| 1 +{{warning}} 2 +This is deprecated information! 3 +{{/warning}} 3 3 4 -{{toc style="disc" minLevel="2"}}{{/toc}} 5 +|= Contents 6 +| {{toc style="disc" minLevel="2"}}{{/toc}} 5 5 6 -== Overview 8 +== Overview == 7 7 8 -If you've ever used EOModeler's Java source code generator, you know how much of a pain it can be when you make changes to your model objects and have to merge changes in later. One solution for this is to use [[EOGenerator>>http://www.rubicode.com/Software/EOGenerator/]], an application developed by Rubicode Software, which uses the Generation Gap pattern to create your Java files from your EOModels. EOGenerator produces TWO java files for each Entity rather than one. Take the example of a Person entity. The first java file is //Person.java, which contains all of the autogenerated methods. The second java file is Person.java, and Person extends//Person. The second file is where you place all of your customizations. Any time your model changes, only your//Xxx.java files are updated, and your customizations are left untouched. Additionally, EOGenerator allows for the creation of extensive custom templates for your files, which provides the ability to place convenience methods in your//Xxx.java files.10 +If you've ever used EOModeler's Java source code generator, you know how much of a pain it can be when you make changes to your model objects and have to merge changes in later. One solution for this is to use [[EOGenerator>>http://www.rubicode.com/Software/EOGenerator/]], an application developed by Rubicode Software, which uses the Generation Gap pattern to create your Java files from your EOModels. EOGenerator produces TWO java files for each Entity rather than one. Take the example of a Person entity. The first java file is Person.java, which contains all of the autogenerated methods. The second java file is Person.java, and Person extends Person. The second file is where you place all of your customizations. Any time your model changes, only your Xxx.java files are updated, and your customizations are left untouched. Additionally, EOGenerator allows for the creation of extensive custom templates for your files, which provides the ability to place convenience methods in your Xxx.java files. 9 9 10 - == Advantages ==12 +{{warning}} 11 11 14 +EOGenerator doesn't work on Mac OS X 10.5. You have to use [JavaEOGenerator|http://developer.apple.com/samplecode/JavaEOGenerator/] or [Velocity EOGenerator|WOL:Velocity EOGenerator (Veogen)]. 15 + 16 +{{/warning}} 17 + 18 +== Advantages == 19 + 12 12 There are several advantages to using EOGenerator over EOModeler's default Java file generation and merging with FileMerge. 13 13 14 14 * EOGenerator uses the Generation Gap pattern, which provides a much cleaner separation of autogenerated vs customized code with no need to deal with merging at all. There are border cases with FileMerge that can cause you to deal with annoying conflicts. ... ... @@ -15,7 +15,7 @@ 15 15 * EOGenerator uses the MiscMerge language for its templates. This allows you to extend the core templates with extensive customizations (see the EOGenerator Mods section below), better supporting your own custom development process and workflow. 16 16 * As David LaBer put it, "all the cool kids use it - and we all know looking cool is the **most** important criteria". 17 17 18 -== How To Use It 26 +== How To Use It == 19 19 20 20 Kieran Kelleher has writtten an [[Introduction to EOGenerator>>http://homepage.mac.com/kelleherk/iblog/C1837526061/E1908382110/index.html]] on his blog. 21 21 ... ... @@ -26,34 +26,34 @@ 26 26 27 27 {{panel}} 28 28 29 -eogenerator -model /path/to/model/YourModel.eomodeld -destination /path/to/source/folder 30 - 37 +eogenerator \-model /path/to/model/YourModel.eomodeld \-destination /path/to/source/folder 38 +\-subclassDestination /path/to/source/folder \-templatedir /path/to/EOGenerator/templates \-java \-packagedirs 31 31 32 32 {{/panel}} 33 33 34 34 Voila. EOGenerator will spit out your Java files for you. Let's break down the commands you can pass in: 35 35 36 -* --define--EOGenericRecord <class>, allows you to specify the//Person class's superclass. For instance, if you use Project Wonder, you would specify--define--EOGenericRecord er.extensions.ERXGenericRecord//37 -* --destination <path>, the folder that//Person.java//--//style java files will be produced in (the non-editable files)//38 -* --java, produce java files--39 -* --javaTemplate <filename>, the name of the Java template to use inside of the template dir (//Person)//--40 -* --model <path>, Passes in the path of a .eomodeld you would like to generate Java files for. You can actually include multiple--model commands on the commandline41 -* --packagedirs, produce package directory for any package statements defined in your Java files (not necessary if you don't specify package names on your entities. By the way, you should specify packages on your entities :) )--42 -* --refmodel <path>, Passes in the path of an .eomodeld that is required for generating Java files, but that won't actually have Java files generated for it. For instance, you should--refmodel any prototypes, or any models in other frameworks that you depend on43 -* --subclassDestination <path>, the folder that Person.java--style java files will be produced in (the editable files)44 -* --subclassJavaTemplate <filename>, the name of the Java subclass template to use inside of the template dir (Person)--45 -* --templatedir <path>, the path to the folder that contains EOGenerator templates--46 -* --verbose, turn on verbose output--44 +* define-EOGenericRecord <class>, allows you to specify the Person class's superclass. For instance, if you use Project Wonder, you would specify define-EOGenericRecord er.extensions.ERXGenericRecord 45 +* destination <path>, the folder that Person.java-style java files will be produced in (the non-editable files) 46 +* java, produce java files 47 +* javaTemplate <filename>, the name of the Java template to use inside of the template dir (//Person)// 48 +* model <path>, Passes in the path of a .eomodeld you would like to generate Java files for. You can actually include multiple model commands on the commandline 49 +* packagedirs, produce package directory for any package statements defined in your Java files (not necessary if you don't specify package names on your entities. By the way, you should specify packages on your entities :-) ) 50 +* refmodel <path>, Passes in the path of an .eomodeld that is required for generating Java files, but that won't actually have Java files generated for it. For instance, you should refmodel any prototypes, or any models in other frameworks that you depend on 51 +* subclassDestination <path>, the folder that Person.java-style java files will be produced in (the editable files) 52 +* subclassJavaTemplate <filename>, the name of the Java subclass template to use inside of the template dir (Person) 53 +* templatedir <path>, the path to the folder that contains EOGenerator templates 54 +* verbose, turn on verbose output 47 47 48 -== Custom EOGenerator Mods 56 +== Custom EOGenerator Mods == 49 49 50 -=== Zak Burke 58 +=== Zak Burke === 51 51 52 52 Allow setting nulls on a to-one relationship (and turn it into a remove). Note, this is also included in Jonathan Rentzsch's templates. 53 53 54 54 {{code}} 55 55 56 - 64 +public void save<$ToOneRelationship.name.initialCapitalString$>(<$ToOneRelationship.destinationEntity.referenceJavaClassName$> value) 57 57 { 58 58 if (value == null) 59 59 { ... ... @@ -69,13 +69,13 @@ 69 69 70 70 {{/code}} 71 71 72 -=== Chuck Hill 80 +=== Chuck Hill === 73 73 74 74 Return the list of changes between the current EO and the last committed version of the EO: 75 75 76 76 {{code}} 77 77 78 - 86 +public NSDictionary changedProperties() { 79 79 NSDictionary commitedValues = editingContext().committedSnapshotForObject(this); 80 80 return changesFromSnapshot(commitedValues); 81 81 } ... ... @@ -82,13 +82,13 @@ 82 82 83 83 {{/code}} 84 84 85 -=== Jonathan Rentzsch 93 +=== Jonathan Rentzsch === 86 86 87 87 Jonathan Rentzsch has provided his base EOGenerator templates, which are a must-have: 88 88 89 -http: ~/~/rentzsch.com/share/eogenerator52templates.zip97 +[[http://rentzsch.com/share/eogenerator52templates.zip]] 90 90 91 -=== Markus Ruggiero 99 +=== Markus Ruggiero === 92 92 93 93 Constants for all attributes and relationships. This allows compile time error checking in situations like 94 94 addObjecttoBothSidesOfRelationshipWithKey(myObject, Person.TO//MANY//Children) ... ... @@ -95,7 +95,7 @@ 95 95 96 96 {{code}} 97 97 98 - 106 +<$foreach attribute classAttributes.@reversedArray do$> 99 99 public static final String ATTRIBUTE_<$attribute.name$> = "<$attribute.name$>";<$endforeach do$> 100 100 101 101 <$foreach ToOneRelationship classToOneRelationships.@reversedArray do$> ... ... @@ -110,15 +110,15 @@ 110 110 111 111 {{code}} 112 112 113 - 121 +<$if attribute.userInfo.usage h1. booleanFlag $> // boolean accessors 114 114 public void <$attribute.userInfo.setterName$>(boolean newBoolean) { 115 115 set<$attribute.name.initialCapitalString$>(newBoolean ? "true" : "false"); 116 116 } 117 - 125 + 118 118 public boolean <$attribute.userInfo.getterName$>() { 119 119 return "true".equals(<$attribute.name$>()) ? true : false; 120 120 } 121 - 129 + 122 122 // validation 123 123 public String validate<$attribute.name.initialCapitalString$>(String newValue) { 124 124 if ( newValue null ) { ... ... @@ -133,13 +133,13 @@ 133 133 134 134 {{/code}} 135 135 136 -=== Mike Schrag 144 +=== Mike Schrag === 137 137 138 138 Add a constant that represents the name of the entity so that you can refer to Person.ENTITY//NAME in fetches rather than the String (allows refactoring support in Eclipse)~:// 139 139 140 140 {{code}} 141 141 142 - 150 +public static final String ENTITY_NAME = "<$name$>"; 143 143 144 144 {{/code}} 145 145 ... ... @@ -147,27 +147,12 @@ 147 147 148 148 {{code}} 149 149 150 - public static <$classNameWithoutPackage$> create<$classNameWithoutPackage$>(EOEditingContext _editingContext< 151 - $foreach Attribute classAttributes.@sortedNameArray do$>< 152 - $if !Attribute.allowsNull$>, <$Attribute.javaValueClassName$> _<$Attribute.name$><$endif$>< 153 - $endforeach do$>< 154 - $foreach ToOneRelationship classToOneRelationships.@sortedNameArray do$>< 155 - $if ToOneRelationship.isMandatory$>, <$ToOneRelationship.destinationEntity.referenceJavaClassName$> _<$ToOneRelationship.name$><$endif$>< 156 - $endforeach do$>) { 157 - <$classNameWithoutPackage$> eoObject = (<$classNameWithoutPackage$>)EOUtilities.createAndInsertInstance(_editingContext, 158 - <$GEN_PREFIX$><$classNameWithoutPackage$>.ENTITY_NAME);< 159 - $foreach Attribute classAttributes.@sortedNameArray do$>< 160 - $if !Attribute.allowsNull$> 161 - eoObject.set<$Attribute.name.initialCapitalString$>(_<$Attribute.name$>);< 162 - $endif$>< 163 - $endforeach do$>< 164 - $foreach ToOneRelationship classToOneRelationships.@sortedNameArray do$>< 165 - $if ToOneRelationship.isMandatory$> 166 - eoObject.set<$ToOneRelationship.name.initialCapitalString$>Relationship(_<$ToOneRelationship.name$>);< 167 - $endif$>< 168 - $endforeach do$> 169 - return eoObject; 170 - } 158 +public static <$classNameWithoutPackage$> create<$classNameWithoutPackage$>(EOEditingContext _editingContext<$foreach Attribute classAttributes.@sortedNameArray do$><$if !Attribute.allowsNull$>, <$Attribute.javaValueClassName$> _<$Attribute.name$><$endif$><$endforeach do$><$foreach ToOneRelationship classToOneRelationships.@sortedNameArray do$><$if ToOneRelationship.isMandatory$>, <$ToOneRelationship.destinationEntity.referenceJavaClassName$> _<$ToOneRelationship.name$><$endif$><$endforeach do$>) { 159 + <$classNameWithoutPackage$> eoObject = (<$classNameWithoutPackage$>)EOUtilities.createAndInsertInstance(_editingContext, <$GEN_PREFIX$><$classNameWithoutPackage$>.ENTITY_NAME);<$foreach Attribute classAttributes.@sortedNameArray do$><$if !Attribute.allowsNull$> 160 + eoObject.set<$Attribute.name.initialCapitalString$>(_<$Attribute.name$>);<$endif$><$endforeach do$><$foreach ToOneRelationship classToOneRelationships.@sortedNameArray do$><$if ToOneRelationship.isMandatory$> 161 + eoObject.set<$ToOneRelationship.name.initialCapitalString$>Relationship(_<$ToOneRelationship.name$>);<$endif$><$endforeach do$> 162 + return eoObject; 163 +} 171 171 172 172 {{/code}} 173 173 ... ... @@ -175,49 +175,12 @@ 175 175 176 176 {{code}} 177 177 178 -public static <$classNameWithoutPackage$> create<$classNameWithoutPackage$>(EOEditingContext editingContext< 179 - $foreach Attribute classAttributes.@sortedNameArray do$>< 180 - $if !Attribute.allowsNull$>, <$Attribute.javaValueClassName$> <$Attribute.name$><$endif$>< 181 - $endforeach do$>< 182 - $foreach Attribute parentEntity.classAttributes.@sortedNameArray do$>< 183 - $if !Attribute.allowsNull$><$set RestrictingQualifierKey = false$>< 184 - $foreach QualifierKey restrictingQualifier.allQualifierKeys do$>< 185 - $if Attribute.name = QualifierKey$><$set RestrictingQualifierKey = true$><$endif$>< 186 - $endforeach do$><$if RestrictingQualifierKey = false$>, <$Attribute.javaValueClassName$> <$Attribute.name$><$endif$>< 187 - $endif$>< 188 - $endforeach do$>< 189 - $foreach ToOneRelationship classToOneRelationships.@sortedNameArray do$>< 190 - $if ToOneRelationship.isMandatory$>, <$ToOneRelationship.destinationEntity.referenceJavaClassName$> <$ToOneRelationship.name$><$endif$>< 191 - $endforeach do$>< 192 - $foreach ToOneRelationship parentEntity.classToOneRelationships.@sortedNameArray do$>< 193 - $if ToOneRelationship.isMandatory$>, <$ToOneRelationship.destinationEntity.referenceJavaClassName$> <$ToOneRelationship.name$><$endif$>< 194 - $endforeach do$>) { 195 - <$classNameWithoutPackage$> eoObject = (<$classNameWithoutPackage$>)EOUtilities.createAndInsertInstance(editingContext, <$GEN_PREFIX$><$classNameWithoutPackage$>.ENTITY_NAME);< 196 - $foreach Attribute classAttributes.@sortedNameArray do$>< 197 - $if !Attribute.allowsNull$> 198 - eoObject.set<$Attribute.name.initialCapitalString$>(<$Attribute.name$>);< 199 - $endif$>< 200 - $endforeach do$>< 201 - $foreach ToOneRelationship classToOneRelationships.@sortedNameArray do$>< 202 - $if ToOneRelationship.isMandatory$> 203 - eoObject.set<$ToOneRelationship.name.initialCapitalString$>Relationship(<$ToOneRelationship.name$>);< 204 - $endif$>< 205 - $endforeach do$>< 206 - $foreach Attribute parentEntity.classAttributes.@sortedNameArray do$>< 207 - $if !Attribute.allowsNull$><$set RestrictingQualifierKey = false$>< 208 - $foreach QualifierKey restrictingQualifier.allQualifierKeys do$>< 209 - $if Attribute.name = QualifierKey$><$set RestrictingQualifierKey = true$><$endif$>< 210 - $endforeach do$>< 211 - $if RestrictingQualifierKey = false$> 212 - eoObject.set<$Attribute.name.initialCapitalString$>(<$Attribute.name$>);< 213 - $endif$>< 214 - $endif$>< 215 - $endforeach do$>< 216 - $foreach ToOneRelationship parentEntity.classToOneRelationships.@sortedNameArray do$>< 217 - $if ToOneRelationship.isMandatory$> 218 - eoObject.set<$ToOneRelationship.name.initialCapitalString$>Relationship(<$ToOneRelationship.name$>);< 219 - $endif$>< 220 - $endforeach do$> 171 +public static <$classNameWithoutPackage$> create<$classNameWithoutPackage$>(EOEditingContext editingContext<$foreach Attribute classAttributes.@sortedNameArray do$><$if !Attribute.allowsNull$>, <$Attribute.javaValueClassName$> <$Attribute.name$><$endif$><$endforeach do$><$foreach Attribute parentEntity.classAttributes.@sortedNameArray do$><$if !Attribute.allowsNull$><$set RestrictingQualifierKey = false$><$foreach QualifierKey restrictingQualifier.allQualifierKeys do$><$if Attribute.name = QualifierKey$><$set RestrictingQualifierKey = true$><$endif$><$endforeach do$><$if RestrictingQualifierKey = false$>, <$Attribute.javaValueClassName$> <$Attribute.name$><$endif$><$endif$><$endforeach do$><$foreach ToOneRelationship classToOneRelationships.@sortedNameArray do$><$if ToOneRelationship.isMandatory$>, <$ToOneRelationship.destinationEntity.referenceJavaClassName$> <$ToOneRelationship.name$><$endif$><$endforeach do$><$foreach ToOneRelationship parentEntity.classToOneRelationships.@sortedNameArray do$><$if ToOneRelationship.isMandatory$>, <$ToOneRelationship.destinationEntity.referenceJavaClassName$> <$ToOneRelationship.name$><$endif$><$endforeach do$>) { 172 + <$classNameWithoutPackage$> eoObject = (<$classNameWithoutPackage$>)EOUtilities.createAndInsertInstance(editingContext, <$GEN_PREFIX$><$classNameWithoutPackage$>.ENTITY_NAME);<$foreach Attribute classAttributes.@sortedNameArray do$><$if !Attribute.allowsNull$> 173 + eoObject.set<$Attribute.name.initialCapitalString$>(<$Attribute.name$>);<$endif$><$endforeach do$><$foreach ToOneRelationship classToOneRelationships.@sortedNameArray do$><$if ToOneRelationship.isMandatory$> 174 + eoObject.set<$ToOneRelationship.name.initialCapitalString$>Relationship(<$ToOneRelationship.name$>);<$endif$><$endforeach do$><$foreach Attribute parentEntity.classAttributes.@sortedNameArray do$><$if !Attribute.allowsNull$><$set RestrictingQualifierKey = false$><$foreach QualifierKey restrictingQualifier.allQualifierKeys do$><$if Attribute.name = QualifierKey$><$set RestrictingQualifierKey = true$><$endif$><$endforeach do$><$if RestrictingQualifierKey = false$> 175 + eoObject.set<$Attribute.name.initialCapitalString$>(<$Attribute.name$>);<$endif$><$endif$><$endforeach do$><$foreach ToOneRelationship parentEntity.classToOneRelationships.@sortedNameArray do$><$if ToOneRelationship.isMandatory$> 176 + eoObject.set<$ToOneRelationship.name.initialCapitalString$>Relationship(<$ToOneRelationship.name$>);<$endif$><$endforeach do$> 221 221 return eoObject; 222 222 } 223 223 ... ... @@ -227,15 +227,23 @@ 227 227 228 228 {{code}} 229 229 230 - 186 +public static NSArray fetchAll<$classNameWithoutPackage$>s(EOEditingContext _editingContext) { 231 231 return <$GEN_PREFIX$><$classNameWithoutPackage$>.fetchAll<$classNameWithoutPackage$>s(_editingContext, null); 232 232 } 233 233 234 - public static NSArray fetchAll<$classNameWithoutPackage$>s(EOEditingContext _editingContext, NSArray _sortOrderings) { 190 +{{/code}} 191 + 192 +{{code}} 193 + 194 +public static NSArray fetchAll<$classNameWithoutPackage$>s(EOEditingContext _editingContext, NSArray _sortOrderings) { 235 235 return <$GEN_PREFIX$><$classNameWithoutPackage$>.fetch<$classNameWithoutPackage$>s(_editingContext, null, _sortOrderings); 236 236 } 237 237 238 - public static NSArray fetch<$classNameWithoutPackage$>s(EOEditingContext _editingContext, EOQualifier _qualifier, NSArray _sortOrderings) { 198 +{{/code}} 199 + 200 +{{code}} 201 + 202 +public static NSArray fetch<$classNameWithoutPackage$>s(EOEditingContext _editingContext, EOQualifier _qualifier, NSArray _sortOrderings) { 239 239 EOFetchSpecification fetchSpec = new EOFetchSpecification(<$GEN_PREFIX$><$classNameWithoutPackage$>.ENTITY_NAME, _qualifier, _sortOrderings); 240 240 fetchSpec.setIsDeep(true); 241 241 NSArray eoObjects = _editingContext.objectsWithFetchSpecification(fetchSpec); ... ... @@ -242,11 +242,19 @@ 242 242 return eoObjects; 243 243 } 244 244 245 - public static <$classNameWithoutPackage$> fetch<$classNameWithoutPackage$>(EOEditingContext _editingContext, String _keyName, Object _value) { 209 +{{/code}} 210 + 211 +{{code}} 212 + 213 +public static <$classNameWithoutPackage$> fetch<$classNameWithoutPackage$>(EOEditingContext _editingContext, String _keyName, Object _value) { 246 246 return <$GEN_PREFIX$><$classNameWithoutPackage$>.fetch<$classNameWithoutPackage$>(_editingContext, new EOKeyValueQualifier(_keyName, EOQualifier.QualifierOperatorEqual, _value)); 247 247 } 248 248 249 - public static <$classNameWithoutPackage$> fetch<$classNameWithoutPackage$>(EOEditingContext _editingContext, EOQualifier _qualifier) { 217 +{{/code}} 218 + 219 +{{code}} 220 + 221 +public static <$classNameWithoutPackage$> fetch<$classNameWithoutPackage$>(EOEditingContext _editingContext, EOQualifier _qualifier) { 250 250 NSArray eoObjects = <$GEN_PREFIX$><$classNameWithoutPackage$>.fetch<$classNameWithoutPackage$>s(_editingContext, _qualifier, null); 251 251 <$classNameWithoutPackage$> eoObject; 252 252 int count = eoObjects.count(); ... ... @@ -261,14 +261,22 @@ 261 261 } 262 262 return eoObject; 263 263 } 264 - 265 - public static <$classNameWithoutPackage$> fetchRequired<$classNameWithoutPackage$>(EOEditingContext _editingContext, String _keyName, Object _value) { 236 + 237 +{{/code}} 238 + 239 +{{code}} 240 + 241 +public static <$classNameWithoutPackage$> fetchRequired<$classNameWithoutPackage$>(EOEditingContext _editingContext, String _keyName, Object _value) { 266 266 return <$GEN_PREFIX$><$classNameWithoutPackage$>.fetchRequired<$classNameWithoutPackage$>(_editingContext, new EOKeyValueQualifier(_keyName, EOQualifier.QualifierOperatorEqual, _value)); 267 267 } 268 268 269 - public static <$classNameWithoutPackage$> fetchRequired<$classNameWithoutPackage$>(EOEditingContext _editingContext, EOQualifier _qualifier) { 245 +{{/code}} 246 + 247 +{{code}} 248 + 249 +public static <$classNameWithoutPackage$> fetchRequired<$classNameWithoutPackage$>(EOEditingContext _editingContext, EOQualifier _qualifier) { 270 270 <$classNameWithoutPackage$> eoObject = <$GEN_PREFIX$><$classNameWithoutPackage$>.fetch<$classNameWithoutPackage$>(_editingContext, _qualifier); 271 - if (eoObject h1.null) {251 + if (eoObject == null) { 272 272 throw new NoSuchElementException("There was no <$classNameWithoutPackage$> that matched the qualifier '" + _qualifier + "'."); 273 273 } 274 274 return eoObject; ... ... @@ -280,12 +280,16 @@ 280 280 281 281 {{code}} 282 282 283 - 263 +public <$classNameWithoutPackage$> localInstanceOf<$classNameWithoutPackage$>(EOEditingContext _editingContext) { 284 284 return (<$classNameWithoutPackage$>)EOUtilities.localInstanceOfObject(_editingContext, this); 285 285 } 286 286 287 - public static <$classNameWithoutPackage$> localInstanceOf<$classNameWithoutPackage$>(EOEditingContext _editingContext, <$classNameWithoutPackage$> _eo) { 288 - return (_eo null) ? null : (<$classNameWithoutPackage$>)EOUtilities.localInstanceOfObject(_editingContext, _eo); 267 +{{/code}} 268 + 269 +{{code}} 270 + 271 +public static <$classNameWithoutPackage$> localInstanceOf<$classNameWithoutPackage$>(EOEditingContext _editingContext, <$classNameWithoutPackage$> _eo) { 272 + return (_eo == null) ? null : (<$classNameWithoutPackage$>)EOUtilities.localInstanceOfObject(_editingContext, _eo); 289 289 } 290 290 291 291 {{/code}} ... ... @@ -294,7 +294,7 @@ 294 294 295 295 {{code}} 296 296 297 - 281 +<$if !ToManyRelationship.inverseRelationship$> 298 298 public NSArray <$ToManyRelationship.name$>(EOQualifier qualifier) { 299 299 return <$ToManyRelationship.name$>(qualifier, null); 300 300 } ... ... @@ -303,12 +303,12 @@ 303 303 public NSArray <$ToManyRelationship.name$>(EOQualifier qualifier) { 304 304 return <$ToManyRelationship.name$>(qualifier, null, false); 305 305 } 306 - 307 - public NSArray <$ToManyRelationship.name$>(EOQualifier qualifier, boolean fetch) { 290 + 291 + public NSArray <$ToManyRelationship.name$>(EOQualifier qualifier, boolean fetch) { 308 308 return <$ToManyRelationship.name$>(qualifier, null, fetch); 309 309 } 310 310 <$endif$> 311 - 295 + 312 312 public NSArray <$ToManyRelationship.name$>(EOQualifier qualifier, NSArray sortOrderings<$if ToManyRelationship.inverseRelationship$>, boolean fetch<$endif$>) { 313 313 NSArray results; 314 314 <$if ToManyRelationship.inverseRelationship$> ... ... @@ -344,25 +344,25 @@ 344 344 345 345 {{/code}} 346 346 347 -=== John Huss 331 +=== John Huss === 348 348 349 -I wanted to share a wonderful bit of knowledge I learned today. If you're using Java 1.5 you can add @SuppressWarnings("all") to the template for your //EO base classes and eliminate annoying compiler messages (usually uneeded import statements).//333 +I wanted to share a wonderful bit of knowledge I learned today. If you're using Java 1.5 you can add @SuppressWarnings("all") to the template for your EO base classes and eliminate annoying compiler messages (usually uneeded import statements). 350 350 351 351 {{code}} 352 352 353 - 337 +@SuppressWarnings("all") 354 354 public class _Invoice extends ERXGenericRecord { 355 355 } 356 356 357 357 {{/code}} 358 358 359 -=== Guido Neitzer 343 +=== Guido Neitzer === 360 360 361 361 Create awakeFromInsertion() and awakeFromFetch() in your EOGenerator template as a method stub that only calls super() and has a comment for "initialize your object here ...". You only have to put in the code at that place and can't possibly forget to call super(). Here is an example: 362 362 363 363 {{code}} 364 364 365 -/** 349 +/** 366 366 * Initialization of the instance while inserting it into an editing context 367 367 */ 368 368 public void awakeFromInsertion (EOEditingContext editingContext) { ... ... @@ -373,5 +373,3 @@ 373 373 {{/code}} 374 374 375 375 This is from my JavaSubclassSourceTemplate.eotemplate 376 - 377 -Category:WebObjects