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.hayabusa.taglib;
017    
018    import static org.opengion.fukurou.util.StringUtil.nval;
019    
020    import java.util.ArrayList;
021    import java.util.List;
022    
023    import org.opengion.fukurou.util.ErrorMessage;
024    import org.opengion.hayabusa.common.HybsSystem;
025    import org.opengion.hayabusa.common.HybsSystemException;
026    import org.opengion.hayabusa.db.DBTableModel;
027    import org.opengion.hayabusa.db.Query;
028    import org.opengion.hayabusa.resource.GUIInfo;
029    
030    /**
031     * SQLæ–?‚’直接æŒ?®šして、データベã?スに追åŠ?更新/削除を行いまã�?queryType="JDBCTableUpdate")ã€?
032     *
033     * 存在チェãƒ?‚¯を行う場合ã?、tableExist タグと併用してくださいã€?
034     * è¤?›‘な処ç�?�Œå¿?¦�な場合ã?、従来より使用してã�?�¾すã?PLSQLをCALLするã€?
035     * plsqlUpdateタグを使用してくださいã€?
036     * またã?tableUpdateParam タグを使用する事で、テーブル名とsqlTypeのæŒ?®šで動的に
037     * SQLæ–?‚’自動生成できますã?これにより、追åŠ??更新、削除ã‚?ƒ†ーブルに関してã€?
038     * 単ä¸??JSP画面ですべて対応できるようになりますã?
039     *
040     * ※ こã?タグは、Transaction タグの対象ですã?
041     *
042     * @og.formSample
043     * ●形式ï¼?lt;og:tableUpdate command="…" names="…" queryType="JDBCTableUpdate" >
044     *             {@SQL}
045     *         </og:update>
046     * ●body?šあã‚?EVAL_BODY_BUFFERED:BODYを評価しã?{@XXXX} を解析しまã�?
047     *
048     * ●Tag定義??
049     *   <og:tableUpdate
050     *       queryType          【TAG】Query を発行する為のクラスIDを指定しまã�?{@og.doc03Link queryType 初期値:JDBCTableUpdate})
051     *       sqlType            【TAG】BODY部に書かれてã�?‚‹ Param の SQLタイプをæŒ?®šしまã�?
052     *       command            【TAG】コマンãƒ?NEW,RENEW)をセãƒ?ƒˆしまã�?PlsqlUpdateTag,UpdateTag の場合ã?、ENTRY)
053     *       scope              【TAG】キャãƒ?‚·ュする場合ã?スコープ[request/page/session/applicaton]を指定しまã�?初期値:session)
054     *       displayMsg         【TAG】検索結果を画面上に表示するメãƒ?‚»ージリソースIDを指定しまã�?(初期値:VIEW_DISPLAY_MSG[=])
055     *       resourceType       【特殊ã?クリアするリソースの種類[GEA03/GEA04/GEA08]を指定しまã�?
056     *       conditionKey       【TAG】条件判定するカラãƒ?¼©?¤を指定しまã�?初期値:null)
057     *       conditionList      【TAG】条件判定するå?のリストをã€?|"で区åˆ?�£て登録しまã�?初期値:無条件)
058     *       tableId            【TAGã€?通常は使ã�?�¾せん)結果のDBTableModelをã?sessionに登録するときã?キーを指定しまã�?
059     *       dbid               【TAGã€?通常は使ã�?�¾せん)Queryオブジェクトを作æ?する時ã?DB接続IDを指定しまã�?
060     *       selectedAll        【TAG】データをå?件選択済みとして処ç�?�™るかどã�?�‹[true/false]を指定しまã�?初期値:false)
061     *       commitTableModel   【特殊ã?SQL実行後に結果をDBTableModelに反映させるかどã�?�‹[true/false]を指定しまã�?初期値:true)
062     *       followCdkh         【TAG】DBTableModelの改廃Cに従って処ç�?‚’行うかをæŒ?®šしまã�?
063     *       quotCheck          【TAG】リクエスト情報の クォーãƒ?‚£ション(') 存在チェãƒ?‚¯を実施するかどã�?�‹[true/false]を設定しまã�?初期値:false)
064     *       debug              【TAG】デバッグæƒ??をå?力するかどã�?�‹[true/false]を指定しまã�?初期値:false)
065     *   >   ... Body ...
066     *   </og:tableUpdate>
067     *
068     * ●使用ä¾?
069     *    ・QUERYを他ã?JSPから渡すå?å�?
070     *    【copy.jspã€?
071     *        <og:hidden name="SQL" >
072     *          INSERT INTO GE41
073     *               (CLM,NAME_JA,LABEL_NAME,KBSAKU,SYSTEM_ID,LANG,
074     *               FGJ,DYSET,DYUPD,USRSET,USRUPD,PGUPD)
075     *          VALUES
076     *               ([CLM],[NAME_JA],[LABEL_NAME],[KBSAKU],[SYSTEM_ID],[LANG],
077     *               '1','{@USER.YMDH}','{@USER.YMDH}','{@USER.ID}','{@USER.ID}','{@GUI.KEY}')
078     *        </og:value>
079     *
080     *    【entry.jspã€?
081     *        <og:tableUpdate
082     *            command   = "{@command}"
083     *            queryType = "JDBCTableUpdate"
084     *        {@SQL}
085     *        </og:tableUpdate>
086     *
087     *    ・tableUpdateParamを使用する場å�?
088     *    【entry.jspã€?
089     *        <og:tableUpdate
090     *            command   = "{@command}"
091     *            queryType = "JDBCTableUpdate"
092     *            sqlType   = "{@sqlType}"        // tableUpdateParam の sqlType とä¸??
093     *        >
094     *            <og:tableUpdateParam
095     *                sqlType     = "{@sqlType}"       // INSERT,COPY,UPDATE,MODIFY,DELETE
096     *                table       = "{@TABLE_NAME}"    // 処ç�?¯¾象のãƒ??ブルå�?
097     *                names       = "{@names}"         // 処ç�?¯¾象のカラãƒ?��
098     *                omitNames   = "{@omitNames}"     // 処ç�?¯¾象外ã?カラãƒ?��
099     *                where       = "{@where}"         // 処ç�?¯¾象を特定するキー
100     *                constKeys   = "{@constKeys}"     // 処ç�?‚«ラãƒ?��の中の固定情報カラãƒ?��
101     *                constVals   = "{@constVals}"     // 処ç�?‚«ラãƒ?��の中の固定情報設定å?
102     *            />
103     *        </og:tableUpdate>
104     *
105     *    ・処ç�??可否を指定するå?å�?
106     *    【entry.jspã€?
107     *        <og:tableUpdate
108     *            command   = "{@command}"
109     *            queryType = "JDBCTableUpdate"
110     *            conditionKey  ="…"      : 条件判定するカラãƒ?¼©?¤を指å®?初期値は columnId )
111     *            conditionList ="…"      : 条件判定するå?のリストをã€?|"で区åˆ?�£て登録(初期値は、無条件)
112     *        {@SQL}
113     *        </og:tableUpdate>
114     *
115     * @og.rev 3.8.8.0 (2007/12/22) 新規作æ?
116     * @og.group ?¤?¢登録
117     *
118     * @version  4.0
119     * @author   Kazuhiko Hasegawa
120     * @since    JDK5.0,
121     */
122    public class TableUpdateTag extends QueryTag {
123            //* こã?プログラãƒ??VERSIONæ–?­—å?を設定しますã?       {@value} */
124            private static final String VERSION = "5.1.7.0 (2010/06/01)" ;
125    
126            private static final long serialVersionUID = 517020100601L ;
127    
128            /** command 引数に渡す事ã?出来ã‚?コマンãƒ? 登録{@value} */
129            public static final String CMD_ENTRY  = "ENTRY" ;
130            /** command 引数に渡す事ã?出来ã‚?コマンãƒ?リスãƒ? */
131            private static final String COMMAND_LIST = CMD_ENTRY;
132    
133            // 処ç�?‚’行う、リソースの種類をæŒ?®šしますã?(GEA03,GEA04,GEA08 のどれか)
134            private String  sqlType                 = null;         // INSERT,COPY,UPDATE,MODIFY,DELETE
135            private String  resourceType    = null;
136            private int             resTypeColNo    = -1;
137            private String  conditionKey    = null;         // 条件判定するカラãƒ?¼©?¤を指å®?初期値は columnId )
138            private String  conditionList   = null;         // 条件判定するå?のリストをã€?|"で区åˆ?�£て登録(初期値は、無条件)
139            private boolean selectedAll             = false;
140            private boolean commitTableModel= true;         // 4.0.2.0 (2007/12/25)
141            private boolean followCdkh              = false;        // 4.3.2.0 (2008/09/09).
142            private boolean quotCheck               = false;        // 5.1.7.0 (2010/06/01) quotCheckを指定できるようにする。â?ä½?�—、å?期å?はfalse固定ã?タイミングを見て修正è¦?
143    
144            /**
145             * Taglibの開始タグが見つかったときに処ç�?�™ã‚?doStartTag() ã‚?オーバã?ライドしますã?
146             *
147             * @og.rev 4.0.0.0 (2007/11/14) 0件の場合でもstartQueryTransactionをé?すよã�?�«変更
148             * @og.rev 5.1.7.0 (2010/06/01) quotCheckを指定できるようにする。â?ä½?�—、å?期å?はfalse固定ã?
149             *
150             * @return      後続å?ç�??æŒ?¤º( EVAL_BODY_BUFFERED )
151             */
152            @Override
153            public int doStartTag() {
154                    dyStart = System.currentTimeMillis();
155                    table = (DBTableModel)getObject( tableId );
156                    startQueryTransaction( tableId );               // 4.0.0.0 (2007/11/14) 0件の場合でもdoEndでPAGE_SKIPしなã�?‚ˆã�?�«位置変更ã€?
157                    if( table == null || table.getRowCount() == 0 ||
158                            ! check( command, COMMAND_LIST ) ) { return(SKIP_BODY); }
159    //              startQueryTransaction( tableId );               // 3.6.0.8 (2004/11/19)
160    //              quotCheck = false;              // こã?タグでは、クオートチェãƒ?‚¯は行いませんã€?
161                    super.quotCheck = quotCheck;
162    
163                    return( EVAL_BODY_BUFFERED );   // Body を評価するã€? extends BodyTagSupport æ™?
164            }
165    
166            /**
167             * Taglibの終äº?‚¿グが見つかったときに処ç�?�™ã‚?doEndTag() ã‚?オーバã?ライドしますã?
168             *
169             * @og.rev 4.0.0.0 (2007/10/18) メãƒ?‚»ージリソース統å�? getResource().getMessage â‡?getResource().getLabel )
170             *
171             * @return      後続å?ç�??æŒ?¤º
172             */
173            @Override
174            public int doEndTag() {
175                    debugPrint();
176    
177    //              String label = HybsSystem.BR;                           // 検索しなかったå?合ã?
178                    String label  = "";                             // 4.0.0 (2005/11/30) 検索しなかったå?合ã?
179                    if( check( command, COMMAND_LIST ) ) {
180                            StringBuilder buf = new StringBuilder( HybsSystem.BUFFER_SMALL );
181                            if( executeCount > 0 && displayMsg != null && displayMsg.length() > 0 ) {
182                                    buf.append( executeCount );
183    //                              buf.append( getResource().getMessage( displayMsg ) );
184                                    buf.append( getResource().getLabel( displayMsg ) );
185                                    buf.append( HybsSystem.BR );
186                            }
187    
188                            String err = TaglibUtil.makeHTMLErrorTable( errMessage,getResource() );
189                            if( err != null && err.length() > 0 ) {
190    //                              if( errCode >= ErrorMessage.NG ) {           // 異常の場å�?
191    //                                      label = err ;
192    //                              }
193                                    buf.append( err );
194                                    setSessionAttribute( errMsgId,errMessage );
195                            }
196                            else {
197                                    removeSessionAttribute( errMsgId );
198                            }
199                            label = buf.toString();
200    
201                            if( table != null && ! commitTableObject( tableId, table )  ) {
202                                    // 3.6.0.8 (2004/11/19) トランザクションチェãƒ?‚¯を行いますã?
203                                    jspPrint( "TableUpdateTag Query処ç�?�Œ割り込まれましたã€?BTableModel は登録しませんã€? );
204                                    return (SKIP_PAGE);
205                            }
206                    }
207    
208                    jspPrint( label );
209    
210                    // 警告時に停止してã�?�¾したがã?継続å?ç�?�•せますã?
211    //              int rtnCode = EVAL_PAGE;
212    //              if( errCode >= ErrorMessage.NG )  {  // 異常
213    //                      rtnCode = SKIP_PAGE;
214    //              }
215    //              else {
216    //                      rtnCode = EVAL_PAGE;
217    //              }
218    
219                    long dyTime = System.currentTimeMillis()-dyStart;
220                    jspPrint( "<div id=\"queryTime\" value=\"" + (dyTime) + "\"></div>" );      // 3.5.6.3 (2004/07/12)
221    
222                    // セキュリãƒ?‚£チェãƒ?‚¯(ãƒ??タアクセス件数登録)
223                    GUIInfo guiInfo = (GUIInfo)getSessionAttribute( HybsSystem.GUIINFO_KEY );
224                    if( guiInfo != null ) { guiInfo.addWriteCount( executeCount,dyTime,sql ); }
225    
226                    int rtnCode = ( errCode >= ErrorMessage.NG ) ? SKIP_PAGE : EVAL_PAGE ;
227                    return( rtnCode );
228            }
229    
230            /**
231             * タグリブオブジェクトをリリースしますã?
232             * キャãƒ?‚·ュされて再利用されるã?で、フィールドã?初期設定を行いますã?
233             *
234             * @og.rev 4.0.2.0 (2007/12/25) commitTableModel追åŠ?
235             * @og.rev 4.1.2.0 (2008/03/12) sqlType追åŠ?
236             * @og.rev 5.1.7.0 (2010/06/01) quotCheckを指定できるようにする。â?ä½?�—、å?期å?はfalse固定ã?
237             *
238             */
239            @Override
240            protected void release2() {
241                    super.release2();
242                    sqlType                 = null;         // INSERT,COPY,UPDATE,MODIFY,DELETE
243                    resourceType    = null;
244                    resTypeColNo    = -1;
245                    conditionKey    = null;         // 条件判定するカラãƒ?¼©?¤を指å®?初期値は columnId )
246                    conditionList   = null;         // 条件判定するå?のリストをã€?|"で区åˆ?�£て登録(初期値は、無条件)
247                    selectedAll             = false;
248                    commitTableModel= true;         // 4.0.2.0 (2007/12/25)
249                    followCdkh              = false;        // 4.3.2.0 (2008/09/09)
250                    quotCheck               = false;        // 5.1.7.0 (2010/06/01)
251            }
252    
253            /**
254             * Query を実行しますã?
255             *
256             * @og.rev 4.0.2.0 (2007/12/25) commitTableModel追åŠ?
257             *
258             * @param   query オブジェクãƒ?
259             */
260            @Override
261            protected void execute( final Query query ) {
262    
263                    try {
264                            int[] rowNo = getParameterRows();               // 4.0.0 (2005/01/31)
265                            if( rowNo.length > 0 ) {
266                                    query.execute( rowNo,table );
267    
268                                    errCode = query.getErrorCode();
269                                    errMessage = query.getErrorMessage();
270    
271                                    // リソースクリア処ç�?
272                                    if( resourceType != null ) {
273    //                                      if( "GEA09".equals( resourceType ) ) {
274    //                                              resTypeColNo = table.getColumnNo( "MSGCD" );    // キーは、MSGCD
275    //                                      }
276    //                                      else {
277                                            resTypeColNo = table.getColumnNo( "CLM" );              // キーは、CLM
278    //                                      }
279                                    }
280    
281                                    // é€??にDELETEしなã�?�¨、行番号がずれてしまã�??
282                                    int row;
283                                    for( int j=rowNo.length-1; j>=0; j-- ) {
284                                            row = rowNo[j];
285                                            if( resTypeColNo >= 0 ) {
286                                                    clearResourceData( table.getValue( row,resTypeColNo ) );                // リソースのクリア
287                                            }
288    
289                                            if( commitTableModel ) { // 4.0.2.0 (2007/12/25)
290                                                    if( DBTableModel.DELETE_TYPE.equals( table.getModifyType( row ) ) ) {
291                                                            table.removeValue( row );
292                                                    }
293                                                    else {
294                                                            table.resetModify( row );
295                                                    }
296                                            }
297                                    }
298    //                              if( query.getUpdateFlag() ) { query.commit(); }
299                                    if( query.isUpdate() ) { query.commit(); }
300                            }
301                    }
302                    finally {
303                            if( query != null ) { query.close(); }
304                    }
305            }
306    
307            /**
308             * 表示ãƒ??タの HybsSystem.ROW_SEL_KEY をå?にã€?�¸ばれた 行番号の
309             * 配å?を返しますã?
310             * ここでは、conditionKey に値が設定されてã�?‚‹場合ã?、そのカラãƒ??値ã�?
311             * conditionList にマッチするå?合ã?み対象選択行として返しますã?
312             * 値がセãƒ?ƒˆされてã�?�ªã�??合ã?ã€??常のCommonTagSupport#getParameterRows()
313             * が呼ばれますã?
314             * なにも選ばれてã�?�ªã�??合ã?、サイズ?�ã?配å?を返しますã?
315             *
316             * @og.rev 4.3.2.0 (2008/09/09) followCdkh属æ?対å¿?
317             *
318             * @return       (選ばれてã�?�ªã�??合ã?、サイズ?�ã?配å?を返す)
319             */
320            @Override
321            protected int[] getParameterRows() {
322                    int[] rowNo ;
323                    if( selectedAll ) {
324                            int rowCnt = table.getRowCount();               // 3.5.5.7 (2004/05/10)
325                            rowNo = new int[ rowCnt ];
326                            for( int i=0; i<rowCnt; i++ ) {
327                                    rowNo[i] = i;
328                            }
329                    } else {
330                            rowNo = super.getParameterRows();               // 4.0.0 (2005/01/31)
331                    }
332    
333                    if( conditionKey != null ) {
334                            int col = table.getColumnNo( conditionKey );
335                            List<Integer> list = new ArrayList<Integer>();
336                            for( int i=0; i<rowNo.length; i++ ) {
337                                    String val = "|" + table.getValue( rowNo[i],col ) + "|";
338                                    if( conditionList.indexOf( val ) >= 0 ) {
339                                            list.add( Integer.valueOf( rowNo[i] ) );
340                                    }
341                            }
342    
343                            int size = list.size();
344                            rowNo = new int[size];
345                            for( int i=0; i<size; i++ ) {
346                                    rowNo[i] = (list.get(i)).intValue();
347                            }
348                    }
349    
350                    // 4.3.2.0 (2008/09/09)
351                    if( sqlType != null && sqlType.length() > 0 && followCdkh ) {
352                            List<Integer> flist = new ArrayList<Integer>();
353                            for( int i=0; i<rowNo.length; i++ ) {
354                                    String cdkh = table.getModifyType( rowNo[i] );
355                                    if( ( ( "INSERT".equals( sqlType ) || "COPY".equals( sqlType ) )
356                                                            && DBTableModel.INSERT_TYPE.equals( cdkh ) )
357                                            ||
358                                            ( ( "UPDATE".equals( sqlType ) || "CHANGE".equals( sqlType ) )
359                                                            && DBTableModel.UPDATE_TYPE.equals( cdkh ) )
360                                            ||
361                                            ( ( "DELETE".equals( sqlType ) )
362                                                            && DBTableModel.DELETE_TYPE.equals( cdkh ) ) ) {
363                                            flist.add(  Integer.valueOf( rowNo[i] ) );
364                                    }
365                            }
366    
367                            int size = flist.size();
368                            rowNo = new int[size];
369                            for( int i=0; i<size; i++ ) {
370                                    rowNo[i] = (flist.get(i)).intValue();
371                            }
372                    }
373    
374                    return rowNo;
375            }
376    
377            /**
378             * 【TAG】Query を発行する為のクラスIDを指定しまã�?{@og.doc03Link queryType 初期値:JDBCTableUpdate})ã€?
379             *
380             * @og.tag
381             * 引数æŒ?®šã?INSERT/UPDATEæ–?‚’実行するå?合ã?、queryType 属æ?を使用しますã?
382             * こã?タグでは、execute( int[] ,DBTableModel )を実行しますã?
383             * 代表çš?�ªクラスとしてã€?JDBCTableUpdate" が標準で用意されてã�?�¾すã?
384             *
385             * タグにより使用できる?�å?来なã�?�Œありますが、これã?、org.opengion.hayabusa.db
386             * 以下ã? Query_**** クラスの **** を与えますã?
387             * これらã?、Query インターフェースを継承したサブクラスですã?
388             * {@og.doc03Link queryType Query_**** クラス}
389             *
390             * @param       id Query を発行する為の実クラス ID
391             * @see         org.opengion.hayabusa.db.Query  Queryのサブクラス
392             * @see         org.opengion.hayabusa.db.Query#execute( int[] ,DBTableModel )
393             */
394            @Override
395            public void setQueryType( final String id ) {
396                    super.setQueryType( nval( id,"JDBCTableUpdate" ) );
397            }
398    
399            /**
400             * resourceType が設定されたときã?み使用されるã?キャãƒ?‚·ュの初期化メソãƒ?ƒ‰ですã?
401             *
402             * @param       key     初期化を行うキー
403             */
404            private void clearResourceData( final String key ) {
405                    getResource().clear( key );
406            }
407    
408            /**
409             * 【特殊ã?クリアするリソースの種類[GEA03/GEA04/GEA08]を指定しますã?
410             *
411             * @og.tag
412             * 注意:この属æ?は、リソース関連DBのメンãƒ?ƒŠンス時にのみ、å?部リソースキャãƒ?‚·ュã‚?
413             * クリアする目çš?�§使用しますã?ä¸?ˆ¬の属æ?としては、使用することはなã�?�Ÿめã?
414             * ご注意くã�?�•ã�??
415             * リソース関連のãƒ??ブルを更新した場合ã?リソースキャãƒ?‚·ュをクリアして
416             * 置かなã�?�¨、データベã?スの値が反æ˜?�•れませんã€?
417             * 昔ã?、リソースの更新ごとに、å?件クリアしてã�?�¾したがã?部åˆ?‚¯リアã�?
418             * できるようになったためã?部åˆ?‚¯リアを行いますã?
419             * こではã€?GEA03,GEA04,GEA08) のどれかを指定してくださいã€?
420             *
421             * @param       type    クリアするリソースタイãƒ?[GEA03/GEA04/GEA08]
422             */
423            public void setResourceType( final String type ) {
424                    resourceType = nval( getRequestParameter(type),resourceType );
425    
426                    if( resourceType != null &&
427    //                      "|GEA03|GEA04|GEA08|GEA09|".indexOf( "|" + resourceType + "|" ) < 0 ) {
428    //                              String errMsg = "resourceTypeは GEA03,GEA04,GEA08,GEA09 のどれかですã?"
429    //                                                      + "resourceType=" + type ;
430                            "|GEA03|GEA04|GEA08|".indexOf( "|" + resourceType + "|" ) < 0 ) {
431                                    String errMsg = "resourceTypeは GEA03,GEA04,GEA08 のどれかですã?"
432                                                            + "resourceType=" + type ;
433                                    throw new HybsSystemException( errMsg );
434                    }
435            }
436    
437            /**
438             * 【TAG】条件判定するカラãƒ?¼©?¤を指定しまã�?初期値:null)ã€?
439             *
440             * @og.tag
441             * æŒ?®šã?カラãƒ?¼©?¤の値と、conditionList の値を比è¼?�—てã€?
442             * 存在する場合ã?、Query 処ç�?‚’実行しますã?
443             * 例えば、conditionKey="CDKH" として、conditionList="A" とすればã€?
444             * 改å»?‚³ードが"A"のãƒ??タで、かつ選択されたãƒ??タのみをå?ç�?�—ますã?
445             * 設定しなã�??合ã?ã€??常の処ç�?�¨同様にã€?�¸択行ã?み処ç�?�•れますã?
446             *
447             * @param       key 条件判定するカラãƒ?¼©?¤
448             * @see         #setConditionList( String )
449             */
450            public void setConditionKey( final String key ) {
451                    conditionKey = nval( getRequestParameter( key ),null ) ;
452            }
453    
454            /**
455             * 【TAG】条件判定するå?のリストをã€?|"で区åˆ?�£て登録しまã�?初期値:無条件)ã€?
456             *
457             * @og.tag
458             * conditionKey とペアでæŒ?®šしますã?ここには、カラãƒ??設定å?のリストを
459             * æŒ?®šすることで、è¤?•°条件(?¯?²結合)での比è¼?‚’行い、リストにカラãƒ??ã�?
460             * 存在する場合ã?み、Query 処ç�?‚’実行しますã?
461             * 値が設定されてã�?‚‹場合ã?、その値とマッチするå¿?¦�がありますã?なにもセãƒ?ƒˆ
462             * されなã�??合ã?またã?、null の場合ã?、null ãƒ??タとマッチするå?合ã?み処ç�?
463             * されますã?で、ご注意くã�?�•ã�??
464             *
465             * @param       list    値のリスãƒ?"|"区åˆ?
466             * @see         #setConditionKey( String )
467             */
468            public void setConditionList( final String list ) {
469                    conditionList = "|" + nval( getRequestParameter( list ),"" ) + "|" ;
470            }
471    
472            /**
473             * 【TAG】データをå?件選択済みとして処ç�?�™るかどã�?�‹[true/false]を指定しまã�?初期値:false)ã€?
474             *
475             * @og.tag
476             * 全てのãƒ??タを選択済みãƒ??タとして扱って処ç�?�—ますã?
477             * 全件処ç�?�™るå?合にã€?true/false)を指定しますã?
478             * 初期値は false ですã?
479             *
480             * @param  all ãƒ??タをå?件選択済み [true:全件選択済み/false:通常]
481             */
482            public void setSelectedAll( final String all ) {
483                    selectedAll = nval( getRequestParameter( all ),selectedAll );
484            }
485    
486            /**
487             * 【特殊ã?SQL実行後に結果をDBTableModelに反映させるかどã�?�‹[true/false]を指定しまã�?初期値:true)ã€?
488             *
489             * @og.tag
490             * 注意:この属æ?は、リソース関連DBのメンãƒ?ƒŠンス時に、è¤?•°DBへの登録を行うためのã€?
491             * 暫定対応として定義してã�?�¾すã?
492             * falseにした場合ã?、実データとDBTableModelの整合æ?が取れなくなるためã?使用には十å?注して下さã�??
493             * 初期値は true ですã?
494             *
495             * @og.rev 4.0.2.0 (2007/12/25) 新規作æ?
496             *
497             * @param  commitTblMdl ãƒ??ブルモãƒ?ƒ«へ反映する [true:反映する/false:反映しない]
498             */
499            public void setCommitTableModel( final String commitTblMdl ) {
500                    commitTableModel = nval( getRequestParameter( commitTblMdl ),commitTableModel );
501            }
502    
503            /**
504             * 引数の名称配å?
505             *
506             * @return      名称配å?
507             */
508            protected String[] getNames() {
509                    return table.getNames() ;
510            }
511    
512            /**
513             * 【TAG】BODY部に書かれてã�?‚‹ Param の SQLタイプをæŒ?®šしますã?
514             *
515             * @og.tag
516             * TableUpdateParamTag は、上位ã? TableUpdateTag の sqlType 属æ? と同じ
517             * sqlType 属æ?の場合ã?み、SQLæ–?‚’合æ?・出力しますã?
518             * つまりã?TableUpdateTag側のsqlType 属æ?をパラメータに、TableUpdateParamTag
519             * の sqlType 属æ?を固定å?にすることで、どのパラメータを使用するかを
520             * 選択できる機è?を実現する事が可能ですã?
521             *
522             * @og.rev 4.1.2.0 (2008/03/12) 新規追åŠ?
523             *
524             * @param       type BODY部に書かれてã�?‚‹ SQL タイãƒ?
525             */
526            public void setSqlType( final String type ) {
527                    sqlType = nval( getRequestParameter( type ),sqlType );
528            }
529    
530            /**
531             * 【TAG】DBTableModelの改廃Cに従って処ç�?‚’行うかをæŒ?®šしますã?
532             *
533             * @og.tag
534             * こã?属æ?は、sqlTypeが指定されてã�?‚‹場合ã?み有効ですã?
535             * sqlTypeが指定されてã�?‚‹場合ã?そã?sqlTypeに対応したã?改廃Cが設定されてã�?‚‹
536             * 行ã?みをå?ç�?�—ますã?
537             * 対応関係ã?、以下ã?通りですã?
538             *  sqlType = "INSERT" or "COPY" â‡?改廃C='A'のみ処ç�?
539             *  sqlType = "UPDATE" or "CHANGE" â‡?改廃C='C'のみ処ç�?
540             *  sqlType = "DELETE" â‡?改廃C='D'のみ処ç�?
541             *
542             * @og.rev 4.3.2.0 (2008/09/09) 新規追åŠ?
543             *
544             * @param       flg DBTableModelの改廃Cに従って処ç�?‚’行うã�?
545             */
546            public void setFollowCdkh( final String flg ) {
547                    followCdkh = nval( getRequestParameter( flg ),followCdkh );
548            }
549    
550            /**
551             * 【TAG】リクエスト情報の クォーãƒ?‚£ション(') 存在チェãƒ?‚¯を実施するかどã�?�‹[true/false]を設定しまã�?初期値:false)ã€?
552             *
553             * @og.tag
554             * ?³?±?¬インジェクション対策ã?ä¸?�¤として、暫定的ではありますが、SQLのパラメータに
555             * 渡す文字å?にクォーãƒ?‚£ション(') を許さなã�?¨­定にすれば、ある程度は防止できますã?
556             * 数字タイプã?引数にはã€?or 5=5 などのクォーãƒ?‚£ションを使用しなã�?‚³ードを埋めてもã?
557             * 数字チェãƒ?‚¯で検å?可能ですã?æ–?­—タイプã?場合ã?、å¿?�š (')をã?ずしてã€?
558             * ' or 'A' like 'A のような形式になる為ã€?')チェãƒ?‚¯ã�?�‘でも有効ですã?
559             * (') が含まれてã�?�Ÿエラーにする(true)?�かノã?チェãƒ?‚¯ã�?false)を指定しますã?
560             * ※(他ã?タグは、シスãƒ?ƒ リソースのUSE_SQL_INJECTION_CHECK[={@og.value org.opengion.hayabusa.common.SystemData#USE_SQL_INJECTION_CHECK}])
561             * ですが、JSPの互換性をè?慮しã?初期値を固定でfalseにしてã�?�¾ã�?
562             *
563             * @og.rev 5.1.7.0 (2010/06/01) 新規追åŠ?
564             *
565             * @param   flag クォーãƒ?‚£ションチェãƒ?‚¯ [true:する/それ以å¤?しない]
566             */
567            @Override
568            public void setQuotCheck( final String flag ) {
569                    quotCheck = nval( getRequestParameter( flag ),quotCheck );
570            }
571    
572            /**
573             * SQLタイプを返しますã?
574             *
575             * @og.rev 4.1.2.0 (2008/03/12) 新規追åŠ?
576             *
577             * @return      SQLタイãƒ?
578             */
579            protected String getSqlType() {
580                    return sqlType ;
581            }
582    
583            /**
584             * こã?オブジェクトã?æ–?­—å?表現を返しますã?
585             * 基本çš?�«ãƒ?ƒ�ãƒ?‚°目çš?�«使用しますã?
586             *
587             * @og.rev 4.0.2.0 (2007/12/25) resourceColumn、commitTableModel追åŠ?
588             *
589             * @return こã?クラスのæ–?­—å?表現
590             */
591            @Override
592            public String toString() {
593                    return org.opengion.fukurou.util.ToString.title( this.getClass().getName() )
594                                    .println( "VERSION"                     ,VERSION                )
595                                    .println( "resourceType"        ,resourceType   )
596                                    .println( "resTypeColNo"        ,resTypeColNo   )
597                                    .println( "conditionKey"        ,conditionKey   )
598                                    .println( "conditionList"       ,conditionList  )
599                                    .println( "followCdkh"          ,followCdkh             )
600                                    .println( "CMD_ENTRY"           ,CMD_ENTRY              )
601                                    .println( "commitTabelModel",commitTableModel )         // 4.0.2.0 (2007/12/25)
602                                    .println( "sql"                         ,sql                    )               // 4.1.2.0 (2008/03/12)
603                                    .println( "Other..."    ,getAttributes().getAttribute() )
604                                    .fixForm().toString()
605                            + HybsSystem.CR
606                            + super.toString() ;
607            }
608    }