<?xml version="1.0" encoding="UTF-8" ?>
<jsp:root
	xmlns:jsp="http://java.sun.com/JSP/Page"
	xmlns:og="hybs-taglib.tld" 
	version="2.0">
<jsp:directive.page language="java" contentType="text/html; charset=UTF-8" />

<og:head headType="result" />
<jsp:directive.include file="/jsp/custom/result_info.jsp" />
<og:comment
	system   = "GE:エンジンサンプル"
	pgid     = "REP08"
	title    = "帳票デーモン"
	date     = "2007/12/12"
	author   = "K.HASEGAWA"
	text     = "ZZZZ"
	version  = "001"
/>

<!-- period は、ｍｓ単位で指定する必要があるため、１０００倍しています。 -->
<og:schedule
	command		= "{@CMD}"
	scope		= "request"
	timerTask	= "org.opengion.plugin.daemon.Daemon_Report"
	name		= "{@NAME}"
	comment		= "Start-up By {@USER.INFO} BASE={@MODBASE} NO={@MODNO} PRT_GRP={@PRT_GRP}"
	singleton	= "true"
	delay		= "0"
	period		= "{@PERIOD}000"
	fixedDelay	= "true"
	keys		= "SYSTEM_ID,DMN_GRP,PRTID,PRT_GRP,MODBASE,MODNO,DEBUG"
	vals		= "{@SYSTEM_ID},{@DMN_GRP},{@PRTID},{@PRT_GRP},{@MODBASE},{@MODNO},{@DEBUG}"
/>

<!-- DB検索結果を表示させます。 -->
<og:view
	viewFormType = "HTMLTable" 
	command		= "{@command}" 
	scope		= "request"
	writable	= "false"
	checked		= "{@checked}"
	startNo		= "{@startNo}" 
	pageSize	= "{@pageSize}"  />

<!-- システムパラメータテーブル(GE12)への登録 -->
<!-- PARAM_ID を CONTEXT_INITIAL_CALL_URL_ で登録するとTomcat起動時に再実行されます。 -->
<og:equals val1="{@CMD}" val2="SET" >
	<og:value command="SQL">
	  <jsp:text>
		SELECT COUNT(*) AS CNT FROM GE12
			WHERE SYSTEM_ID = 'GE'
			AND   PARAM_ID = 'CONTEXT_INITIAL_CALL_URL_{@NAME}'
			AND   FGJ = '1'
			AND   CONTXT_PATH = '{@SYS.HOST_URL}'
	  </jsp:text>
	</og:value>

	<!-- 存在しなければ、追加 -->
	<og:equals val1="{@CNT}" val2="0" >
	  <og:query command="NEW" debug="{@debug}" maxRowCount="{@maxRowCount}">
		<jsp:text>
			INSERT INTO GE12
				(SYSTEM_ID,PARAM_ID,PARAM,PARAM_LVL,TITLE,CONTENTS,SEQNO,KBSAKU,
				 FGJ,DYSET,DYUPD,USRSET,USRUPD,PRGUPD,CONTXT_PATH)
			VALUES
				('GE','CONTEXT_INITIAL_CALL_URL_{@NAME}',
				'<og:link href="{@SYS.CONTEXT_URL}jsp/REP08/result.jsp" hrefOnly="true" useGamenId="false"
					keys="command,SYSTEM_ID,DMN_GRP,CMD,NAME,PERIOD"
					vals="NEW,{@SYSTEM_ID},{@DMN_GRP},SET,{@NAME},{@PERIOD}" />',
				 '7','','','1000','1',
				 '1','{@USER.YMDH}','{@USER.YMDH}','{@USER.ID}','{@USER.ID}','{@GUI.KEY}','{@SYS.HOST_URL}')
		</jsp:text>
	  </og:query>
	</og:equals>
</og:equals>

<!-- キャンセル時は、全件削除します。 -->
<og:equals val1="{@CMD}" val2="CANCEL" >
	<og:query command="NEW" debug="{@debug}" maxRowCount="{@maxRowCount}">
	  <jsp:text>
		DELETE FROM GE12
			WHERE SYSTEM_ID = 'GE'
			AND   PARAM_ID like 'CONTEXT_INITIAL_CALL_URL_%'
			AND   FGJ = '1'
			AND   CONTXT_PATH = '{@SYS.HOST_URL}'
	  </jsp:text>
	</og:query>
</og:equals>

<!-- リムーブ時は、特定のタスク名称で削除します。 -->
<og:equals val1="{@CMD}" val2="REMOVE" >
	<og:query command="NEW" debug="{@debug}" maxRowCount="{@maxRowCount}">
	  <jsp:text>
		DELETE FROM GE12
			WHERE SYSTEM_ID = 'GE'
			AND   PARAM_ID = 'CONTEXT_INITIAL_CALL_URL_{@NAME}'
			AND   FGJ = '1'
			AND   CONTXT_PATH = '{@SYS.HOST_URL}'
	  </jsp:text>
	</og:query>
</og:equals>

<jsp:directive.include file="/jsp/common/htmlend.jsp" />
</jsp:root>
