Wiki source code of sPearCat-Ready Subclass Template
Last modified by David Avendasora on 2008/01/28 14:53
Show last authors
author | version | line-number | content |
---|---|---|---|
1 | {{code}} | ||
2 | |||
3 | // | ||
4 | // ${entity.classNameWithoutPackage}.java | ||
5 | // | ||
6 | // copyright ${copyrightYear} ${copyrightBy} | ||
7 | |||
8 | #if ($entity.packageName) | ||
9 | package $entity.packageName; | ||
10 | #end | ||
11 | |||
12 | import com.webobjects.eocontrol.EOEditingContext; | ||
13 | import com.webobjects.foundation.NSArray; | ||
14 | |||
15 | /** | ||
16 | * Java Class ${entity.classNameWithOptionalPackage}.java generated for entity ${entity.name} | ||
17 | * <p> | ||
18 | * copyright ${copyrightYear} ${copyrightBy} | ||
19 | * </p> | ||
20 | */ | ||
21 | public class ${entity.classNameWithoutPackage} extends ${entity.prefixClassNameWithOptionalPackage} { | ||
22 | // private static org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(${entity.classNameWithoutPackage}.class); | ||
23 | |||
24 | /** | ||
25 | * Sole constructor for entity ${entity.name} | ||
26 | */ | ||
27 | public ${entity.classNameWithoutPackage}() { | ||
28 | super(); | ||
29 | } | ||
30 | |||
31 | /** | ||
32 | * Returns a list of all objects of entity "${entity.name}" in the shared editing context. | ||
33 | * | ||
34 | * @return list of ${entity.name} | ||
35 | */ | ||
36 | @SuppressWarnings("unchecked") | ||
37 | public static NSArray<${entity.classNameWithoutPackage}> all${entity.classNameWithoutPackage}Objects() { | ||
38 | return (NSArray<${entity.classNameWithoutPackage}>)_all${entity.classNameWithoutPackage}Objects(); | ||
39 | } | ||
40 | |||
41 | /** | ||
42 | * Returns a list of all objects of entity "${entity.name}" by fetching with the "FetchAll" fetchSpecification | ||
43 | * | ||
44 | * @param context | ||
45 | * editing context to fetch in. | ||
46 | * @return list of ${entity.name} | ||
47 | */ | ||
48 | @SuppressWarnings("unchecked") | ||
49 | public static NSArray<${entity.classNameWithoutPackage}> all${entity.classNameWithoutPackage}Objects(EOEditingContext context) { | ||
50 | return (NSArray<${entity.classNameWithoutPackage}>)${entity.prefixClassNameWithOptionalPackage}.objectsForFetchAll(context); | ||
51 | } | ||
52 | |||
53 | /* | ||
54 | * (non-Javadoc) | ||
55 | * | ||
56 | * @see com.sPearWay.catalogAccess.NamedObject#awakeFromInsertion(com.webobjects.eocontrol.EOEditingContext) | ||
57 | */ | ||
58 | @Override | ||
59 | public void awakeFromInsertion(EOEditingContext anEditingContext) { | ||
60 | super.awakeFromInsertion(anEditingContext); | ||
61 | // Set default value for the object after its creation | ||
62 | } | ||
63 | |||
64 | /* | ||
65 | * (non-Javadoc) | ||
66 | * | ||
67 | * @see com.sPearWay.catalogAccess.NamedObject#awakeFromFetch(com.webobjects.eocontrol.EOEditingContext) | ||
68 | */ | ||
69 | @Override | ||
70 | public void awakeFromFetch(EOEditingContext anEditingContext) { | ||
71 | super.awakeFromFetch(anEditingContext); | ||
72 | // Set default value for the object after its fetch | ||
73 | } | ||
74 | |||
75 | } | ||
76 | |||
77 | {{/code}} |