<?xml version="1.0" encoding="UTF-8" ?>
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd"
	version="1.0">
	<description>DMP</description>

	<!--
		DMP related data objects
	-->
	<entity class="gov.va.med.ccht.model.dmp.DMP" access="FIELD"
		name="DMP">
		<table schema="dmp" name="DMP" />
		<named-query name="findAllDmps">
			<query>
	    		<![CDATA[
	    			select l from gov.va.med.ccht.model.dmp.DMP l order by l.name
	    		]]>
	    	</query>
		</named-query>
		<attribute-override name="id">
			<column name="DMP_ID" />
		</attribute-override>
		<attributes>
			<basic name="name" >
				<column name="name" />
			</basic>
			<basic name="description">
				<column name="description" />
			</basic>
			<basic name="objective">
				<column name="objective" />
			</basic>
			<basic name="dateCreated">
				<column name="date_created" />
			</basic>
			<basic name="tag">
				<column name="dmp_tag" />
			</basic>
			<basic name="dmpVersion">
				<column name="dmp_version" />
			</basic>				
			<many-to-one name="dmpStatusType"
				target-entity="gov.va.med.ccht.model.dmp.DMPStatusType">
				<join-column name="STATUS_TYPE_ID" />
			</many-to-one>
			<one-to-many name="assignees" target-entity="gov.va.med.ccht.model.dmp.DMPToolUser"
				mapped-by="dmp" fetch="EAGER">
			</one-to-many>
			<one-to-many name="questions" target-entity="gov.va.med.ccht.model.dmp.DMPQuestion"
				mapped-by="dmp" fetch="EAGER">
				<order-by>contentOrder</order-by>
			</one-to-many>
			<transient name="createdByName"/>	
			<transient name="modifiedByName"/>
			<transient name="reviewers"/>
		</attributes>
	</entity>
	<entity class="gov.va.med.ccht.model.dmp.DMPToolUser" access="FIELD"
		name="DMPToolUser">
		<table schema="dmp" name="DMP_TOOL_USER" />
		<attribute-override name="id">
			<column name="DMP_TOOL_USER_ID" />
		</attribute-override>
		<attributes>
			<basic name="assigned">
				<column name="assigned_ind" />
			</basic>
			<basic name="reviewer">
				<column name="reviewer_ind" />
			</basic>
			<many-to-one name="dmp" target-entity="gov.va.med.ccht.model.dmp.DMP">
				<join-column name="DMP_ID" />
			</many-to-one>
			<many-to-one name="appUser" target-entity="gov.va.med.ccht.model.User">
				<join-column name="APP_USER_ID" />
			</many-to-one>
		</attributes>
	</entity>
	<entity class="gov.va.med.ccht.model.dmp.DMPQuestion" access="FIELD"
		name="DMPQuestion">
		<table schema="dmp" name="DMP_CONTENT" />
		<attribute-override name="id">
			<column name="DMP_CONTENT_ID" />
		</attribute-override>
		<attributes>
			<basic name="locked">
				<column name="lock_dmp_content" />
			</basic>
			<basic name="questionContent">
				<column name="content" />
			</basic>
			<basic name="frequency">
				<column name="frequency" />
			</basic>
			<basic name="contentOrder">
				<column name="content_order" />
			</basic><!--
			<basic name="additionalInstructions">
				<column name="additional_instruction" />
			</basic>
			-->
			<many-to-one name="dmpContentType"
				target-entity="gov.va.med.ccht.model.dmp.DMPContentType">
				<join-column name="CONTENT_TYPE_ID" />
			</many-to-one>
			<many-to-one name="dmpResponseType"
				target-entity="gov.va.med.ccht.model.dmp.DMPResponseType">
				<join-column name="RSPNSE_TYPE_ID" />
			</many-to-one>
			<many-to-one name="dmp" target-entity="gov.va.med.ccht.model.dmp.DMP">
				<join-column name="DMP_ID" />
			</many-to-one>
			<one-to-many name="responses" target-entity="gov.va.med.ccht.model.dmp.DMPResponse"
				mapped-by="question" fetch="EAGER">
				<order-by>id</order-by>
				<cascade>
					<cascade-all />
				</cascade>				
			</one-to-many>
			<one-to-many name="reviewComments" target-entity="gov.va.med.ccht.model.dmp.DMPReview"
				mapped-by="dmpContentId" fetch="EAGER">
				<order-by>id</order-by>
				<cascade>
					<cascade-all />
				</cascade>				
			</one-to-many>	
		</attributes>
	</entity>
	<entity class="gov.va.med.ccht.model.dmp.DMPResponse" access="FIELD"
		name="DMPResponse">
		<table schema="dmp" name="DMP_RESPONSE" />
		<attribute-override name="id">
			<column name="DMP_RSPNSE_ID" />
		</attribute-override>
		<attributes>
			<basic name="alertLevel">
				<column name="alert_level_id" />
			</basic>
			<basic name="responseContent">
				<column name="response_content" />
			</basic>
			<basic name="branchId">
				<column name="nxt_question_id" />
			</basic>
			<basic name="eduContent">
				<column name="edu_content" />
			</basic>
			<basic name="vendorInstrContent">
				<column name="vndr_i_content" />
			</basic>
			<many-to-one name="question" target-entity="gov.va.med.ccht.model.dmp.DMPQuestion">
				<join-column name="DMP_CONTENT_ID" />
			</many-to-one>
		</attributes>
	</entity>
 <entity class="gov.va.med.ccht.model.dmp.FindDMPAttributes" access="FIELD" name="FindDMPAttributes">
  <table schema="dmp" name="DMP" /> 
 <attribute-override name="id">
  <column name="DMP_ID" /> 
  </attribute-override>
 <attributes>
 <basic name="name">
  <column name="name" /> 
  </basic>
 <basic name="description">
  <column name="description" /> 
  </basic>
 <basic name="objective">
  <column name="objective" /> 
  </basic>
 <basic name="tag">
  <column name="dmp_tag" /> 
  </basic>
  <basic name="dmpVersion">
  <column name="dmp_version" /> 
  </basic>
 <basic name="facilitator">
  <column name="facilitator" /> 
  </basic>
  </attributes>
  </entity>

	<entity class="gov.va.med.ccht.model.dmp.FindDMPContent" access="FIELD"
		name="FindDMPContent">
		
		<table schema="dmp" name="DMP_CONTENT" />
					
		<attribute-override name="id">
			<column name="DMP_CONTENT_ID" />
		</attribute-override>
		<attributes>
			<basic name="content" >
				<column name="content" />
			</basic>
			<basic name="locked">
				<column name="lock_dmp_content" />
			</basic>
			<many-to-one name="findDMPAttributes" target-entity="gov.va.med.ccht.model.dmp.FindDMPAttributes">
				<join-column name="DMP_ID" />
			</many-to-one>
		</attributes>
	</entity>
	<entity class="gov.va.med.ccht.model.dmp.FindDMPResponseContent" access="FIELD"
		name="FindDMPResponseContent">
		
		<table schema="dmp" name="DMP_RESPONSE" />
					
		<attribute-override name="id">
			<column name="DMP_RSPNSE_ID" />
		</attribute-override>
		<attributes>
			<basic name="responseContent" >
				<column name="response_content" />
			</basic>
			<basic name="eduContent" >
				<column name="edu_content" />
			</basic>
			<basic name="vendorInstContent" >
				<column name="vndr_i_content" />
			</basic>
			<many-to-one name="findDMPContent" target-entity="gov.va.med.ccht.model.dmp.FindDMPContent">
				<join-column name="DMP_CONTENT_ID" />
			</many-to-one>
		</attributes>
	</entity>
	<entity class="gov.va.med.ccht.model.dmp.DMPStandLibEntry" access="FIELD"
		name="DMPStandardLibEntry">
		
		<table schema="dmp" name="DMP_SL_CONTENT" />
					
		<attribute-override name="id">
			<column name="DMP_SL_CONTENT_ID" />
		</attribute-override>
		<attributes>
			<basic name="slContent" >
				<column name="sl_content" />
			</basic>
			<basic name="clinicalEvidenceVA" >
				<column name="va_dod_cg_ind" />
			</basic>
			<basic name="clinicalEvidenceOther" >
				<column name="other_resource_ind" />
			</basic>
			<basic name="clinicalEvidenceAhrq" >
				<column name="ahrq_ind" />
			</basic>
			<basic name="ceOtherText" >
				<column name="other_resource_description" />
			</basic>
			<basic name="rsnModComment" >
				<column name="RSN_SL_MODIFIED_COMMENT" />
			</basic>
			<many-to-one name="slCategoryType"
				target-entity="gov.va.med.ccht.model.dmp.DMPStandLibCatType">
				<join-column name="SL_CONTENT_CATEGORY_TYPE_ID" />
			</many-to-one>
			<many-to-one name="slContentType"
				target-entity="gov.va.med.ccht.model.dmp.DMPStandLibContentType">
				<join-column name="SL_CONTENT_TYPE_ID" />
			</many-to-one>
			<many-to-one name="clinicalGuidanceType"
				target-entity="gov.va.med.ccht.model.dmp.DMPStandLibClinicalGuidanceType">
				<join-column name="CPG_TYPE_ID" />
			</many-to-one>
			<many-to-one name="reasonModType"
				target-entity="gov.va.med.ccht.model.dmp.DMPStandLibRsnModType">
				<join-column name="RSN_SL_MODIFIED_ID" />
			</many-to-one>
		</attributes>
	</entity>
	<entity class="gov.va.med.ccht.model.dmp.DMPReview" access="FIELD"
		name="DMPReview">
		
		<table schema="dmp" name="DMP_REVIEW" />
					
		<attribute-override name="id">
			<column name="DMP_REVIEW_ID" />
		</attribute-override>
		<attributes>
			<basic name="dmpToolUserId">
				<column name="DMP_TOOL_USER_ID" />
			</basic>
			<basic name="dmpId">
				<column name="DMP_ID" />
			</basic>	
			<basic name="dmpContentId">
				<column name="DMP_CONTENT_ID" />
			</basic>		
			<basic name="dmpReviewStatusTypeId" >
				<column name="REVIEW_STATUS_TYPE_ID" />
			</basic>
			<basic name="reviewDate">
				<column name="review_date" />
			</basic>	
			<basic name="dmpVersion" >
				<column name="dmp_version" />
			</basic>					
			<basic name="contentComment" >
				<column name="content_cmmnt" />
			</basic>
			<basic name="freqencyComment" >
				<column name="frequency_cmmnt" />
			</basic>
			<basic name="respTypeComment" >
				<column name="rspnse_type_cmmnt" />
			</basic>
			<basic name="respContentComment" >
				<column name="rspnse_content_cmmnt" />
			</basic>
			<basic name="respAlertComment" >
				<column name="rspnse_alert_cmmnt" />
			</basic>
			<basic name="respBranchComment" >
				<column name="rspnse_branch_cmmnt" />
			</basic>

			<basic name="respEduComment" >
				<column name="rspnse_edu_cmmnt" />
			</basic>
			<basic name="respVIComment" >
				<column name="rspnse_vndr_info_cmmnt" />
			</basic>
			<transient name="createdByName"/>
			<transient name="modifiedDate"/>
			<transient name="userName"/>
		</attributes>
	</entity>
	<entity class="gov.va.med.ccht.model.dmp.DMPVendorDeployment" access="FIELD"
		name="DMPVendorDeployment">
		
		<table schema="dmp" name="DMP_VENDOR_DEPLOYMENT" />
					
		<attribute-override name="id">
			<column name="DMP_VENDOR_DPLYMNT_ID" />
		</attribute-override>
		<attributes>
			<basic name="deployedDate" >
				<column name="date_deployed" />
			</basic>
			<basic name="dmpVersion" >
				<column name="dmp_version" />
			</basic>
			<basic name="deployedDate" >
				<column name="date_deployed" />
			</basic>
			<basic name="facilitator" >
				<column name="FACILITATOR_ID" />
			</basic>
			<basic name="vendor" >
				<column name="VENDOR_ID" />
			</basic>
			<many-to-one name="dmp"
				target-entity="gov.va.med.ccht.model.dmp.DMP">
				<join-column name="DMP_ID" />
			</many-to-one>
<!--			<many-to-one name="dmp"-->
<!--				target-entity="gov.va.med.ccht.model.inventory.Vendor">-->
<!--				<join-column name="VENDOR_ID" />-->
<!--			</many-to-one>-->
<!--			<many-to-one name="facilitator"-->
<!--				target-entity="gov.va.med.ccht.model.dmp.DMPToolUser">-->
<!--				<join-column name="FACILITATOR_ID" />-->
<!--			</many-to-one>-->
			<many-to-one name="statusType"
				target-entity="gov.va.med.ccht.model.dmp.DMPStatusType">
				<join-column name="STATUS_TYPE_ID" />
			</many-to-one>
		</attributes>
	</entity>

	</entity-mappings>