<?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"  />
        <MULTIPLEREFERENCE  name="CultureCriteriaAnswers"       type="CultureCriteriaAnswer"    backreferenceName="JobApplication"  />
        <MULTIPLEREFERENCE  name="ProfileAssessmentAnswers"     type="Answer"                   backreferenceName="JobApplication"  />
        
        <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"/>

            <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">
            <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>