<?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="AssessmentCriteriaAnswer"   package="performa.orm">
        <IMPORT value="performa.orm.types.*"/>    

        <TABLE  name="tl_assessment_criteria_answer"    tablePrefix="object"    polymorphic="FALSE">
            
            <ATTRIB name="Answer"       type="Boolean"      dbcol="answer"  mandatory="true"/>
            <ATTRIB name="Notes"        type="String"       dbcol="notes"/>

            <SINGLEREFERENCE    name="AssessmentCriteria"   type="AssessmentCriteria"   dbcol="assessment_criteria_id"  mandatory="true"    backreferenceName="Answers"/>
            <SINGLEREFERENCE    name="JobApplication"       type="JobApplication"       dbcol="job_application_id"      mandatory="true"    backreferenceName="AssessmentCriteriaAnswers"/>

        </TABLE>
        
        <SEARCH type="All"  paramFilter="tl_assessment_criteria_answer.object_id is not null"  orderBy="tl_assessment_criteria_answer.object_id"   />
        
        <SEARCH type="CriteriaType"     paramFilter="tl_assessment_criteria_answer.object_id is not null"   orderBy="tl_assessment_criteria_answer.object_id"   
                checkTXObjects="TRUE"   allowByFilter="TRUE">
            <TABLE  name="tl_assessment_criteria"   join="tl_assessment_criteria.object_id = tl_assessment_criteria_answer.assessment_criteria_id"/>
            
            <PARAM  name="CriteriaType" type="CriteriaType" paramFilter="tl_assessment_criteria.assessment_type = ${CriteriaType}" />
        </SEARCH>
        
        <SEARCH type="CriteriaApplication"  paramFilter="tl_assessment_criteria_answer.object_id is not null"   singleton="TRUE">
            <PARAM name="AssessmentCriteria"    type="AssessmentCriteria"   transform="AssessmentCriteria.getObjectID ()"   paramFilter="tl_assessment_criteria_answer.assessment_criteria_id = ${AssessmentCriteria}"/>
            <PARAM name="JobApplication"        type="JobApplication"       transform="JobApplication.getObjectID ()"       paramFilter="tl_assessment_criteria_answer.job_application_id = ${JobApplication}"/>
        </SEARCH>
        
    </BUSINESSCLASS>
    
</ROOT>