<?xml version="1.0" encoding="UTF-8"?>

<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.oneit.com.au/schemas/5.2/BusinessObject.xsd'>

    <BUSINESSCLASS  name="Job"  package="performa.orm">
        <IMPORT value="performa.orm.types.*"/>    
        <IMPORT value="oneit.security.*"/>
        <IMPORT value="oneit.business.shopping.orm.*"/>

        <MULTIPLEREFERENCE  name="JobApplications"      type="JobApplication"       backreferenceName="Job" />
        <MULTIPLEREFERENCE  name="AssessmentCriterias"  type="AssessmentCriteria"   backreferenceName="Job" />
        <MULTIPLEREFERENCE  name="CultureCriterias"     type="CultureCriteria"      backreferenceName="Job" />
        
        <TRANSIENT  name="Email"                    type="String"           validators="Email"  />
        <TRANSIENT  name="Password"                 type="String"/>
        <TRANSIENT  name="ConfirmPassword"          type="String"/>
        <TRANSIENT  name="CompletedDetails"         type="Boolean"          defaultValue="Boolean.FALSE"/>
        <TRANSIENT  name="CompletedRequirements"    type="Boolean"          defaultValue="Boolean.FALSE"/>
        <TRANSIENT  name="CompletedCulture"         type="Boolean"          defaultValue="Boolean.FALSE"/>
        <TRANSIENT  name="CompletedAssessmentType"  type="Boolean"          defaultValue="Boolean.FALSE"/>
        <TRANSIENT  name="SaveAssessmentTemplate"   type="Boolean"          defaultValue="Boolean.FALSE"/>
        <TRANSIENT  name="SaveCultureTemplate"      type="Boolean"          defaultValue="Boolean.FALSE"/>
        <TRANSIENT  name="AssessmentTemplateName"   type="String"/>
        <TRANSIENT  name="CultureTemplateName"      type="String"/>
        <TRANSIENT  name="AppProcessOption"         type="AppProcessOption" attribHelper="EnumeratedAttributeHelper"/>
        <TRANSIENT  name="RankingCompleted"         type="Boolean"  />

        <TRANSIENTSINGLE name="AssessmentTemplate"  type="AssessmentCriteriaTemplate" />
        <TRANSIENTSINGLE name="CultureTemplate"     type="CultureCriteriaTemplate" />
        <TRANSIENTSINGLE name="JobTemplate"         type="Job" />
        
        <TABLE  name="tl_job"   tablePrefix="object"    polymorphic="FALSE">
            
            <ATTRIB name="JobTitle"                     type="String"           dbcol="job_title"       length="500"    mandatory="true"/>
            <ATTRIB name="JobDescription"               type="String"           dbcol="job_description" mandatory="true"/>
            <ATTRIB name="JobStatus"                    type="JobStatus"        dbcol="job_status"      attribHelper="EnumeratedAttributeHelper"    mandatory="true"/>
            <ATTRIB name="OpenDate"                     type="Date"             dbcol="open_date"/>
            <ATTRIB name="ApplyBy"                      type="Date"             dbcol="apply_by"/>
            <ATTRIB name="IncludeAssessmentCriteria"    type="Boolean"          dbcol="include_assessment_criteria" mandatory="true"    defaultValue="Boolean.TRUE"/>
            <ATTRIB name="AssessmentType"               type="AssessmentType"   dbcol="assessment_type" attribHelper="EnumeratedAttributeHelper"    mandatory="true"    defaultValue="AssessmentType.COMPREHENSIVE"/>
            <ATTRIB name="RandomKey"                    type="String"           dbcol="random_key"      length="10"/>
            <ATTRIB name="JobType"                      type="JobType"          dbcol="job_type"        attribHelper="EnumeratedAttributeHelper"    mandatory="true"    defaultValue="JobType.FULL_TIME"/>
            <ATTRIB name="ReferenceNumber"              type="String"           dbcol="ref_number"      length="100"/>
            <ATTRIB name="LastStatusChangeDate"         type="Date"             dbcol="last_status_change_date"/>
            <ATTRIB name="Remote"                       type="Boolean"          dbcol="remote"          defaultValue="Boolean.FALSE"/>
            <ATTRIB name="City"                         type="String"           dbcol="city"            length="100"/>
            <ATTRIB name="State"                        type="State"            dbcol="state"           defaultValue="State.WA"     attribHelper="EnumeratedAttributeHelper"/>
            <ATTRIB name="Country"                      type="Countries"        dbcol="country"         defaultValue="Countries.AU" attribHelper="EnumeratedAttributeHelper"/>

            <SINGLEREFERENCE    name="Level"        type="Level"        dbcol="level_id"    mandatory="true"/>
            <SINGLEREFERENCE    name="Client"       type="Client"       dbcol="client_id"   backreferenceName="Jobs"/>
            <SINGLEREFERENCE    name="CompanyUser"  type="CompanyUser"  dbcol="company_user_id" />
            
        </TABLE>
        
        <SEARCH type="All"  paramFilter="tl_job.object_id is not null"   orderBy="tl_job.object_id"   />
        
        <SEARCH type="JobKey" paramFilter="tl_job.object_id is not null"   singleton="TRUE">
            <PARAM name="ID"    type="Long"     paramFilter="object_id = ${ID} " />
            <PARAM name="Key"   type="String"   paramFilter="random_key = ${Key}" />
        </SEARCH>
            
    </BUSINESSCLASS>
    
</ROOT>