<?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="Message"   package="performa.orm">
        <IMPORT value="performa.orm.types.*"/>
        <IMPORT value="oneit.security.*"/>
                
        <MULTIPLEREFERENCE  name="Attachments"       type="ChatAttachment"        backreferenceName="Message" />
        
        <TABLE  name="tl_message"    tablePrefix="object"    polymorphic="FALSE">
            
            <ATTRIB name="SentVia"              type="SentVia"          dbcol="sent_via"            attribHelper="EnumeratedAttributeHelper"    defaultValue="SentVia.ON_APP"  mandatory="false"/>
            <ATTRIB name="MessageContent"       type="String"           dbcol="message_content"     mandatory="false"/>
            <ATTRIB name="IsRead"               type="Boolean"          dbcol="is_read"             mandatory="false"/>
            
            <SINGLEREFERENCE    name="SentBy"               type="SecUser"              dbcol="sent_by"  />
            <SINGLEREFERENCE    name="WorkFlowMessage"      type="WorkFlowMessage"      dbcol="work_flow_message"  />
            <SINGLEREFERENCE    name="JobApplication"       type="JobApplication"       dbcol="job_application_id"          backreferenceName="Messages"    mandatory="true"/>

        </TABLE>
        
        <SEARCH type="All"  paramFilter="tl_message.object_id is not null"   orderBy="tl_message.object_id"   />
            
    </BUSINESSCLASS>
    
</ROOT>