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

<og:head headType="init" />
<og:comment
	system   = "GE:エンジンサンプル"
	pgid     = "GE0020"
	title    = "画面/ロール"
	date     = "2007/12/12"
	author   = "K.HASEGAWA"
	text     = "ZZZZ"
	version  = "001"
/>

<!-- history.back() で戻るボタンを表示します。	-->
<jsp:directive.include file="/jsp/common/history_back.jsp" />

<og:columnCheck command="{@command}" />
<og:entry command="{@command}" />

<og:equals val1="{@direct}" nullCheck="true">
	<og:value command = "SETTBL" key = "GUIKEY" separator="','" action = "APPEND"/>

	<og:tableUpdate
		command			= "{@command}"
		queryType		= "JDBCTableUpdate"
		commitTableModel= "false"
		selectedAll		= "true">
			update GEA11 set
			ROLES = '__'
			where SYSTEM_ID = [SYSTEM_ID]
			and GUIKEY = [GUIKEY]
			and FGJ = '1'
			and GUIKEY in ('{@GUIKEY}')
	</og:tableUpdate>

	<og:tableFilter classId="ROTATE" selectedAll="true"
		keys="ROTATE_CLM,KEY_CLM,VALUE_CLM,REVERSE" vals='TMP_ROLE,"WRITABLE,SYSTEM_ID,GUIKEY,NAME_JA,ROLES,UNIQ",IS_CHECK,true' />

	<og:tableUpdate
		command			= "{@command}"
		queryType		= "JDBCTableUpdate"
		selectedAll		= "true">
			update GEA11 set
			ROLES = case
				when [IS_CHECK] = '0' then ROLES
				when [IS_CHECK] = '1' and ROLES = '__' then SUBSTR([TMP_ROLE],5)
				else ROLES{@DBF.CON}'|'{@DBF.CON}SUBSTR([TMP_ROLE],5) end
			,DYUPD = '{@USER.YMDH}'
			,USRUPD = '{@USER.ID}'
			,PGUPD = '{@GUI.KEY}'
			where SYSTEM_ID = [SYSTEM_ID]
			and GUIKEY = [GUIKEY]
			and FGJ = '1'
			and GUIKEY in ('{@GUIKEY}')
	</og:tableUpdate>

	<og:value command = "REMOVE" key = "GUIKEY" />
</og:equals>

<og:equals val1="{@direct}" nullCheck="true" notEquals="true">
	<og:tableUpdate
		command			= "{@command}"
		queryType		= "JDBCTableUpdate">
			update GEA11 set
			ROLES = [ROLES]
			,DYUPD = '{@USER.YMDH}'
			,USRUPD = '{@USER.ID}'
			,PGUPD = '{@GUI.KEY}'
			where SYSTEM_ID = [SYSTEM_ID]
			and GUIKEY = [GUIKEY]
			and FGJ = '1'
	</og:tableUpdate>
</og:equals>

<og:forward page="result.jsp" keys="command" vals="RENEW" />

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