package <#get var:value="packageName" />; <#if var:condition="usesDates">import java.util.Date; <#if var:condition="hasFetchSpecs">import java.util.List; import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.opengroupware.jope.eoaccess.EOActiveRecord; import org.opengroupware.jope.eoaccess.EODatabase; import org.opengroupware.jope.eoaccess.EOEntity; <#if var:condition="hasFetchSpecs">import org.opengroupware.jope.eocontrol.EOFetchSpecification; /** Automatically generated by EOGenerator -- DO NOT EDIT! * * Put all your custom logic into <#get var:value="className" /> and subclass * it from this template class. */ public class <#get var:value="templateClassName" /> extends EOActiveRecord { public static Log log = LogFactory.getLog("<#get var:value="className" />"); <#for var:item="attribute" var:list="attributes"> protected <#get var:value="attributeJavaType" /> <#get var:value="attributeJavaName" />; public <#get var:value="templateClassName" />(EODatabase _database, String _name) { super(_database, _name); } public <#get var:value="templateClassName" />(EODatabase _database, EOEntity _entity) { super(_database, _entity); } public <#get var:value="templateClassName" />(EOEntity _entity) { super(_entity); } public <#get var:value="templateClassName" />(EODatabase _database) { super(_database); } public <#get var:value="templateClassName" />() { } <#if var:condition="hasAttributes"> /* Accessors */ <#for var:item="attribute" var:list="attributes"><#if var:condition="hasAttributeComments"> /**<#for var:item="comment" var:list="attributeComments"> * <#get var:value="comment" /> */ public void set<#get var:value="attributeJavaCapsedName" />(<#get var:value="attributeJavaType" /> _<#get var:value="attributeJavaName" />) { this.<#get var:value="attributeJavaName" /> = _<#get var:value="attributeJavaName" />; } public <#get var:value="attributeJavaType" /> <#get var:value="attributeJavaName" />() { return this.<#get var:value="attributeJavaName" />; } <#if var:condition="hasRelationships"> /* Relationships */ <#for var:item="relationship" var:list="relationships"> <#if var:condition="relationship.isToMany"> // TBD: to-many <#get var:value="relationship.name" /> <#if var:condition="relationship.isToMany" negate="YES"> <#if var:condition="hasFetchSpecs"> /* Fetchspecs */ <#for var:item="fetchSpecName" var:list="fetchSpecNames"> @SuppressWarnings("unchecked") public static <#get var:value="fetchResultJavaType" escapeHTML="NO" /> <#get var:value="fetchSpecName" />(EODatabase _db<#for var:item="bindingKey" var:list="fetchSpec.qualifier.bindingKeys">, Object _<#get var:value="bindingKey" />) { EOEntity e = _db.model().entityNamed("<#get var:value="className" />"); EOFetchSpecification fs = e.fetchSpecificationNamed("<#get var:value="fetchSpecName" />");<#if var:condition="fetchSpec.qualifier.bindingKeys"> fs = fs.fetchSpecificationWithQualifierBindings(<#for var:item="bindingKey" var:list="fetchSpec.qualifier.bindingKeys" separator=", ">"<#get var:value="bindingKey" />", _<#get var:value="bindingKey" />); List result = _db.objectsWithFetchSpecification(fs);<#if var:condition="isFetchResultJavaTypeGeneric"> return result;<#if var:condition="isFetchResultJavaTypeGeneric" negate="YES"> if (org.opengroupware.jope.foundation.UObject.isEmpty(result)) return null; <#if var:condition="canOptimizeRawFetchResult">return org.opengroupware.jope.foundation.UList.valuesForKey(result, "<#get var:value="rawFetchResultSingleAttributeKey" />");<#if var:condition="canOptimizeRawFetchResult" negate="YES">return (<#get var:value="fetchResultJavaType" escapeHTML="NO" />)org.opengroupware.jope.foundation.UObject.extractValue(result); } }