<?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>CCHT TERMINILOGY</description>

	<!--  Terminology Lookup mappings -->
	<entity class="gov.va.med.ccht.model.terminology.InactiveReason"
		access="FIELD" name="InactiveReason">
		<table schema="HT" name="ACCOUNT_INACTIVE_REASON" />
	</entity>
	<entity class="gov.va.med.ccht.model.terminology.RegistrationStatus"
		access="FIELD" name="RegistrationStatus">
		<table schema="HT" name="REGISTRATION_STATUS" />
	</entity>
	<entity class="gov.va.med.ccht.model.terminology.UserGroup"
		access="FIELD" name="UserGroup">
		<table schema="HT" name="HT_USER_GROUP" />
	</entity>
	<entity class="gov.va.med.ccht.model.terminology.RegistrationDeniedReason"
		access="FIELD" name="RegistrationDeniedReason">
		<table schema="HT" name="REG_DENIED_REASON" />
	</entity>
	<entity class="gov.va.med.ccht.model.terminology.RegistrationReason"
		access="FIELD" name="RegistrationReason">
		<table schema="HT" name="HT_JOB_DESCRIPTION" />
	</entity>	
	<entity class="gov.va.med.ccht.model.terminology.ReportType"
		access="FIELD" name="ReportType">
		<table schema="HT" name="HT_REPORT_TYPE" />
	</entity>

	<entity class="gov.va.med.fw.report.ReportExportedType" 
		access="FIELD" name="ReportExportedType">
	    <table schema="HT" name="RPT_OUTPUT_FILE_TYPE"/>
     </entity>
     			     			
	<entity class="gov.va.med.ccht.model.terminology.ReportFormat"
		access="FIELD" name="ReportFormat">
		<table schema="HT" name="RPT_OUTPUT_FORMAT_TYPE" />
	</entity>
          			
	<entity class="gov.va.med.ccht.model.terminology.StandardReport" 
		access="FIELD" name="StandardReport">
		<table schema="HT" name="STANDARD_HT_REPORTS" />
		<named-query name="cchtStandardReports">
			<query>
	    		<![CDATA[select l from gov.va.med.ccht.model.terminology.StandardReport l order by l.reportType.name, l.name asc]]>
	    	</query>
		</named-query>

		<attribute-override name="identifier">
			<column name="STANDARD_HT_REPORT_ID" />
		</attribute-override>
		<attributes>
			<many-to-one name="reportType" target-entity="gov.va.med.ccht.model.terminology.ReportType">
				<join-column name="HT_RPT_TYPE_ID" />
			</many-to-one>
			<one-to-many name="internalPermisions" target-entity="gov.va.med.ccht.model.terminology.ReportPermission"
				mapped-by="standardReport" fetch="EAGER">
				<cascade>
					<cascade-all />
				</cascade>
			</one-to-many>
		</attributes>
	</entity>
	
	<entity class="gov.va.med.ccht.model.terminology.ReportPermission" access="FIELD" name="ReportPermission">
		<table schema="HT" name="RPT_PERMISSIONS" />
		<attribute-override name="id">
			<column name="RPT_PERMISSION_ID" />
		</attribute-override>
		<attributes>
			<many-to-one name="standardReport" target-entity="gov.va.med.ccht.model.terminology.StandardReport">
				<join-column name="STANDARD_HT_REPORT_ID" />
			</many-to-one>
			<many-to-one name="permission" target-entity="gov.va.med.fw.security.Permission">
				<join-column name="PERMISSION_ID" />
			</many-to-one>
		</attributes>
	</entity>
	
	<!--  Report Schedule -->
     <entity class="gov.va.med.ccht.model.terminology.WeekOfMonth" access="FIELD" name="WeekOfMonth">
	    <table schema="ht" name="HT_STD_RPTWEEKOFMONTH_TYPE"/>
	    <named-query name="weeksOfmonth">
	    	<query>
	    		<![CDATA[select l from gov.va.med.ccht.model.terminology.WeekOfMonth l 
	    		order by l.identifier asc]]>
	    	</query>
	    </named-query>     	  
     </entity>      
	<entity class="gov.va.med.ccht.model.terminology.RunFrequency" access="FIELD" name="RunFrequency">
	    <table schema="ht" name="HT_STD_RPTRUNFREQUNCY_TYPE"/>
	    <named-query name="reportRunFrequency">
	    	<query>
	    		<![CDATA[select l from gov.va.med.ccht.model.terminology.RunFrequency l 
	    		order by l.code asc]]>
	    	</query>
	    </named-query>    	  
     </entity>
     <entity class="gov.va.med.ccht.model.terminology.Month" access="FIELD" name="Month">
	    <table schema="ht" name="HT_STD_RPTMONTHLIST"/>
	    <named-query name="months">
	    	<query>
	    		<![CDATA[select l from gov.va.med.ccht.model.terminology.Month l 
	    		order by l.code asc]]>
	    	</query>
	    </named-query>    	  
     </entity>
     <entity class="gov.va.med.ccht.model.terminology.DayOfMonth" access="FIELD" name="DayOfMonth">
	    <table schema="ht" name="HT_STD_RPTDAYOFMONTH_TYPE"/>
	    <named-query name="daysOfMonth">
	    	<query>
	    		<![CDATA[select l from gov.va.med.ccht.model.terminology.DayOfMonth l 
	    		order by l.identifier asc]]>
	    	</query>
	    </named-query>     	  
     </entity>
     <entity class="gov.va.med.ccht.model.terminology.DayOfQuarter" access="FIELD" name="DayOfQuarter">
	    <table schema="ht" name="HT_STD_RPTDAYOFQTR_TYPE"/>
	    <named-query name="daysOfQuarter">
	    	<query>
	    		<![CDATA[select l from gov.va.med.ccht.model.terminology.DayOfQuarter l 
	    		order by l.identifier asc]]>
	    	</query>
	    </named-query>     	  
     </entity>
     <entity class="gov.va.med.ccht.model.terminology.DayOfWeek" access="FIELD" name="DayOfWeek">
	    <table schema="ht" name="HT_STD_RPTDAYOFWEEK_TYPE"/>
	    <named-query name="weekDays">
	    	<query>
	    		<![CDATA[select l from gov.va.med.ccht.model.terminology.DayOfWeek l 
	    		order by l.code asc]]>
	    	</query>
	    </named-query>    	  
     </entity>
     <entity class="gov.va.med.ccht.model.terminology.ScheduleType" access="FIELD" name="ScheduleType">
	    <table schema="ht" name="HT_STD_RPTSCHEDULE_TYPE"/>
	    <named-query name="reportScheduleTypes">
	    	<query>
	    		<![CDATA[select l from gov.va.med.ccht.model.terminology.ScheduleType l 
	    		order by l.code asc]]>
	    	</query>
	    </named-query>    	  
     </entity>

     <entity class="gov.va.med.ccht.model.terminology.ReportPeriodType" access="FIELD" name="ReportPeriodType">
	    <table schema="ht" name="HT_STD_RPTPERIOD_TYPE"/>
	    <named-query name="reportPeriodTypes">
	    	<query>
	    		<![CDATA[select l from gov.va.med.ccht.model.terminology.ReportPeriodType l 
	    		order by l.code asc]]>
	    	</query>
	    </named-query>   	  
     </entity>     
     <entity class="gov.va.med.ccht.model.terminology.Quarter" access="FIELD" name="Quarter">
	    <table schema="ht" name="HT_STD_RPTQUARTERLIST"/>
	    <named-query name="quarters">
	    	<query>
	    		<![CDATA[select l from gov.va.med.ccht.model.terminology.Quarter l 
	    		order by l.code asc]]>
	    	</query>
	    </named-query>        	  
     </entity>     
     
     <!--  QIR -->
	<entity class="gov.va.med.ccht.model.qir.QIRType" 
		access="FIELD" name="QIRType">
	    <table schema="qir" name="QIR_TYPES"/>
     </entity>
	<entity class="gov.va.med.ccht.model.qir.QIRStatusType" 
		access="FIELD" name="QIRStatusType">
	    <table schema="qir" name="QIR_STATUS_TYPES"/>
     </entity>          		
	<entity class="gov.va.med.ccht.model.terminology.DocumentType" 
		access="FIELD" name="DocumentType">
	    <table schema="qir" name="DOCUMENT_TYPES"/>
     </entity> 
     <entity class="gov.va.med.ccht.model.qir.DmpQirType" 
		access="FIELD" name="DmpQirType">
	    <table schema="qir" name="DMP_QIR_TYPE"/>
     </entity>
              		          				
     <!--  DMP -->
		<entity class="gov.va.med.ccht.model.dmp.DMPStatusType" 
			access="FIELD" name="DMPStatusType">
		    <table schema="dmp" name="DMP_STATUS_TYPE"/>
	     </entity>
		<entity class="gov.va.med.ccht.model.dmp.DMPResponseType" 
			access="FIELD" name="DMPResponseType">
		    <table schema="dmp" name="DMP_RESPONSE_TYPE"/>
	     </entity>
		<entity class="gov.va.med.ccht.model.dmp.DMPAlertType" 
			access="FIELD" name="DMPAlertType">
		    <table schema="dmp" name="DMP_ALERT_TYPE"/>
	     </entity>
		<entity class="gov.va.med.ccht.model.dmp.DMPContentType" 
			access="FIELD" name="DMPContentType">
		    <table schema="dmp" name="DMP_CONTENT_TYPE"/>
	     </entity>
		<entity class="gov.va.med.ccht.model.dmp.DMPStandLibCatType" 
			access="FIELD" name="DMPStandLibCatType">
		    <table schema="dmp" name="DMP_SL_CONTENT_CATEGORY_TYPE"/>
	     </entity>
		<entity class="gov.va.med.ccht.model.dmp.DMPStandLibContentType" access="FIELD" name="DMPStandLibContentType">
  			<table schema="dmp" name="DMP_SL_CONTENT_TYPE" /> 
  		</entity><!--
		<entity class="gov.va.med.ccht.model.dmp.DMPStandLibClinicalGuidanceType" 
			access="FIELD" name="DMPStandLibClinicalGuidanceType">
		    <table schema="dmp" name="DMP_CPG_TYPE"/>
	     </entity>
		--><entity class="gov.va.med.ccht.model.dmp.DMPStandLibRsnModType" 
			access="FIELD" name="DMPStandLibRsnModType">
		    <table schema="dmp" name="DMP_SL_REASON_MODIFIED"/>
	     </entity>
    </entity-mappings>
