<?xml version="1.0"?>
<project name="OracleDB" default="db_clean_load_test">
	<description>
        Oracle database load, clean, export, import build file for vhim 4.
    </description>
	<property file="${cds.run.properties.path}"/>
	<!-- set global properties for this build -->
	<property name="src" location="resources/db/scripts"/>
	<!-- Variables Required to be set by the calling environment -->
	<!--
		cds.jdbc.host
		cds.jdbc.port
		cds.jdbc.dbname
		cds.jdbc.username
		cds.jdbc.password-->
	<!---->
	<!-- database connection url -->
	<property name="db.url" value="${cds.jdbc.host}:${cds.jdbc.port}/${cds.jdbc.dbname}"/>
		
	<!-- SET ALLERGIES VARIABLES -->
	<!-- Starting Patient VPID.  Set to a value > 0. -->
	<property name="starting_avpid" value="10000"/>
	<!-- How many Allergies per patient to create, modify value to change -->
	<property name="num_allergies" value="6"/>
	<!-- How many Patients to assign the above number of Allergies to, modify value to change -->
	<property name="num_apatients" value="15"/>
	<!-- How many Reactions per Allergy to create, modify value to change -->
	<property name="num_reactions" value="1"/>
	
	<!-- SET PHARMACY VARIABLES -->
	<!-- Starting Patient VPID.  Set to a value > 0. -->
	<property name="starting_pvpid" value="5000"/>
	<!-- How many Pharmacies per patient to create, modify value to change -->
	<property name="num_pharmacy" value="5"/>
	<!-- How many Patients to assign the above number of Pharmacy to, modify value to change -->
	<property name="num_ppatients" value="2"/>
			
	<!-- SET VITALS VARIABLES -->
	<!-- Starting Patient VPID.  Set to a value > 0. -->
	<property name="starting_vvpid" value="1"/>
	<!-- How many Vitals per patient to create, modify value to change -->
	<property name="num_vitals" value="10"/>
	<!-- How many Patients to assign the above number of Vitals to, modify value to change -->
	<property name="num_vpatients" value="10"/>
	
	<!-- SET  LAB VARIABLES -->
	<!-- Starting Patient VPID.  Set to a value > 0. -->
	<property name="starting_lvpid" value="500"/>
	<!-- How many Allergies per patient to create, modify value to change -->
	<property name="num_lab" value="6"/>
	<!-- How many Patients to assign the above number of Allergies to, modify value to change -->
	<property name="num_lpatients" value="20"/>

	<!-- SET  TIU VARIABLES -->
	<!-- Starting Patient VPID.  Set to a value > 0. -->
	<property name="starting_tvpid" value="500"/>
	<!-- How many TIU per patient to create, modify value to change -->
	<property name="num_tiu" value="5"/>
	<!-- How many Patients to assign the above number of TIU to, modify value to change -->
	<property name="num_tpatients" value="25"/>

	<!-- SET  HEALTH ADAPTER VARIABLES -->
	<!-- Starting Patient VPID.  Set to a value > 0. -->
	<property name="starting_hvpid" value="999999"/>
	<!-- How many health adapter records per patient to create, modify value to change -->
	<property name="num_health" value="6"/>
	<!-- How many Patients to assign the above number of health adapter records -->
	<property name="num_hpatients" value="20"/>

	<!-- SET  Questionnaire VARIABLES -->
	<!-- Starting Patient VPID.  Set to a value > 0. -->
	<property name="starting_qpid" value="999999"/>
	<!-- How many dbq  records per patient to create, modify value to change -->
	<property name="num_q" value="600"/>
	<!-- How many Patients to assign the above number of dbq records -->
	<property name="num_qpatients" value="20"/>

    <target name="db_load_test" depends="db_load_allergies, db_load_vitals_hth, db_load_vitals_vista, db_load_outppharm, db_load_healthadapter, db_load_dbq, db_load_survey, db_load_lab" description="load database">
		<echo message="all database ${cds.jdbc.host}:${cds.jdbc.port}/${cds.jdbc.dbname} load finished"/>
	</target>

    <target name="db_load_prod" depends="db_load_allergies, db_load_vitals_hth, db_load_vitals_vista, db_load_outppharm, db_load_healthadapter, db_load_dbq, db_load_survey, import_prod_tfr" description="load database">
        <echo message="all database ${cds.jdbc.host}:${cds.jdbc.port}/${cds.jdbc.dbname} load finished"/>
    </target>
	
	<target name="db_load_allergies" description="load allergies into database">
		<echo message="about to load allergies into database ${cds.jdbc.username}@${db.url}"/>
		<exec dir="${src}" executable="sqlplus" failonerror="true">
			<arg line="-s"/>
			<arg line="${cds.jdbc.username}/${cds.jdbc.password}@${db.url}"/>
			<arg line="@new_allergies_load4x_arms.sql"/>
			<arg line="${num_allergies}"/>
			<arg line="${num_apatients}"/>
			<arg line="${num_reactions}"/>
			<arg line="${starting_avpid}"/>
			<arg line="1>logs\load_allergy_output.txt"/>
			<arg line="2>>logs\load_allergy_logfile.log"/>
		</exec>
		<echo message="allergies for database ${cds.jdbc.username}@${db.url} load finished"/>
	</target>
	
	<target name="db_load_vitals_hth" description="load vitals into database">
		<echo message="about to load HTH vitals into database ${cds.jdbc.username}@${db.url}"/>
		<exec dir="${src}" executable="sqlplus" failonerror="true">
			<arg line="-s"/>
			<arg line="${cds.jdbc.username}/${cds.jdbc.password}@${db.url}"/>
			<arg line="@new_vitals_load4x_arms.sql"/>
			<arg line="${num_vitals}"/>
			<arg line="${num_vpatients}"/>
			<arg line="${starting_vvpid}"/>
			<arg line="1>logs\load_vital_output.txt"/>
			<arg line="2>>logs\load_vital_logfile.log"/>
		</exec>
		<echo message="vitals for database ${cds.jdbc.username}@${db.url} load finished"/>
	</target>

	<target name="db_load_vitals_vista" description="load vitals into database">
		<echo message="about to load vista vitals into database ${cds.jdbc.username}@${db.url}"/>
		<exec dir="${src}" executable="sqlplus" failonerror="true">
			<arg line="-s"/>
			<arg line="${cds.jdbc.username}/${cds.jdbc.password}@${db.url}"/>
			<arg line="@new_vitals_load4x_arms_vista.sql"/>
			<arg line="${num_vitals}"/>
			<arg line="${num_vpatients}"/>
			<arg line="${starting_vvpid}"/>
			<arg line="1>logs\load_vital_output.txt"/>
			<arg line="2>>logs\load_vital_logfile.log"/>
		</exec>
		<echo message="vitals for database ${cds.jdbc.username}@${db.url} load finished"/>
	</target>
	
	<target name="db_load_outppharm" description="load outppharm into database">
		<echo message="about to load outppharm into database ${cds.jdbc.username}@${db.url}"/>
		<exec dir="${src}" executable="sqlplus" failonerror="true">
			<arg line="-s"/>
			<arg line="${cds.jdbc.username}/${cds.jdbc.password}@${db.url}"/>
			<arg line="@new_outppharm_load4x_arms.sql"/>
			<arg line="${num_pharmacy}"/>
			<arg line="${num_ppatients}"/>
			<arg line="${starting_pvpid}"/>
			<arg line="1>logs\load_outppharm_output.txt"/>
			<arg line="2>>logs\load_outppharm_logfile.log"/>
		</exec>
		<echo message="outppharm for database ${cds.jdbc.username}@${db.url} load finished"/>
	</target>
  	
	<target name="db_load_healthadapter" description="load health adapter data into database">
		<echo message="about to load health adapter data into database ${cds.jdbc.username}@${db.url}"/>
		<exec dir="${src}" executable="sqlplus" failonerror="true">
			<arg line="-s"/>
			<arg line="${cds.jdbc.username}/${cds.jdbc.password}@${db.url}"/>
			<arg line="@new_heathadapter_load.sql"/>
			<arg line="${num_health}"/>
			<arg line="${num_hpatients}"/>
			<arg line="${starting_hvpid}"/>
			<arg line="1>logs\load_mha_output.txt"/>
			<arg line="2>>logs\load_mha_logfile.log"/>
		</exec>
		<echo message="health adapters for database ${cds.jdbc.username}@${db.url} load finished"/>
	</target>
 
	<target name="db_load_lab" description="load lab into database">
		<echo message="about to load lab into database ${cds.oracle.schema.lab.username}@${db.url}"/>
		<exec dir="${src}" executable="sqlplus" failonerror="true">
		<arg line="-s"/>
		<arg line="${cds.oracle.schema.lab.username}/${cds.oracle.schema.lab.password}@${db.url}"/>
		<arg line="@new_lab_load4x_arms.sql"/>
		<arg line="${num_lab}"/>
		<arg line="${num_lpatients}"/>
		<arg line="${starting_lvpid}"/>
		<arg line="1>logs\load_lab_output.txt"/>
		<arg line="2>>logs\load_lab_logfile.log"/>
		</exec>
		<echo message="lab for database ${cds.oracle.schema.jdbc.username}@${db.url} load finished"/>
	</target> 

	<target name="db_load_dbq" description="load questionnaire data into database">
		<echo message="about to load dbq data into database ${cds.oracle.schema.dbq.username}@${db.url}"/>
		<exec dir="${src}" executable="sqlplus" failonerror="true">
			<arg line="-s"/>
			<arg line="${cds.oracle.schema.dbq.username}/${cds.oracle.schema.dbq.password}@${db.url}"/>
			<arg line="@load_questionnaire_result.sql"/>
			<arg line="${num_q}"/>
			<arg line="1>logs\load_q_output.txt"/>
			<arg line="2>>logs\load_q_logfile.log"/>
		</exec>
		<echo message="dbq for database ${cds.oracle.schema.dbq.username}@${db.url} load finished"/>
	</target>
  	
	<target name="db_load_survey" description="load surveys data into database">
		<echo message="about to load survey data into database ${cds.oracle.schema.survey.username}@${db.url}"/>
		<exec dir="${src}" executable="sqlplus" failonerror="true">
			<arg line="-s"/>
			<arg line="${cds.oracle.schema.survey.username}/${cds.oracle.schema.survey.password}@${db.url}"/>
			<arg line="@load_survey.sql"/>
			<arg line="1>logs\load_survey_output.txt"/>
			<arg line="2>>logs\load_survey_logfile.log"/>
		</exec>
		<echo message="survey for database ${cds.oracle.schema.survey.username}@${db.url} load finished"/>
	</target>
	
	<target name="delete_individual_op" description="delete individual dev op data from database" >
		<echo message="about to delete stale data from out-patient-pharmacy database ${devconnector.cds.oracle.schema.outppharm.username}@${devconnector.cds.jdbc.host}:${devconnector.cds.jdbc.port}/${devconnector.cds.jdbc.dbname}"/>
	    	<exec dir="${src}" executable="sqlplus" failonerror="true">
	    	<arg line="-s"/>
            <arg line="${devconnector.cds.oracle.schema.outppharm.username}/${devconnector.cds.oracle.schema.outppharm.password}@${devconnector.cds.jdbc.host}:${devconnector.cds.jdbc.port}/${devconnector.cds.jdbc.dbname}"/>
		    <arg line="@delete_outppharm_ind.sql"/>
	    	<arg line="${cds.unique.patient}"/>
	        <arg line="1>logs\delete_individual_op.txt"/>
		    <arg line="2>>logs\delete_individual_op.log"/>
	    </exec>
	    <echo message="out-patient-pharmacy for database ${devconnector.cds.oracle.schema.outppharm.username}@${devconnector.cds.jdbc.host}:${devconnector.cds.jdbc.port}/${devconnector.cds.jdbc.dbname} delete finished"/>
  	</target>
	
	<target name="delete_individual_lab" description="delete individual dev lab data from database" >
		<echo message="about to delete stale data from lab database ${devconnector.cds.oracle.schema.lab.username}@${devconnector.cds.jdbc.host}:${devconnector.cds.jdbc.port}/${devconnector.cds.jdbc.dbname}"/>
	    	<exec dir="${src}" executable="sqlplus" failonerror="true">
	    	<arg line="-s"/>
            <arg line="${devconnector.cds.oracle.schema.lab.username}/${devconnector.cds.oracle.schema.lab.password}@${devconnector.cds.jdbc.host}:${devconnector.cds.jdbc.port}/${devconnector.cds.jdbc.dbname}"/>
		    <arg line="@delete_lab_ind.sql"/>
	    	<arg line="${cds.unique.patient}"/>
	        <arg line="1>logs\delete_individual_lab.txt"/>
		    <arg line="2>>logs\delete_individual_lab.log"/>
	    </exec>
	    <echo message="lab for database ${devconnector.cds.oracle.schema.lab.username}@${devconnector.cds.jdbc.host}:${devconnector.cds.jdbc.port}/${devconnector.cds.jdbc.dbname} delete finished"/>
  	</target>
	
    <target name="truncate_tfrlocal" description="truncate tfrlocal schema">
        <echo message="about to truncate data from tfrlocal from database ${cds.jdbc.username}@${db.url}"/>
        <exec dir="${src}" executable="sqlplus" failonerror="true">
            <arg line="-s"/>
            <arg line="${cds.jdbc.username}/${cds.jdbc.password}@${db.url}"/>
            <arg line="@truncate_tfr.sql"/>
            <arg line="1>clean_output.txt"/>
            <arg line="2>>clean_logfile.log"/>
        </exec>
        <echo message="tfrlocal truncated for database ${cds.jdbc.username}@${db.url} load finished"/>
    </target>
	
	<target name="truncate_tfr" description="truncate tfr schema">
        <echo message="about to truncate data from tfr from database ${cds.oracle.schema.tfr.username}@${db.url}"/>
        <exec dir="${src}" executable="sqlplus" failonerror="true">
            <arg line="-s"/>
            <arg line="${cds.oracle.schema.tfr.username}/${cds.oracle.schema.tfr.password}@${db.url}"/>
            <arg line="@truncate_tfr.sql"/>
            <arg line="1>clean_output.txt"/>
            <arg line="2>>clean_logfile.log"/>
        </exec>
        <echo message="tfr truncated for database ${cds.oracle.schema.tfr.username}@${db.url} load finished"/>
    </target>
    
    <target name="truncate_tfrlocal3" description="truncate tfrlocal3 schema">
        <echo message="about to truncate data from tfrlocal3 from database ${cds.jdbc.username}@${db.url}"/>
        <exec dir="${src}" executable="sqlplus" failonerror="true">
            <arg line="-s"/>
            <arg line="${cds.jdbc.username}/${cds.jdbc.password}@${db.url}"/>
            <arg line="@truncate_tfr.sql"/>
            <arg line="1>clean_output.txt"/>
            <arg line="2>>clean_logfile.log"/>
        </exec>
        <echo message="tfrlocal truncated for database ${cds.jdbc.username}@${db.url} load finished"/>
    </target>
    
    <target name="import_test_tfr" depends="truncate_tfr" description="reload tfr schema">
        <echo message="about to load tfr into database ${cds.oracle.schema.tfr.username}@${db.url}"/>
        <exec dir="${src}" executable="imp" failonerror="false">
            <arg line="${cds.oracle.schema.tfr.username}/${cds.oracle.schema.tfr.password}@${db.url}"/>
            <arg line="file=tfr.dmp"/>
			<arg line="tables=filter_schema,template_schema,domain_entry_point,vhim_version,entry_filter,filter_schema_entry_filter,filter_schema_vhim_version,template_schema_entry_point,template_schema_vhim_version"/>
            <arg line="constraints=n"/>
	    <arg line="statistics=none"/>
            <arg line="grants=n"/>
			<arg line="ignore=y"/>
			<arg line="log=imp_test_tfr.log"/>
        </exec>
        <echo message="test tfr imported for database ${cds.oracle.schema.tfr.username}@${db.url} load finished"/>
    </target>
	
	<target name="truncate_tfr3" description="truncate tfr3 schema">
        <echo message="about to truncate data from tfr3 from database ${cds.oracle.schema.tfr3.username}@${db.url}"/>
        <exec dir="${src}" executable="sqlplus" failonerror="true">
            <arg line="-s"/>
            <arg line="${cds.oracle.schema.tfr3.username}/${cds.oracle.schema.tfr3.password}@${db.url}"/>
            <arg line="@truncate_tfr.sql"/>
            <arg line="1>clean_output.txt"/>
            <arg line="2>>clean_logfile.log"/>
        </exec>
        <echo message="tfr3 truncated for database ${cds.oracle.schema.tfr3.username}@${db.url} load finished"/>
    </target> 
	
	<target name="import_test_tfr3" depends="truncate_tfr3" description="reload tfr3 schema">
        <echo message="about to load tfr3 into database ${cds.oracle.schema.tfr3.username}@${db.url}"/>
        <exec dir="${src}" executable="imp" failonerror="false">
            <arg line="${cds.oracle.schema.tfr3.username}/${cds.oracle.schema.tfr3.password}@${db.url}"/>
            <arg line="file=tfr.dmp"/>
			<arg line="tables=filter_schema,template_schema,domain_entry_point,vhim_version,entry_filter,filter_schema_entry_filter,filter_schema_vhim_version,template_schema_entry_point,template_schema_vhim_version"/>
            <arg line="constraints=n"/>
	    <arg line="statistics=none"/>
            <arg line="grants=n"/>
			<arg line="ignore=y"/>
			<arg line="log=imp_test_tfr.log"/>
        </exec>
        <echo message="test tfr3 imported for database ${cds.oracle.schema.tfr3.username}@${db.url} load finished"/>
    </target>
	
	<target name="import_test_tfrlocal3" depends="truncate_tfrlocal3" description="reload tfrlocal3 schema from dump file">
        <echo message="about to load tfrlocal3 into database ${cds.oracle.schema.tfrlocal3.username}@${db.url}"/>
        <exec dir="${src}" executable="imp" failonerror="false">
            <arg line="${cds.oracle.schema.tfrlocal3.username}/${cds.oracle.schema.tfrlocal3.password}@${db.url}"/>
            <arg line="file=tfr.dmp"/>
			<arg line="tables=filter_schema,template_schema,domain_entry_point,vhim_version,entry_filter,filter_schema_entry_filter,filter_schema_vhim_version,template_schema_entry_point,template_schema_vhim_version"/>
            <arg line="constraints=n"/>
	    <arg line="statistics=none"/>
            <arg line="grants=n"/>
			<arg line="ignore=y"/>
			<arg line="log=imp_test_tfrlocal3.log"/>
        </exec>
        <echo message="test tfrlocal imported for database ${cds.oracle.schema.tfrlocal.username}@${db.url} load finished"/>
    </target>
    
    <target name="import_prod_tfr" depends="truncate_tfr" description="reload tfr schema">
        <echo message="about to load tfr into database ${cds.jdbc.username}@${db.url}"/>
        <exec dir="${src}" executable="imp" failonerror="false">
            <arg line="${cds.oracle.schema.tfr.username}/${cds.oracle.schema.tfr.password}@${db.url}"/>
            <arg line="file=tfr.dmp"/>
			<arg line="tables=filter_schema,template_schema,domain_entry_point,vhim_version,entry_filter,filter_schema_entry_filter,filter_schema_vhim_version,template_schema_entry_point,template_schema_vhim_version"/>
            <arg line="constraints=n"/>
	    <arg line="statistics=none"/>
            <arg line="grants=n"/>
			<arg line="ignore=y"/>
			<arg line="log=imp_prod_tfr.log"/>
        </exec>
        <exec dir="${src}" executable="sqlplus" failonerror="false">
            <arg line="-s"/>
            <arg line="${cds.oracle.schema.tfr.username}/${cds.oracle.schema.tfr.password}@${db.url}"/>
            <arg line="@clean_tfr.sql"/>
            <arg line="1>clean_tfr.txt"/>
            <arg line="2>>clean_tfr.log"/>
        </exec>
        <echo message="prod tfr imported for database ${cds.jdbc.username}@${db.url} load finished"/>
    </target>

    <target name="import_prod_tfr3" depends="truncate_tfr3" description="reload tfr3 schema">
        <echo message="about to load tfr3 into database ${cds.jdbc.username}@${db.url}"/>
        <exec dir="${src}" executable="imp" failonerror="false">
            <arg line="${cds.oracle.schema.tfr3.username}/${cds.oracle.schema.tfr3.password}@${db.url}"/>
            <arg line="file=tfr.dmp"/>
			<arg line="tables=filter_schema,template_schema,domain_entry_point,vhim_version,entry_filter,filter_schema_entry_filter,filter_schema_vhim_version,template_schema_entry_point,template_schema_vhim_version"/>
            <arg line="constraints=n"/>
    	    <arg line="statistics=none"/>
            <arg line="grants=n"/>
			<arg line="ignore=y"/>
			<arg line="log=imp_prod_tfr.log"/>
        </exec>
        <exec dir="${src}" executable="sqlplus" failonerror="false">
            <arg line="-s"/>
            <arg line="${cds.oracle.schema.tfr3.username}/${cds.oracle.schema.tfr3.password}@${db.url}"/>
            <arg line="@clean_tfr.sql"/>
            <arg line="1>clean_tfr.txt"/>
            <arg line="2>>clean_tfr.log"/>
        </exec>
        <echo message="prod tfr3 imported for database ${cds.jdbc.username}@${db.url} load finished"/>
    </target>
   
    <target name="db_clean_prod" depends="import_prod_tfr, clean" description="clean database out with production templates and filters">
    </target>
   
    <target name="db_clean_prod3" depends="import_prod_tfr3, clean" description="clean database out with production3 templates and filters">
    </target>

	<target name="db_clean_test" depends="clean" description="clean database out">
	</target>

    <target name="clean" description="clean database">
        <echo message="about to clean schema ${cds.oracle.schema.allergies.username}@${db.url}"/>
        <exec dir="${src}" executable="sqlplus" failonerror="true">
            <arg line="-s"/>
            <arg line="${cds.oracle.schema.allergies.username}/${cds.oracle.schema.allergies.password}@${db.url}"/>
            <arg line="@clean_out_allergies4x_arms.sql"/>
            <arg line="1>clean_output.txt"/>
            <arg line="2>>clean_logfile.log"/>
        </exec>
        <echo message="schema ${cds.oracle.schema.allergies.username}@${db.url} cleaned successfully"/>

        <echo message="about to clean schema ${cds.oracle.schema.vitals.username}@${db.url}"/>
        <exec dir="${src}" executable="sqlplus" failonerror="true">
            <arg line="-s"/>
            <arg line="${cds.oracle.schema.vitals.username}/${cds.oracle.schema.vitals.password}@${db.url}"/>
            <arg line="@clean_out_vitals4x_arms.sql"/>
            <arg line="1>clean_output.txt"/>
            <arg line="2>>clean_logfile.log"/>
        </exec>
        <echo message="schema ${cds.oracle.schema.vitals.username}@${db.url} cleaned successfully"/>

        <echo message="about to clean schema ${cds.oracle.schema.logger.username}@${db.url}"/>
        <exec dir="${src}" executable="sqlplus" failonerror="true">
            <arg line="-s"/>
            <arg line="${cds.oracle.schema.logger.username}/${cds.oracle.schema.logger.password}@${db.url}"/>
            <arg line="@clean_out_logger4x_arms.sql"/>
            <arg line="1>clean_output.txt"/>
            <arg line="2>>clean_logfile.log"/>
        </exec>
        <echo message="schema ${cds.oracle.schema.logger.username}@${db.url} cleaned successfully"/>

        <echo message="about to clean schema ${cds.oracle.schema.outppharm.username}@${db.url}"/>
        <exec dir="${src}" executable="sqlplus" failonerror="true">
            <arg line="-s"/>
            <arg line="${cds.oracle.schema.outppharm.username}/${cds.oracle.schema.outppharm.password}@${db.url}"/>
            <arg line="@clean_out_outppharm4x_arms.sql"/>
            <arg line="1>clean_output.txt"/>
            <arg line="2>>clean_logfile.log"/>
        </exec>
        <echo message="schema ${cds.oracle.schema.outppharm.username}@${db.url} cleaned successfully"/>

        <echo message="about to clean schema ${cds.oracle.schema.healthadapter.username}@${db.url}"/>
        <exec dir="${src}" executable="sqlplus" failonerror="true">
            <arg line="-s"/>
            <arg line="${cds.oracle.schema.healthadapter.username}/${cds.oracle.schema.healthadapter.password}@${db.url}"/>
            <arg line="@clean_out_healthadapter.sql"/>
            <arg line="1>clean_output.txt"/>
            <arg line="2>>clean_logfile.log"/>
        </exec>
        <echo message="schema ${cds.oracle.schema.healthadapter.username}@${db.url} cleaned successfully"/>

        <echo message="about to clean schema ${cds.oracle.schema.dbq.username}@${db.url}"/>
        <exec dir="${src}" executable="sqlplus" failonerror="true">
            <arg line="-s"/>
            <arg line="${cds.oracle.schema.dbq.username}/${cds.oracle.schema.dbq.password}@${db.url}"/>
            <arg line="@clean_out_dbq.sql"/>
            <arg line="1>clean_output.txt"/>
            <arg line="2>>clean_logfile.log"/>
        </exec>
        <echo message="schema ${cds.oracle.schema.dbq.username}@${db.url} cleaned successfully"/>

        <echo message="about to clean schema ${cds.oracle.schema.survey.username}@${db.url}"/>
        <exec dir="${src}" executable="sqlplus" failonerror="true">
            <arg line="-s"/>
            <arg line="${cds.oracle.schema.survey.username}/${cds.oracle.schema.survey.password}@${db.url}"/>
            <arg line="@clean_out_survey.sql"/>
            <arg line="1>clean_output.txt"/>
            <arg line="2>>clean_logfile.log"/>
        </exec>

	<echo message="about to clean schema ${cds.oracle.schema.survey.username}@${db.url}"/>
	<exec dir="${src}" executable="sqlplus" failonerror="true">
	   <arg line="-s"/>
	   <arg line="${cds.oracle.schema.lab.username}/${cds.oracle.schema.lab.password}@${db.url}"/>
	   <arg line="@clean_out_lab4x_arms.sql"/>
	   <arg line="1>clean_output.txt"/>
	   <arg line="2>>clean_logfile.log"/>
	</exec>

        <echo message="schema ${cds.oracle.schema.dbq.username}@${db.url} cleaned successfully"/>
		
		<echo message="about to reset the lab sequence for ${cds.oracle.schema.lab.username}@${db.url}"/>
    		<exec dir="${src}" executable="sqlplus" failonerror="true">
    		  <arg line="-s"/>
    		  <arg line="${cds.oracle.schema.lab.username}/${cds.oracle.schema.lab.password}@${db.url}"/>
    		  <arg line="@reset_lab_sequences.sql"/>
    		  <arg line="1>>logs\clean_output.txt"/>
    		  <arg line="2>>logs\clean_logfile.log"/>
    		</exec>
    		<echo message="finished resetting the lab sequence for ${cds.oracle.schema.lab.username}@${db.url}"/>	
		
		<echo message="about to reset the allergies sequence for ${cds.oracle.schema.allergies.username}@${db.url}"/>
		<exec dir="${src}" executable="sqlplus" failonerror="true">
		  <arg line="-s"/>
		  <arg line="${cds.oracle.schema.allergies.username}/${cds.oracle.schema.allergies.password}@${db.url}"/>  
		  <arg line="@reset_allergies_sequences.sql"/>
		  <arg line="1>>logs\clean_output.txt"/>
		  <arg line="2>>logs\clean_logfile.log"/>
		</exec>
		<echo message="finished resetting the allergy sequence for ${cds.oracle.schema.allergies.username}@${db.url}"/>
		
		<echo message="about to reset the vitals sequence for ${cds.oracle.schema.vitals.username}@${db.url}"/>
		<exec dir="${src}" executable="sqlplus" failonerror="true">
		  <arg line="-s"/>
		  <arg line="${cds.oracle.schema.vitals.username}/${cds.oracle.schema.vitals.password}@${db.url}"/>  
		  <arg line="@reset_vitals_sequences.sql"/>
		  <arg line="1>>logs\clean_output.txt"/>
		  <arg line="2>>logs\clean_logfile.log"/>
		</exec>
		<echo message="finished resetting the vitals sequence for ${cds.oracle.schema.vitals.username}@${db.url}"/>
		
		<echo message="about to reset the outppharm sequence for ${cds.oracle.schema.outppharm.username}@${db.url}"/>
		<exec dir="${src}" executable="sqlplus" failonerror="true">
		  <arg line="-s"/>
		  <arg line="${cds.oracle.schema.outppharm.username}/${cds.oracle.schema.outppharm.password}@${db.url}"/>  
		  <arg line="@reset_outppharm_sequences.sql"/>
		  <arg line="1>>logs\clean_output.txt"/>
		  <arg line="2>>logs\clean_logfile.log"/>
		</exec>
		<echo message="finished resetting the outppharm sequence for ${cds.oracle.schema.outppharm.username}@${db.url}"/>
		
		<echo message="about to reset the health adapter sequence for ${cds.oracle.schema.healthadapter.username}@${db.url}"/>
		<exec dir="${src}" executable="sqlplus" failonerror="true">
		  <arg line="-s"/>
		  <arg line="${cds.oracle.schema.healthadapter.username}/${cds.oracle.schema.healthadapter.password}@${db.url}"/>  
		  <arg line="@reset_healthadapters_sequences.sql"/>
		  <arg line="1>>logs\clean_output.txt"/>
		  <arg line="2>>logs\clean_logfile.log"/>
		</exec>
		<echo message="finished resetting the health adapter sequence for ${cds.oracle.schema.healthadapter.username}@${db.url}"/>
		
    	<echo message="about to reset the dbq sequence for ${cds.oracle.schema.dbq.username}@${db.url}"/>
		<exec dir="${src}" executable="sqlplus" failonerror="true">
		  <arg line="-s"/>
		  <arg line="${cds.oracle.schema.dbq.username}/${cds.oracle.schema.dbq.password}@${db.url}"/>  
		  <arg line="@reset_dbq_sequences.sql"/>
		  <arg line="1>>logs\clean_output.txt"/>
		  <arg line="2>>logs\clean_logfile.log"/>
		</exec>
		
    	<echo message="about to reset the survey sequence for ${cds.oracle.schema.survey.username}@${db.url}"/>
		<exec dir="${src}" executable="sqlplus" failonerror="true">
		  <arg line="-s"/>
		  <arg line="${cds.oracle.schema.survey.username}/${cds.oracle.schema.survey.password}@${db.url}"/>  
		  <arg line="@reset_survey_sequences.sql"/>
		  <arg line="1>>logs\clean_output.txt"/>
		  <arg line="2>>logs\clean_logfile.log"/>
		</exec>
		<echo message="finished resetting the survey sequence for ${cds.oracle.schema.survey.username}@${db.url}"/>
	</target>
	
    <target name="db_clean_load_test" depends="db_clean_test, db_load_test" description="load database after cleaning out">
		<echo message="database ${cds.jdbc.username}@${db.url} clean/load finished"/>
	</target>
	
	<target name="db_clean_load_tfr_test" depends="db_clean_test, db_load_test, import_test_tfrlocal3, import_test_tfr3" description="load database after cleaning out; refresh tfrlocal3">
		<echo message="database ${cds.jdbc.username}@${db.url} clean/load finished"/>
	</target>
    
    <target name="db_clean_load_prod" depends="db_clean_prod, db_load_prod" description="load database after cleaning out">
        <echo message="database ${cds.jdbc.username}@${db.url} clean/load finished"/>
    </target>
    
    <target name="export_tfr" description="export production tfr schema">
        <echo message="about to export production tfr from database ${cds.oracle.schema.tfr.username}@${db.url}"/>
        <exec dir="${src}" executable="exp" failonerror="false">
            <arg line="${cds.oracle.schema.tfr.username}/${cds.oracle.schema.tfr.password}@${db.url}"/>
			<arg line="parfile=tfr_parfile.txt"/>
        </exec>
        <echo message="tfr exported for database ${cds.oracle.schema.tfr.username}@${db.url} load finished"/>
    </target>
    
    <target name="export_tfr3" description="export production tfr3 schema">
        <echo message="about to export production tfr3 from database ${cds.oracle.schema.tfr3.username}@${db.url}"/>
        <exec dir="${src}" executable="exp" failonerror="false">
            <arg line="${cds.oracle.schema.tfr3.username}/${cds.oracle.schema.tfr3.password}@${db.url}"/>
			<arg line="parfile=tfr_parfile.txt"/>
        </exec>
        <echo message="tfr3 exported for database ${cds.oracle.schema.tfr3.username}@${db.url} load finished"/>
    </target>
	
	<target name="export_tfrlocal" description="export production tfrlocal schema">
        <echo message="about to export production tfrlocal from database ${cds.oracle.schema.tfrlocal.username}@${db.url}"/>
        <exec dir="${src}" executable="exp" failonerror="false">
            <arg line="${cds.oracle.schema.tfrlocal.username}/${cds.oracle.schema.tfrlocal.password}@${db.url}"/>
			<arg line="parfile=tfr_parfile.txt"/>
        </exec>
        <echo message="tfrlocal exported for database ${cds.oracle.schema.tfrlocal.username}@${db.url} load finished"/>
    </target>
	
	<target name="export_tfrlocal3" description="export production tfrlocal3 schema">
        <echo message="about to export production tfrlocal3 from database ${cds.oracle.schema.tfrlocal3.username}@${db.url}"/>
        <exec dir="${src}" executable="exp" failonerror="false">
            <arg line="${cds.oracle.schema.tfrlocal3.username}/${cds.oracle.schema.tfrlocal3.password}@${db.url}"/>
			<arg line="parfile=tfr_parfile.txt"/>
        </exec>
        <echo message="tfrlocal exported for database ${cds.oracle.schema.tfrlocal.username}@${db.url} load finished"/>
    </target>
</project>
