<?xml version="1.0" encoding="UTF-8"?>
<!--
    $Author: DJ  
    $Date: 2013-3-20 下午8:19:56  
    $Revision: 1.0  
    $Purpose: 
-->
<ns1:model xmlns:ns1="http://www.leaf-framework.org/schema/bm" alias="t1" extend="sch.SCH101.sch_schedule" extendMode="reference">
    <ns1:fields>
        <ns1:field name="schedule_name"/>
        <ns1:field name="short_desc"/>
        <ns1:field name="full_desc"/>
        <ns1:field name="repeat_interval"/>
        <ns1:field name="start_date" databaseType="DATE" datatype="java.util.Date" physicalName="START_DATE"/>
        <ns1:field name="end_date" databaseType="DATE" datatype="java.util.Date" physicalName="END_DATE"/>
        <ns1:field name="para_freq"/>
        <ns1:field name="para_interval"/>
        <ns1:field name="para_bymonth"/>
        <ns1:field name="para_bymonthday"/>
        <ns1:field name="para_byweekno"/>
        <ns1:field name="para_byyearday"/>
        <ns1:field name="para_byday"/>
        <ns1:field name="para_bydate"/>
        <ns1:field name="para_byhour"/>
        <ns1:field name="para_byminute"/>
        <ns1:field name="para_bysecond"/>
        <ns1:field name="para_include"/>
        <ns1:field name="para_exclude"/>
        <ns1:field name="para_intersect"/>
        <ns1:field name="setup_mode"/>
    </ns1:fields>
    <ns1:operations>
        <ns1:operation name="insert">
            <ns1:update-sql><![CDATA[
    			begin
				    sch_schedule_pkg.schedule_manage(p_operation_type  => 'INSERT',
				       								 p_schedule_name   => ${@schedule_name},
							                         p_short_desc      => ${@short_desc},
							                         p_full_desc       => ${@full_desc},
							                         p_repeat_interval => ${@repeat_interval},
							                         p_start_date      => to_date(${@start_date},'yyyy-mm-dd'),
							                         p_end_date        => to_date(${@end_date},'yyyy-mm-dd'),
							                         p_para_freq       => ${@para_freq},
							                         p_para_interval   => ${@para_interval},
							                         p_para_bymonth    => ${@para_bymonth},
							                         p_para_bymonthday => ${@para_bymonthday},
							                         p_para_byweekno   => ${@para_byweekno},
							                         p_para_byyearday  => ${@para_byyearday},
							                         p_para_byday      => ${@para_byday},
							                         p_para_bydate     => ${@para_bydate},
							                         p_para_byhour     => ${@para_byhour},
							                         p_para_byminute   => ${@para_byminute},
							                         p_para_bysecond   => ${@para_bysecond},
							                         p_para_include    => ${@para_include},
							                         p_para_exclude    => ${@para_exclude},
							                         p_para_intersect  => ${@para_intersect},
							                         p_user_id         => ${/session/@user_id},
							                         p_setup_mode      => ${@setup_mode});
				end;
    		]]></ns1:update-sql>
        </ns1:operation>
        <ns1:operation name="update">
            <ns1:update-sql><![CDATA[
    			begin
    				sch_schedule_pkg.schedule_manage(p_operation_type  => 'UPDATE',
				    								 p_schedule_name   => ${@schedule_name},
							                         p_short_desc      => ${@short_desc},
							                         p_full_desc       => ${@full_desc},
							                         p_repeat_interval => ${@repeat_interval},
							                         p_start_date      => to_date(${@start_date},'yyyy-mm-dd'),
							                         p_end_date        => to_date(${@end_date},'yyyy-mm-dd'),
							                         p_para_freq       => ${@para_freq},
							                         p_para_interval   => ${@para_interval},
							                         p_para_bymonth    => ${@para_bymonth},
							                         p_para_bymonthday => ${@para_bymonthday},
							                         p_para_byweekno   => ${@para_byweekno},
							                         p_para_byyearday  => ${@para_byyearday},
							                         p_para_byday      => ${@para_byday},
							                         p_para_bydate     => ${@para_bydate},
							                         p_para_byhour     => ${@para_byhour},
							                         p_para_byminute   => ${@para_byminute},
							                         p_para_bysecond   => ${@para_bysecond},
							                         p_para_include    => ${@para_include},
							                         p_para_exclude    => ${@para_exclude},
							                         p_para_intersect  => ${@para_intersect},
							                         p_user_id         => ${/session/@user_id},
							                         p_setup_mode      => ${@setup_mode});
				end;
    		]]></ns1:update-sql>
        </ns1:operation>
    </ns1:operations>
    <ns1:data-filters>
        <ns1:data-filter name="schedule_name" enforceOperations="query" expression="schedule_name=${@schedule_name}"/>
    </ns1:data-filters>
</ns1:model>
