Created
August 13, 2010 15:59
-
-
Save ejhayes/523112 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* @persistent | |
*/ | |
component schema="SPECUSE" table="A_APPLICATIONS" | |
{ | |
property name="Id" fieldtype="id" generator="sequence" ormtype="int" params="{sequence='A_SEQ'}"; | |
property name="SpecialUseNumber" column="SPECUSE_NO" ormtype="int"; | |
property name="RegistrationType" fkcolumn="SPECUSE_IND" cfc="RegistrationTypes" fieldtype="one-to-one"; | |
property name="Status" fkcolumn="S_CODE" cfc="Statuses" fieldtype="one-to-one"; | |
property name="Issued" column="ISSUE_DATE" ormtype="date"; | |
property name="Expired" column="EXPIRE_DATE" ormtype="date"; | |
property name="InternalComments" column="COMMENTS_INTERNAL"; | |
property name="PublicComments" column="COMMENTS_PUBLIC"; | |
// Application Revisions | |
property name="Revisions" fkcolumn="A_ID" cfc="Revisions" type="array" fieldtype="one-to-many" orderby="CREATED_DATE asc"; | |
// Auditing fields | |
property name="CreatedBy" column="CREATED_USER"; | |
property name="Created" column="CREATED_DATE"; | |
property name="UpdatedBy" column="UPDATED_USER"; | |
property name="Updated" column="UPDATED_DATE" fieldtype="timestamp"; | |
// get the official name of the record | |
function getOfficialName(){ | |
if( this.getSpecialUseNumber() == "" ) return "UNKNOWN"; | |
else return "CA-" & this.getSpecialUseNumber(); | |
} | |
// get the unique products associated with a record | |
function getUniqueProducts(){ | |
// the map technique returns a java.util.HashMap object | |
return ormExecuteQuery("select distinct new map(Product.Code as Code, Product.Description as Description) from Revisions where Application.Id = ?", [this.getId()]); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment