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?šã‚ã‚? 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 }