<?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="JobApplication"   package="performa.orm">
        <IMPORT value="performa.orm.types.*"/>
                
        <MULTIPLEREFERENCE  name="AssessmentCriteriaAnswers"    type="AssessmentCriteriaAnswer" backreferenceName="JobApplication"  />
        
        <TRANSIENT  name="AppProcessOption" type="AppProcessOption" attribHelper="EnumeratedAttributeHelper"/>
        <TRANSIENT  name="OverallRank"      type="Integer"  />
        <TRANSIENT  name="RoleFit"          type="Map"      attribHelper="BLOBAttributeHelper"  attribHelperInstance="BLOBAttributeHelper.INSTANCE"/>
        <TRANSIENT  name="RequirementFit"   type="Map"      attribHelper="BLOBAttributeHelper"  attribHelperInstance="BLOBAttributeHelper.INSTANCE"/>
        <TRANSIENT  name="CultureFit"       type="Map"      attribHelper="BLOBAttributeHelper"  attribHelperInstance="BLOBAttributeHelper.INSTANCE"/>

        <TABLE  name="tl_job_application"   tablePrefix="object"    polymorphic="FALSE">
            
            <ATTRIB name="CV"                   type="BinaryContent"        dbcol="cv"                  binaryHandler="loggedin"    attribHelper="BLOBAttributeHelper"  attribHelperInstance="BLOBAttributeHelper.INSTANCE" mandatory="false"/>
            <ATTRIB name="ApplicationStatus"    type="ApplicationStatus"    dbcol="application_status"  attribHelper="EnumeratedAttributeHelper"    defaultValue="ApplicationStatus.DRAFT"  mandatory="true"/>
            <ATTRIB name="SubmittedDate"        type="Date"                 dbcol="submitted_date"/>
             
            <SINGLEREFERENCE    name="Candidate"    type="Candidate"    dbcol="candidate_id"    backreferenceName="JobApplications" mandatory="true"/>
            <SINGLEREFERENCE    name="Job"          type="Job"          dbcol="job_id"          backreferenceName="JobApplications" mandatory="true"/>

        </TABLE>
        
        <SEARCH type="All"  paramFilter="tl_job_application.object_id is not null"  orderBy="tl_job_application.object_id"   />
        
        <SEARCH type="CandidateJob" paramFilter="tl_job_application.object_id is not null"  singleton="TRUE"    checkTXObjects="TRUE">
            <PARAM name="Candidate" type="Candidate"    transform="Candidate.getObjectID()" paramFilter="candidate_id = ${Candidate} " />
            <PARAM name="Job"       type="Job"          transform="Job.getObjectID()"       paramFilter="job_id = ${Job}" />
        </SEARCH>
            
    </BUSINESSCLASS>
    
</ROOT>