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     */
016    package org.opengion.plugin.table;
017    
018    import org.opengion.hayabusa.common.HybsSystemException;
019    import org.opengion.hayabusa.db.AbstractTableFilter;
020    import org.opengion.hayabusa.db.DBTableModel;
021    import org.opengion.hayabusa.report2.QueueManager_DB;
022    
023    import java.util.Map;
024    
025    /**
026     * TableFilter_REPORTDATA は、TableFilter インターフェースを継承した、DBTableModel 処?の
027     * 実?ラスです?
028     *
029     * ここでは、指定された要?Oに対してGE51(帳票明細??タ)をGE52(帳票レイアウトテーブル)の定義に従って?
030     * ?し?DBTableModelを生成します?
031     *
032     * パラメータは、tableFilterタグの keys, vals にそれぞれ記述するか?BODY 部にCSS形式で記述します?
033     * 【パラメータ?
034     *  {
035     *       SYSTEM_ID  :  ;                検索対象となる?シス?ID(??)
036     *       LISTID     :  ;                検索対象となる?帳票ID(??)
037     *       YKNO       :  ;                検索対象となる?要求番号(??)
038     *       KBTEXT     :  ;                H(ヘッ??),F(フッター),B(ボディー)の?れかを指???)
039     *  }
040     *
041     * @og.formSample
042     * ●形式?
043     *      ?<og:tableFilter classId="REPORTDATA" keys="SYSTEM_ID,LISTID,YKNO,KBTEXT" vals="GF,GF0001,111100,B" />
044     *
045     *      ② <og:tableFilter classId="REPORTDATA" >
046     *               {
047     *                   SYSTEM_ID : GF ;
048     *                   LISTID    : GF0001 ;
049     *                   YKNO      : 111100 ;
050     *                   KBTEXT    : B ;
051     *               }
052     *         </og:tableFilter>
053     *
054     * @see org.opengion.hayabusa.report2.QueueManager_DB.DBTableModelCreator
055     * @og.rev 5.1.2.0 (2010/01/01) 新規作?
056     * @og.rev 5.6.6.0 (2013/07/05) keys の整合?チェ?を追?
057     *
058     * @version  0.9.0  2000/10/17
059     * @author   Hiroki Nakamura
060     * @since    JDK1.1,
061     */
062    public class TableFilter_REPORTDATA extends AbstractTableFilter {
063            //* こ?プログラ??VERSION??を設定します?       {@value} */
064            private static final String VERSION = "5.6.6.1 (2013/07/12)" ;
065    
066            /**
067             * keys の整合?チェ?を行うための初期設定を行います?
068             *
069             * @og.rev 5.6.6.1 (2013/07/12) keys の整合?チェ?対?
070             *
071             * @param       keysMap keys の整合?チェ?を行うための Map
072             */
073            @Override
074            protected void init( final Map<String,String> keysMap ) {
075                    keysMap.put( "SYSTEM_ID"        , "検索対象となる?シス?ID(??)"                                                       );
076                    keysMap.put( "LISTID"           , "検索対象となる?帳票ID(??)"                                                          );
077                    keysMap.put( "YKNO"                     , "検索対象となる?要求番号(??)"                                                         );
078                    keysMap.put( "KBTEXT"           , "H(ヘッ??),F(フッター),B(ボディー)の?れかを指???)"    );
079            }
080    
081            /**
082             * DBTableModel処?実行します?
083             *
084             * @og.rev 5.5.2.6 (2012/05/25) protected変数を?private化したため?getterメソ?で取得するよ?変更
085             *
086             * @return 処?果のDBTableModel
087             */
088            public DBTableModel execute() {
089                    String systemId = getValue( "SYSTEM_ID" );
090                    String listId   = getValue( "LISTID" );
091                    String ykno     = getValue( "YKNO" );
092                    String kbtext   = getValue( "KBTEXT" );
093    
094                    if( systemId == null || systemId.length() == 0
095                            || listId == null || listId.length() == 0
096                            || ykno == null || ykno.length() == 0
097                            || kbtext == null || kbtext.length() == 0 ) {
098                            String errMsg = "SYSTEM_ID,LISTID,YKNO,KBTEXTを?て?して下さ??";
099                            throw new HybsSystemException( errMsg );
100                    }
101    
102                    if( kbtext.length() > 1 || "HFB".indexOf( kbtext ) < 0 ) {
103                            String errMsg = "KBTEXTは、H(ヘッ??),F(フッター),B(ボディー)の?れかを指定して下さ?;
104                            throw new HybsSystemException( errMsg );
105                    }
106    
107                    QueueManager_DB.DBTableModelCreator creator
108    //                      = new QueueManager_DB.DBTableModelCreator( systemId, listId, ykno, kbtext, resource );
109                            = new QueueManager_DB.DBTableModelCreator( systemId, listId, ykno, kbtext, getResource() );             // 5.5.2.6 (2012/05/25)
110    
111                    return creator.getTable();
112            }
113    }