<?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.*"/>
                
        <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="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"/>
        
        <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"    defaultValue="JobStatus.DRAFT"/>
            <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"/>

            <SINGLEREFERENCE    name="Level"    type="Level"    dbcol="level_id"    mandatory="true"/>
            <SINGLEREFERENCE    name="SecUser"  type="SecUser"  dbcol="secuser_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>