001/* 002 * Copyright (c) 2009 The openGion Project. 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, 013 * either express or implied. See the License for the specific language 014 * governing permissions and limitations under the License. 015 */ 016package org.opengion.plugin.table; 017 018import org.opengion.hayabusa.common.HybsSystemException; 019import org.opengion.hayabusa.db.AbstractTableFilter; 020import org.opengion.hayabusa.db.DBTableModel; 021import org.opengion.hayabusa.report2.QueueManager_DB; 022 023/** 024 * TableFilter_REPORTDATA は、TableFilter インターフェースを継承した、DBTableModel 処理用の 025 * 実装クラスです。 026 * 027 * ここでは、指定された要求NOに対してGE51(帳票明細データ)をGE52(帳票レイアウトテーブル)の定義に従って、 028 * 分割し、DBTableModelを生成します。 029 * 030 * パラメータは、tableFilterタグの keys, vals にそれぞれ記述するか、BODY 部にCSS形式で記述します。 031 * 【パラメータ】 032 * { 033 * SYSTEM_ID : 検索対象となる、システムID(必須) 034 * LISTID : 検索対象となる、帳票ID(必須) 035 * YKNO : 検索対象となる、要求番号(必須) 036 * KBTEXT : H(ヘッダー),F(フッター),B(ボディー)のいずれかを指定(必須) 037 * } 038 * 039 * @og.formSample 040 * ●形式: 041 * ① <og:tableFilter classId="REPORTDATA" keys="SYSTEM_ID,LISTID,YKNO,KBTEXT" vals="GF,GF0001,111100,B" /> 042 * 043 * ② <og:tableFilter classId="REPORTDATA" > 044 * { 045 * SYSTEM_ID : GF ; 046 * LISTID : GF0001 ; 047 * YKNO : 111100 ; 048 * KBTEXT : B ; 049 * } 050 * </og:tableFilter> 051 * 052 * @see org.opengion.hayabusa.report2.QueueManager_DB.DBTableModelCreator 053 * @og.rev 5.1.2.0 (2010/01/01) 新規作成 054 * @og.rev 5.6.6.0 (2013/07/05) keys の整合性チェックを追加 055 * 056 * @version 0.9.0 2000/10/17 057 * @author Hiroki Nakamura 058 * @since JDK1.1, 059 */ 060public class TableFilter_REPORTDATA extends AbstractTableFilter { 061 /** このプログラムのVERSION文字列を設定します。 {@value} */ 062 private static final String VERSION = "6.4.1.1 (2016/01/16)" ; 063 064 /** 065 * デフォルトコンストラクター 066 * 067 * @og.rev 6.4.1.1 (2016/01/16) keysMap を、サブクラスから設定させるように変更。 068 */ 069 public TableFilter_REPORTDATA() { 070 super(); 071 initSet( "SYSTEM_ID" , "検索対象となる、システムID(必須)" ); 072 initSet( "LISTID" , "検索対象となる、帳票ID(必須)" ); 073 initSet( "YKNO" , "検索対象となる、要求番号(必須)" ); 074 initSet( "KBTEXT" , "H(ヘッダー),F(フッター),B(ボディー)のいずれかを指定(必須)" ); 075 } 076 077 /** 078 * DBTableModel処理を実行します。 079 * 080 * @og.rev 5.5.2.6 (2012/05/25) protected変数を、private化したため、getterメソッドで取得するように変更 081 * 082 * @return 処理結果のDBTableModel 083 * @og.rtnNotNull 084 */ 085 public DBTableModel execute() { 086 final String systemId = getValue( "SYSTEM_ID" ); 087 final String listId = getValue( "LISTID" ); 088 final String ykno = getValue( "YKNO" ); 089 final String kbtext = getValue( "KBTEXT" ); 090 091 if( systemId == null || systemId.isEmpty() 092 || listId == null || listId.isEmpty() 093 || ykno == null || ykno.isEmpty() 094 || kbtext == null || kbtext.isEmpty() ) { // 6.1.0.0 (2014/12/26) refactoring 095 final String errMsg = "SYSTEM_ID,LISTID,YKNO,KBTEXTを全て指定して下さい。"; 096 throw new HybsSystemException( errMsg ); 097 } 098 099 if( kbtext.length() > 1 || "HFB".indexOf( kbtext ) < 0 ) { 100 final String errMsg = "KBTEXTは、H(ヘッダー),F(フッター),B(ボディー)のいずれかを指定して下さい"; 101 throw new HybsSystemException( errMsg ); 102 } 103 104 final QueueManager_DB.DBTableModelCreator creator 105 = new QueueManager_DB.DBTableModelCreator( systemId, listId, ykno, kbtext, getResource() ); // 5.5.2.6 (2012/05/25) 106 107 return creator.getTable(); 108 } 109}