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 org.opengion.hayabusa.common.HybsSystem; 019 import org.opengion.hayabusa.db.DBColumn; 020 import org.opengion.hayabusa.db.DBTableModel; 021 import org.opengion.fukurou.util.Attributes; 022 import org.opengion.fukurou.util.ErrorMessage; 023 import org.opengion.fukurou.model.ArrayDataModel; 024 import org.opengion.fukurou.model.Formatter; 025 026 import static org.opengion.fukurou.util.StringUtil.nval ; 027 028 import java.util.List; 029 import java.util.ArrayList; 030 import java.util.Enumeration; 031 import java.util.Locale ; 032 033 import java.io.ObjectOutputStream; 034 import java.io.ObjectInputStream; 035 import java.io.IOException; 036 037 /** 038 * 検索結果の DBTableModelオブジェクトに値を設定するタグです? 039 * 040 * columnSet と共に使用する場合?、entryタグ の command属?と、columnSetタグ の command属?? 041 * ??した場合?み、??れます? 042 * entryタグは、そのコマンドにより、DBTableModelオブジェクト?値を設定します? 043 * たとえ?、command="INSERT" なら??行?の??タを選択された行番号の次に挿入します? 044 * また?追??変更、削除された?DBTableModelオブジェク?でも??には????タ? 045 * 持って?ため、command="RESET" で??状態に戻すことが可能です? 046 * 047 * @og.formSample 048 * ●形式? 049 * ・<og:entry command="…"> 050 * <og:columnSet command="…" /> 051 * </og:entry> 052 * ・<og:entry command="…" /> 053 * ???columnSetを使わな??合でもresult.jspから次画面(insert,modify,copy.jsp?に 054 * にDBTableModelをもって?場合には、??を書?ください? 055 * (取消?とき?エンジン?DBTableModelを操作する?に使用する為) 056 * ●body?あ?EVAL_BODY_BUFFERED:BODYを評価し?{@XXXX} を解析しま? 057 * 058 * ●Tag定義?? 059 * <og:entry 060 * command ○?TAG】コマン?INSERT/COPY/MODIFY/DELETE/ENTRY/CHANGE/RESET/ALLRESET/ALLACTION/RESETDATA/INSERTONE/REALDELETE/REQENTRY)を設定しま???) 061 * scope 【TAG】キャ?ュする場合?スコープ[request/page/session/applicaton]を指定しま?初期値:session) 062 * repeatCount 【TAG】指定?回数?け?繰り返し処?行う回数を指定しま?初期値:1) 063 * tableId 【TAG?通常使?せん)sessionから?す?DBTableModelオブジェクト? ID 064 * useConsistency 【TAG】Consistency キー による整合?チェ?を行うかど?を指定しま?初期値:true) 065 * selectedAll 【TAG】データを?件選択済みとして処?るかど?[true/false]を指定しま?初期値:false) 066 * strictCheck 【TAG】カラ??の存在チェ?を行うかど?[true/false]を指定しま?初期値:true) 067 * noTransition 【TAG?通常は使?せん)画面遷移を行わな?式?登録方法を使用するかを?しま? 068 * debug 【TAG】デバッグ??を?力するかど?[true/false]を指定しま?初期値:false) 069 * > ... Body ... 070 * </og:entry> 071 * 072 * ●使用? 073 * <og:entry command="{@command}" > 074 * <og:columnSet command="{@command}" columnId="ECNO" action="CLEAR" /> 075 * <og:columnSet command="{@command}" columnId="JYOKYO" action="SET" value="1" /> 076 * </og:entry> 077 * 078 * <og:entry command="MODIFY" rows="1" > 079 * <og:columnSet command="MODIFY" columnId="key" action="TBLSET" value="[key][lang]"/> 080 * </og:entry> 081 * 082 * action="ADD" は、DBTypeに依存した方法で、既存?値を???します? 083 * <og:entry command="{@command}" repeatCount="5" > 084 * <og:columnSet command="{@command}" columnId="YKNO" action="ADD" /> 085 * </og:entry> 086 * 087 * action="ADD" は、DBTypeに依存した方法で、既存?値に、value の値を加算します? 088 * <og:entry command="{@command}" repeatCount="5" > 089 * <og:columnSet command="{@command}" columnId="YKNO" action="ADD" value="5" /> 090 * </og:entry> 091 * 092 * command属? は、columnSetタグのcommand属?と同??場合?み、??ます? 093 * [command属?] 094 * INSERT 新? 095 * COPY ?? 096 * MODIFY 変更 097 * DELETE 削除 098 * ENTRY エントリー 099 * CHANGE チェンジ 100 * RESET リセ? 101 * ALLRESET 全件リセ? 102 * ALLACTION オールアクション 103 * RESETDATA リセ???タ 104 * INSERTONE 新?1行?み) 105 * REALDELETE 物?除 106 * REQENTRY リクエスト変数設? 107 * 108 * command属? は、columnSetタグで?します? 109 * [action属?] 110 * DEFAULT カラ?ソースで定義した初期値をセ?します? 111 * CLEAR 値をクリア(ゼロストリング "" )します? 112 * ADD 現在の値???します? 0 ?1 , A ?B , 9 ?10。value属?と併用すれば、指定?値を加算できます? 113 * SET value で設定した??新しい値として登録します? 114 * NULLSET ??値?NULL の場合だけ?value で設定した新しい値を登録します? 115 * LOWER 小文字に変換します? 116 * UPPER 大?に変換します? 117 * COPY value にコピ???カラ?Dをセ?すれば、その値を代入します? 118 * TBLSET DBTableModel の?を取り込んで?? columnId カラ?設定します?[カラ?] で?できます? 119 * また?これは??を解析して?value を作?します?で,??連結等に使用できます? 120 * WRTCTRL writableControl を使用したカラ?ータの先?アン??バ?を削除します? 121 * DBMENU DBMENUでパラメータ設?コロン連結文?を使用したカラ?ータの先???タのみにします? 122 * REQSET valueで?したカラ??値をキーに、リクエスト変数から値を取出し?セ?します? 123 * SEQSET valueの初期値を利用して?レコードごとに?1した?をセ?します? 124 * PREFIX valueの値を後ろから検索し???カラ??の前半部?取得しま?記号は含みません)? 125 * SUFIX valueの値を後ろから検索し???カラ??の後半部?取得しま?記号は含みません)? 126 * そ?? カラ??DBType の valueAction メソ?を呼び出します?自由に設定可能です? 127 * 128 * [strictCheck属?]は、カラ??の存在チェ?を行うかど?を指定しま?初期値:true) 129 * true カラ??がDBTableModel に存在しな??合?、エラーになる? 130 * false カラ??がDBTableModel に存在しな??合?、無視する? 131 * 132 * @og.group 画面登録 133 * 134 * @version 4.0 135 * @author Kazuhiko Hasegawa 136 * @since JDK5.0, 137 */ 138 public class EntryTag extends CommonTagSupport { 139 //* こ?プログラ??VERSION??を設定します? {@value} */ 140 private static final String VERSION = "5.6.6.1 (2013/07/12)" ; 141 142 private static final long serialVersionUID = 566120130712L ; 143 144 /** command 引数に渡す事?出来?コマン? 新?{@value} */ 145 public static final String CMD_INSERT = "INSERT" ; 146 /** command 引数に渡す事?出来?コマン? ?? {@value} */ 147 public static final String CMD_COPY = "COPY" ; 148 /** command 引数に渡す事?出来?コマン? 変更 {@value} */ 149 public static final String CMD_MODIFY = "MODIFY" ; 150 /** command 引数に渡す事?出来?コマン? 削除 {@value} */ 151 public static final String CMD_DELETE = "DELETE" ; 152 /** command 引数に渡す事?出来?コマン? エントリー {@value} */ 153 public static final String CMD_ENTRY = "ENTRY" ; 154 /** command 引数に渡す事?出来?コマン? チェンジ {@value} */ 155 public static final String CMD_CHANGE = "CHANGE" ; 156 /** command 引数に渡す事?出来?コマン? リセ? {@value} */ 157 public static final String CMD_RESET = "RESET" ; 158 /** command 引数に渡す事?出来?コマン? 全件リセ? {@value} */ 159 public static final String CMD_ALLRESET = "ALLRESET" ; // 3.5.6.3 (2004/07/12) 160 /** command 引数に渡す事?出来?コマン? オールアクション{@value} */ 161 public static final String CMD_ALLACTION = "ALLACTION" ; 162 /** command 引数に渡す事?出来?コマン? リセ?(??タのみ){@value} */ 163 public static final String CMD_RESETDATA = "RESETDATA" ; // 4.3.3.0 (2008/10/01) 164 /** command 引数に渡す事?出来?コマン? 追?1行?み){@value} */ 165 public static final String CMD_INSERTONE = "INSERTONE" ; // 5.1.5.0 (2010/04/01) 166 /** command 引数に渡す事?出来?コマン? 物?除 {@value} */ 167 public static final String CMD_REALDELETE = "REALDELETE" ; // 5.1.6.0 (2010/05/01) 168 /** command 引数に渡す事?出来?コマン? リクエスト変数設?{@value} */ 169 public static final String CMD_REQENTRY = "REQENTRY" ; // 5.6.1.2 (2013/02/22) 170 171 // 3.5.6.3 (2004/07/12) CMD_ALLRESET 追? 172 // 4.3.3.0 (2008/10/01) CMD_RESETDATA 追? 173 // 5.1.5.0 (2010/04/01) CMD_INESRTONE 追? 174 // 5.1.6.0 (2010/05/01) CMD_REALDELETE 追? 175 private static final String[] COMMAND_LIST = new String[] { 176 CMD_INSERT,CMD_COPY,CMD_MODIFY,CMD_DELETE,CMD_ENTRY,CMD_CHANGE,CMD_ALLACTION,CMD_RESET,CMD_ALLRESET,CMD_RESETDATA,CMD_INSERTONE,CMD_REALDELETE,CMD_REQENTRY }; 177 178 /** action 引数に渡す事?出来?アクションコマン? 初期値:{@value} */ 179 public static final String ACT_DEFAULT = "DEFAULT" ; 180 /** action 引数に渡す事?出来?アクションコマン? クリア {@value} */ 181 public static final String ACT_CLEAR = "CLEAR" ; 182 /** action 引数に渡す事?出来?アクションコマン? ??{@value} */ 183 public static final String ACT_ADD = "ADD" ; 184 /** action 引数に渡す事?出来?アクションコマン? 小文字化{@value} */ 185 public static final String ACT_LOWER = "LOWER" ; 186 /** action 引数に渡す事?出来?アクションコマン? 大?化{@value} */ 187 public static final String ACT_UPPER = "UPPER" ; 188 /** action 引数に渡す事?出来?アクションコマン? コピ? {@value} */ 189 public static final String ACT_COPY = "COPY" ; 190 /** action 引数に渡す事?出来?アクションコマン? セ? {@value} */ 191 public static final String ACT_SET = "SET" ; 192 // 3.4.0.3 (2003/09/10) NULLSET Action を追?ます? 193 /** action 引数に渡す事?出来?アクションコマン? NULLセ? {@value} */ 194 public static final String ACT_NULLSET = "NULLSET" ; 195 /** action 引数に渡す事?出来?アクションコマン? ??ブルセ? {@value} */ 196 public static final String ACT_TBLSET = "TBLSET" ; 197 /** action 引数に渡す事?出来?アクションコマン? ライトコントロール {@value} */ 198 public static final String ACT_WRTCTRL = "WRTCTRL" ; // 3.8.1.5 (2006/03/30) 199 /** action 引数に渡す事?出来?アクションコマン? DBメニュー {@value} */ 200 public static final String ACT_DBMENU = "DBMENU" ; // 3.8.5.3 (2006/08/07) 201 /** action 引数に渡す事?出来?アクションコマン? リクエスト?セ? {@value} */ 202 public static final String ACT_REQSET = "REQSET" ; // 5.4.2.1 (2011/12/09) 203 /** action 引数に渡す事?出来?アクションコマン? 連番値セ? {@value} */ 204 public static final String ACT_SEQSET = "SEQSET" ; // 5.6.5.2 (2013/06/21) 205 /** action 引数に渡す事?出来?アクションコマン? PREFIX値セ? {@value} */ 206 public static final String ACT_PREFIX = "PREFIX" ; // 5.6.6.1 (2013/07/12) 207 /** action 引数に渡す事?出来?アクションコマン? SUFIX値セ? {@value} */ 208 public static final String ACT_SUFIX = "SUFIX" ; // 5.6.6.1 (2013/07/12) 209 210 // 3.5.6.0 (2004/06/18) すべて?protected から private に変更します? 211 private String tableId = HybsSystem.TBL_MDL_KEY; 212 private transient DBTableModel table = null; 213 private String command = null; 214 private int[] rowNo = null; 215 private List<Attributes> values = null; 216 // private transient Formatter format = null; 217 218 // 3.5.4.2 (2003/12/15) ??回数繰り返す機?を追?ます? 219 private int repeatCount = 1; 220 221 // 3.5.5.7 (2004/05/10) Consistency キー による整合?チェ?を行うかど?を指定します? 222 private boolean useConsistency = HybsSystem.sysBool( "USE_CONSISTENCY" ); 223 224 // 3.8.1.1 (2005/11/21) 全件選択されたこととして、??ます? 225 private boolean selectedAll = false; 226 227 // 3.5.6.4 (2004/07/16) RESET コマンド??ォルト??に、ALLRESET ? 228 // 使用するかど?を指定しま?初期値:false(使用しな?)? 229 private final boolean RESET_ACTION_ALL_USE = HybsSystem.sysBool( "RESET_ACTION_ALL_USE" ); 230 231 // 4.0.0 (2006/09/31) カラ??の存在チェ?を行うかど?を指定します? 232 private boolean strictCheck = true; 233 234 private boolean noTransition= false; // 4.3.3.0 (2008/10/01) 追? 235 236 // 5.6.5.2 (2013/06/21) SEQSET アクションのカウンター 237 private int seqsetCnt = 0; 238 239 /** 240 * Taglibの開始タグが見つかったときに処??doStartTag() ?オーバ?ライドします? 241 * 242 * @og.rev 5.1.9.0 (2010/08/01) 戻り?を?EVAL_BODY_INCLUDE ?EVAL_BODY_BUFFERED に変更 243 * 244 * @return 後続???? 245 */ 246 @Override 247 public int doStartTag() { 248 // int rtn = EVAL_BODY_INCLUDE; 249 int rtn = EVAL_BODY_BUFFERED; // 5.1.9.0 (2010/08/01) 変更 250 251 if( ! check( command, COMMAND_LIST ) ) { 252 rtn = SKIP_BODY; 253 } 254 255 return rtn; 256 } 257 258 /** 259 * Taglibの終?グが見つかったときに処??doEndTag() ?オーバ?ライドします? 260 * 261 * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応?release2() ?doEndTag()で呼ぶ? 262 * @og.rev 3.5.5.5 (2004/04/23) 登録時? 整合?パラメータチェ?を行います? 263 * @og.rev 3.5.5.6 (2004/04/27) JSP画面の作?不?合?ENTRY系で、command を投げた場合?、無視します? 264 * @og.rev 3.5.5.7 (2004/05/10) Consistency キー による整合?チェ?を行うかど?を指定します? 265 * @og.rev 3.5.5.8 (2004/05/20) Consistency キー による整合?チェ??checkConsistency() に??ます? 266 * @og.rev 3.6.0.8 (2004/11/19) DBTableModel をセーブする時に、トランザクションチェ?を行います? 267 * @og.rev 4.3.3.0 (2008/10/01) noTransition 属?を追?ます? 268 * @og.rev 4.3.8.0 (2009/08/01) noTransition値取得?メソ?名変更 269 * @og.rev 5.1.3.0 (2010/02/01) noTransitionのコントロールは、requestで行う? 270 * 271 * @return 後続???? 272 */ 273 @Override 274 public int doEndTag() { 275 debugPrint(); // 4.0.0 (2005/02/28) 276 // noTransition = isNoTransitionRequest() || noTransition; // 4.3.3.0 (2008/10/01) 追? 277 // noTransition = isNoTransitionSession() || noTransition; // 4.3.8.0 (2009/08/01) メソ?名変更 278 noTransition = isNoTransitionRequest(); // 5.1.3.0 (2010/02/01) 279 startQueryTransaction( tableId ); // 3.6.0.8 (2004/11/19) 280 table = (DBTableModel)getObject( tableId ); 281 282 if( table != null && check( command, COMMAND_LIST ) ) { 283 if( ! checkConsistency() ) { return(SKIP_PAGE); } 284 if( rowNo == null ) { rowNo = getParameterRows(); } // 4.0.0 (2005/01/31) 285 286 commandExec( command ); 287 288 // 3.6.0.8 (2004/11/19) トランザクションチェ?を行います? 289 if( ! commitTableObject( tableId, table ) ) { 290 jspPrint( "EntryTag Query処?割り込まれました?BTableModel は登録しません? ); 291 return (SKIP_PAGE); 292 } 293 } 294 295 return(EVAL_PAGE); 296 } 297 298 /** 299 * タグリブオブジェクトをリリースします? 300 * 301 * キャ?ュされて再利用される?で、フィールド?初期設定を行います? 302 * 303 * @og.rev 2.0.0.4 (2002/09/27) カスタ?グの release() メソ?を?追? 304 * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応?release2() ?doEndTag()で呼ぶ? 305 * @og.rev 3.5.4.2 (2003/12/15) ??回数繰り返す機?を追?ます? 306 * @og.rev 3.5.5.7 (2004/05/10) Consistency キー による整合?チェ?を行うかど?を指定します? 307 * @og.rev 3.8.1.1 (2005/11/21) selectedAll 追??全件選択されたこととして、??ます? 308 * @og.rev 4.0.0.0 (2006/09/31) strictCheck 追?? 309 * @og.rev 4.3.3.0 (2008/10/01) noTransition 属?を追?ます? 310 * @og.rev 5.6.5.2 (2013/06/21) seqsetCnt 属?を追?ます? 311 * 312 */ 313 @Override 314 protected void release2() { 315 super.release2(); 316 tableId = HybsSystem.TBL_MDL_KEY; 317 table = null; 318 command = null; 319 rowNo = null; 320 values = null; 321 // format = null; 322 repeatCount = 1; // 3.5.4.2 (2003/12/15) 323 useConsistency = HybsSystem.sysBool( "USE_CONSISTENCY" ); // 3.5.5.7 (2004/05/10) 324 selectedAll = false; // 3.8.1.1 (2005/11/21) 325 strictCheck = true; // 4.0.0 (2006/09/31) 326 noTransition= false; // 4.3.3.0 (2008/10/01) 追? 327 seqsetCnt = 0; // 5.6.5.2 (2013/06/21) SEQSET アクションのカウンター 328 } 329 330 /** 331 * ?タグの ColumnSetTag より、???カラ??値を書き換える為の属?を指定します? 332 * 333 * ?の値を受け取って、後ほど、すべてのカラ?対して処?行います? 334 * 335 * @og.rev 3.1.0.0 (2003/03/20) Vector を使用して??で?同期でも構わな??を?ArrayList に置換え? 336 * @og.rev 3.1.2.0 (2003/04/07) taglib パッケージ?で使用して???protected 化する? 337 * 338 * @param attri 属?リス? 339 */ 340 protected void setAttributes( final Attributes attri ) { 341 if( values == null ) { values = new ArrayList<Attributes>(); } 342 if( command.equalsIgnoreCase( attri.get( "command" ) ) ) { 343 values.add( attri ); 344 } 345 } 346 347 /** 348 * 【TAG?通常は使?せん)結果のDBTableModelを?sessionに登録するとき?キーを指定しま? 349 * (初期値:HybsSystem#TBL_MDL_KEY[={@og.value org.opengion.hayabusa.common.HybsSystem#TBL_MDL_KEY}])? 350 * 351 * @og.tag 352 * 検索結果より、DBTableModelオブジェクトを作?します?これを?下流?viewタグ等に 353 * 渡す?合に??常は、session を利用します?そ?場合?登録キーです? 354 * query タグを同時に実行して、結果を求める?合?同?モリに配置される為? 355 * こ? tableId 属?を利用して、メモリ空間を?ます? 356 * (初期値:HybsSystem#TBL_MDL_KEY[={@og.value org.opengion.hayabusa.common.HybsSystem#TBL_MDL_KEY}])? 357 * 358 * @param id sessionに登録する時? ID 359 */ 360 public void setTableId( final String id ) { 361 tableId = nval( getRequestParameter( id ),tableId ); // 3.8.0.9 (2005/10/17) 362 } 363 364 /** 365 * 【TAG】コマン?INSERT,COPY,MODIFY,DELETE,ENTRY,CHANGE,ALLACTION,RESET)をセ?します? 366 * 367 * @og.tag 368 * コマンド?,HTMLから(get/post)?されます?で,CMD_xxx で設定される 369 * フィールド定数値の?れかを??できます? 370 * 371 * @param cmd コマン?public static final 宣?れて???) 372 * @see <a href="../../../../constant-values.html#org.opengion.hayabusa.taglib.EntryTag.CMD_INSERT">コマンド定数</a> 373 */ 374 public void setCommand( final String cmd ) { 375 String cmd2 = getRequestParameter( cmd ); 376 if( cmd2 != null && cmd2.length() > 0 ) { command = cmd2.toUpperCase(Locale.JAPAN); } 377 } 378 379 /** 380 * コマンドを実行します? 381 * 382 * コマンド?,HTMLから(get/post)?されます?で,setCommand()メソ?で 383 * 登録します? 384 * コマンドを登録すると同時に,実行も行な?す? 385 * 386 * @og.rev 3.5.6.3 (2004/07/12) ALLRESET コマンドを追?る? 387 * @og.rev 4.3.3.0 (2008/10/01) RESETDATA コマンドを追?る? 388 * @og.rev 5.1.5.0 (2010/04/01) INSERTONE コマンドを追?る? 389 * @og.rev 5.1.6.0 (2010/05/01) REALDELETE コマンドを追?る? 390 * @og.rev 5.6.1.2 (2013/02/22) REQENTRY コマンドを追?る? 391 * 392 * @param command コマン?public static final 宣?れて???) 393 */ 394 private void commandExec( final String command ) { 395 396 table.setDefaultRowWritable( false ); 397 table.setDefaultRowChecked( false ); 398 399 if( CMD_INSERT.equals( command ) ) { insert() ; } 400 else if( CMD_COPY.equals( command ) ) { copy() ; } 401 else if( CMD_MODIFY.equals( command ) ) { modify() ; } 402 else if( CMD_CHANGE.equals( command ) ) { change() ; } 403 else if( CMD_DELETE.equals( command ) ) { delete() ; } 404 else if( CMD_ENTRY.equals( command ) ) { entry() ; } 405 else if( CMD_RESET.equals( command ) ) { 406 if( RESET_ACTION_ALL_USE ) { allReset() ; } // 3.5.6.4 (2004/07/16) 407 else { reset() ; } 408 } 409 else if( CMD_ALLRESET.equals( command ) ) { allReset() ; } // 3.5.6.3 (2004/07/12) 410 else if( CMD_ALLACTION.equals( command ) ) { allAction() ; } 411 else if( CMD_RESETDATA.equals( command ) ) { resetData() ; } // 4.3.3.0 (2008/10/01) 412 else if( CMD_INSERTONE.equals( command ) ) { insertOne() ; } // 5.1.5.0 (2010/04/01) 413 else if( CMD_REALDELETE.equals( command ) ) { realDelete() ; } // 5.1.6.0 (2010/05/01) 414 else if( CMD_REQENTRY.equals( command ) ) { reqEntry() ; } // 5.6.1.2 (2013/02/22) 415 } 416 417 /** 418 * DBTableModelに行を追?ます? 419 * 420 * 注意:writableカラ??暫定対応が入って?す?単純な空白??タ? 421 * インサートすると、カラ?ータ?null になる為? 制御がおかし? 422 * なります? 423 * 424 * @og.rev 3.5.4.2 (2003/12/15) repeatCount による繰り返し処?追? 425 * @og.rev 4.3.3.0 (2008/10/01) noTransition 属?対? 426 * 427 */ 428 private void insert() { 429 if( rowNo.length == 0 ) { rowNo = new int[] { -1 }; } 430 431 boolean rowWritableFlag = "WRITABLE".equalsIgnoreCase( table.getColumnName( 0 ) ); // writable 対? 432 // src の作?は、各チェ?毎に行う??な????の??でよい? 433 String[] src = new String[ table.getColumnCount() ]; 434 for( int j=0; j<src.length; j++ ) { 435 DBColumn dbColumn = table.getDBColumn( j ); 436 src[j] = dbColumn.getDefault(); 437 } 438 if( rowWritableFlag ) { src[0] = "true"; } // writable 対? 439 440 int rowCount = table.getRowCount(); 441 442 // ??にINSERTしな?、行番号がずれてしま?? 443 for( int i=rowNo.length-1; i>=0; i-- ) { 444 int row = rowNo[i]; 445 for( int cnt=0; cnt<repeatCount; cnt++ ) { 446 if( cnt >= 1 ) { // ?回目以? 447 src = table.getValues( row ); 448 } 449 450 String[] dst = new String[ table.getColumnCount() ]; 451 System.arraycopy( src,0,dst,0,dst.length ); 452 dst = setColumnValues( dst ); 453 454 // 4.3.3.0 (2008/10/01) noTransition属?対? 455 if( noTransition ) { row = rowCount; } 456 else { row ++; } // ?行?下に追?る? 457 table.addValues( dst,row ); 458 table.setRowWritable( row,true ); 459 table.setRowChecked( row,true ); 460 } 461 } 462 } 463 464 /** 465 * DBTableModelに行を追?、チェ?された行?値をセ?します? 466 * 467 * @og.rev 3.5.4.2 (2003/12/15) repeatCount による繰り返し処?追? 468 * @og.rev 4.3.3.0 (2008/10/01) noTransition 属?対? 469 * 470 */ 471 private void copy() { 472 if( rowNo.length == 0 ) { insert() ; return ;} 473 474 int rowCount = table.getRowCount(); 475 476 // ??にCOPYしな?、行番号がずれてしま?? 477 for( int i=rowNo.length-1; i>=0; i-- ) { 478 for( int cnt=0; cnt<repeatCount; cnt++ ) { 479 String[] src = table.getValues( rowNo[i]+cnt ); 480 String[] dst = new String[ table.getColumnCount() ]; 481 System.arraycopy( src,0,dst,0,dst.length ); 482 dst = setColumnValues( dst ); 483 484 // 4.3.3.0 (2008/10/01) noTransition属?対? 485 int row = -1; 486 if( noTransition ) { row = rowCount; } 487 else { row = rowNo[i] + cnt + 1; } // ?行?下に追?る? 488 489 table.addValues( dst,row ); 490 table.setRowWritable( row,true ); 491 table.setRowChecked( row,true ); 492 } 493 } 494 } 495 496 /** 497 * DBTableModelの行を書込み可とます? 498 * 499 * @og.rev 4.3.4.6 (2009/01/15) 画面遷移なし登録で既に改廃Cがセ?されて?場合?、columnSetタグの処?行わな?? 500 * 501 */ 502 private void modify() { 503 for( int i=0; i<rowNo.length; i++ ) { 504 String[] src = table.getValues( rowNo[i] ); 505 String[] dst = new String[ table.getColumnCount() ]; 506 System.arraycopy( src,0,dst,0,dst.length ); 507 508 // 4.3.4.6 (2009/01/15) 509 // 画面遷移なし登録の場合?既に改廃Cが付いて?(編?れて?)場合?? 510 // columnSetによる値のセ?を行わな?? 511 // (同じコマンドで?のボタンを割り当てて?場合??回?変更・削除によって、?に登録され? 512 // 値が削除されてしま?め? 513 if( !( noTransition && table.getModifyType( rowNo[i] ) != null && table.getModifyType( rowNo[i] ).length() > 0 ) ){ 514 dst = setColumnValues( dst ); 515 } 516 517 table.setValues( dst,rowNo[i] ); 518 table.setRowWritable( rowNo[i],true ); 519 table.setRowChecked( rowNo[i],true ); 520 } 521 } 522 523 /** 524 * DBTableModelの行を変更します? 525 526 * @og.rev 4.3.4.6 (2009/01/15) 画面遷移なし登録で既に改廃Cがセ?されて?場合?、columnSetタグの処?行わな?? 527 * 528 */ 529 private void change() { 530 for( int i=0; i<rowNo.length; i++ ) { 531 String[] src = table.getValues( rowNo[i] ); 532 String[] dst = new String[ table.getColumnCount() ]; 533 System.arraycopy( src,0,dst,0,dst.length ); 534 535 // 4.3.4.6 (2009/01/15) 536 if( !( noTransition && table.getModifyType( rowNo[i] ) != null && table.getModifyType( rowNo[i] ).length() > 0 ) ){ 537 dst = setColumnValues( dst ); 538 } 539 540 table.setValues( dst,rowNo[i] ); 541 } 542 } 543 544 /** 545 * DBTableModelの行を削除します? 546 * 547 * @og.rev 3.5.4.2 (2003/12/15) DELETE時にも?の書き換えができるようにします? 548 * @og.rev 4.3.4.6 (2009/01/15) 画面遷移なし登録で既に改廃Cがセ?されて?場合?、columnSetタグの処?行わな?? 549 * 550 */ 551 private void delete() { 552 for( int i=0; i<rowNo.length; i++ ) { 553 // 3.5.4.2 (2003/12/15) 書き換え??追? 554 String[] src = table.getValues( rowNo[i] ); 555 String[] dst = new String[ table.getColumnCount() ]; 556 System.arraycopy( src,0,dst,0,dst.length ); 557 558 // 4.3.4.6 (2009/01/15) 559 if( !( noTransition && table.getModifyType( rowNo[i] ) != null && table.getModifyType( rowNo[i] ).length() > 0 ) ){ 560 dst = setColumnValues( dst ); 561 } 562 563 table.rowDelete( dst,rowNo[i] ); 564 table.setRowWritable( rowNo[i],true ); 565 table.setRowChecked( rowNo[i],true ); 566 } 567 } 568 569 /** 570 * リクエスト情報から、セ?されたカラ?と値を取り?し?設定します? 571 * 572 * 設定?は、???キー??__" ??行番号 です? 573 * よって、?は,??設定されて?す? 574 * 575 * @og.rev 3.5.3.1 (2003/10/31) チェ?ボックスカラ??します? 576 * @og.rev 3.6.0.6 (2004/10/22) chboxNames 属?は?します? 577 * @og.rev 5.6.1.2 (2013/02/22) setRequestValuesメソ?の互換性の対応? 578 */ 579 private void entry() { 580 if( rowNo.length > 0 ) { 581 // setRequestValues(); 582 setRequestValues( false ); // 5.6.1.2 (2013/02/22) 互換性 583 for( int i=0; i<rowNo.length; i++ ) { 584 String[] src = table.getValues( rowNo[i] ); 585 String[] dst = new String[ table.getColumnCount() ]; 586 System.arraycopy( src,0,dst,0,dst.length ); 587 dst = setColumnValues( dst ); 588 589 table.setValues( dst,rowNo[i] ); 590 table.setRowWritable( rowNo[i],true ); 591 table.setRowChecked( rowNo[i],true ); 592 } 593 } 594 } 595 596 /** 597 * リクエスト情報の??ブルモ???タを?リセ?します? 598 * 599 * @og.rev 5.6.5.2 (2013/06/21) 行ループを 0?最終行? 降?で廻します? 600 */ 601 private void reset() { 602 for( int i=rowNo.length-1; i>=0; i-- ) { 603 // for( int i=0; i<rowNo.length; i++ ) { 604 table.resetRow( rowNo[i] ); 605 } 606 } 607 608 /** 609 * ??ブルモ???タを?全件リセ?します? 610 * 611 * @og.rev 3.5.6.3 (2004/07/12) 新規作? 612 * @og.rev 5.6.5.2 (2013/06/21) 行ループを 0?最終行? 降?で廻します? 613 */ 614 private void allReset() { 615 int rowCount = table.getRowCount(); 616 for( int row=0; row<rowCount; row++ ) { 617 table.resetRow( row ); 618 } 619 620 // int rowMax = table.getRowCount()-1 ; 621 // for( int i=rowMax; i>=0; i-- ) { 622 // table.resetRow( i ); 623 // } 624 } 625 626 /** 627 * DBTableModelの全ての行に対して,値をセ?します? 628 * 629 * @og.rev 5.6.5.2 (2013/06/21) 行ループを 0?最終行? 降?で廻します? 630 */ 631 private void allAction() { 632 int rowCount = table.getRowCount(); 633 for( int row=0; row<rowCount; row++ ) { 634 String[] src = table.getValues( row ); 635 String[] dst = new String[ table.getColumnCount() ]; 636 System.arraycopy( src,0,dst,0,dst.length ); 637 dst = setColumnValues( dst ); 638 639 table.setValues( dst,row ); 640 table.setRowWritable( row,true ); 641 table.setRowChecked( row,true ); 642 } 643 644 // int rowMax = table.getRowCount()-1 ; // 3.5.6.3 (2004/07/12) 645 // for( int i=rowMax; i>=0; i-- ) { 646 // String[] src = table.getValues( i ); 647 // String[] dst = new String[ table.getColumnCount() ]; 648 // System.arraycopy( src,0,dst,0,dst.length ); 649 // dst = setColumnValues( dst ); 650 // 651 // table.setValues( dst,i ); 652 // table.setRowWritable( i,true ); 653 // table.setRowChecked( i,true ); 654 // } 655 } 656 657 /** 658 * リクエスト情報の??ブルモ???タを?リセ?します? 659 * (?、リセ?された行?、チェ?された状態?ままになりま? 660 * 661 * @og.rev 4.3.3.0 (2008/10/01) 新規作? 662 * @og.rev 5.6.5.2 (2013/06/21) 行ループを 0?最終行? 降?で廻します? 663 */ 664 private void resetData() { 665 // for( int i=rowNo.length-1; i>=0; i-- ) { 666 for( int i=0; i<rowNo.length; i++ ) { 667 String cdkh = table.getModifyType( rowNo[i] ); 668 table.resetRow( rowNo[i] ); 669 // 更新又?、削除の時?み書き込み可能になる? 670 if( DBTableModel.UPDATE_TYPE.equals( cdkh ) || DBTableModel.DELETE_TYPE.equals( cdkh ) ) { 671 table.setRowWritable( rowNo[i],true ); 672 table.setRowChecked( rowNo[i],true ); 673 } 674 } 675 } 676 677 /** 678 * DBTableModelに行を追?ます?(1行?み) 679 * 680 * 行が選択されて?かど?に関わらず?1行?みを追?ます? 681 * (動きとしては、行が選択されて??態でINSERTコマンドを発行した?合と同じで? 682 * 683 * @og.rev 5.1.5.0 (2010/04/01) 新規作? 684 * 685 */ 686 private void insertOne() { 687 rowNo = new int[0]; 688 insert(); 689 } 690 691 /** 692 * DBTableModelの行を物?除します? 693 * 694 * 通常の??タベ?ス等で削除する場合?、DELETE行も残しておかな?、どの行を削除する? 695 * 判らなくなります?また?アプリケーションによっては、削除ではなく?フラグ?を立て? 696 * ケースもあるため?現在の commend="DELETE" では、論理削除??の書き換えも可能になって?す? 697 * ここでの物?除は、WriteTable など、ファイル出力時には、その行そのも?をなくしておくほ? 698 * 良?ースがあるためです? 699 * 700 * @og.rev 5.1.6.0 (2010/05/01) REALDELETE コマンドを追?る? 701 */ 702 private void realDelete() { 703 // ??にしな?、行番号がずれてしま?? 704 for( int i=rowNo.length-1; i>=0; i-- ) { 705 table.removeValue( rowNo[i] ); 706 } 707 } 708 709 /** 710 * リクエスト情報から、セ?されたカラ?と値を取り?し?設定します? 711 * 712 * 設定?は、???キー??__" ??行番号 です? 713 * ENTRYコマンドとの違いは、h_rowSel と無関係に、リクエストされた変数すべて? 714 * 処?ます? 715 * 716 * @og.rev 5.6.1.2 (2013/02/22) 新規追? 717 */ 718 private void reqEntry() { 719 setRequestValues( true ); // リクエストされた変数すべてを?? 720 int rowCount = table.getRowCount(); 721 for( int row=0; row<rowCount; row++ ) { 722 String[] src = table.getValues( row ); 723 String[] dst = new String[ table.getColumnCount() ]; 724 System.arraycopy( src,0,dst,0,dst.length ); 725 dst = setColumnValues( dst ); 726 727 table.setValues( dst,row ); 728 table.setRowWritable( row,true ); 729 table.setRowChecked( row,true ); 730 } 731 } 732 733 /** 734 * リクエスト情報から、セ?されたカラ?と値を取り?し?設定します? 735 * 736 * 設定?は、???キー??__" ??行番号 です? 737 * よって、?は,??設定されて?す? 738 * 739 * @og.rev 3.1.0.0 (2003/03/20) 名前と行番号の区?記号?"^" から "__" に変更? 740 * @og.rev 3.5.5.0 (2004/03/12) 名前と行番号の区?記号("__")を?HybsSystem.JOINT_STRING に変更? 741 * @og.rev 3.6.0.6 (2004/10/22) chboxNames 属?は?します? 742 * @og.rev 3.8.0.1 (2005/06/17) チェ?ボックス対応で、エラーチェ?をPL/SQLで行う場合?処??の追? 743 * @og.rev 3.8.0.2 (2005/07/11) チェ?ボックス対応で、判定を DBColumnのgetEditor()を使用しま? 744 * @og.rev 4.0.0.0 (2006/09/31) strictCheck 追?? 745 * @og.rev 4.3.7.3 (2009/06/22) HSQLDB対応でリクエストが空??場合?null?に変換する 746 * @og.rev 5.0.0.2 (2009/09/15) XSS対?ALLはチェ?しな? 747 * @og.rev 5.6.1.2 (2013/02/22) isAllRow 引数追? 748 * 749 * @param isAllRows 選択行番号に関係なく?処?るかど? 750 */ 751 // private void setRequestValues() { 752 private void setRequestValues( final boolean isAllRows ) { 753 Enumeration<?> enume = getParameterNames(); // 4.3.3.6 (2008/11/15) Generics警告対? 754 755 while( enume.hasMoreElements() ) { 756 String key = (String)(enume.nextElement()); 757 int idx = key.lastIndexOf(HybsSystem.JOINT_STRING); 758 759 if( idx > 0 ) { 760 String column = key.substring(0,idx); 761 int clmNo = table.getColumnNo( column,strictCheck ); 762 if( clmNo < 0 ) { continue; } // strictCheck 対? 763 DBColumn dbColumn = table.getDBColumn( clmNo ); 764 int row = Integer.parseInt( key.substring(idx + 2) ); 765 // 5.0.0.2 (2009/09/15) ?種別ALLはXSSチェ?しな? 766 // String val = dbColumn.valueSet( getRequestValue( key ) ); 767 String val = null; 768 if( "ALL".equals( dbColumn.getDbType() ) ){ 769 val = dbColumn.valueSet( getRequestValue( key, false ) ); 770 } 771 else{ 772 val = dbColumn.valueSet( getRequestValue( key ) ); 773 } 774 775 // 3.6.0.6 (2004/10/22) チェ?ボックスはマルチで??タが来ます? 776 // 3.8.0.2 (2005/07/11) 判定を DBColumnのgetEditor()を使用 777 if( "0".equals(val) && "CHBOX".equals( dbColumn.getEditor() ) ) { 778 String[] vals = getRequestValues( key ); 779 if( vals != null ) { 780 for( int i=0; i<vals.length; i++ ) { 781 if( "1".equals( vals[i] ) ) { val = "1"; break; } 782 } 783 } 784 } 785 786 // 5.6.1.2 (2013/02/22) リクエスト変数すべての??タを設? 787 if( isAllRows ) { 788 // 4.3.7.3 (2009/06/22) HSQLDB対? 789 if( val != null && val.length() == 0 ){ 790 val = null; 791 } 792 table.setValue(row, column, val ); 793 } 794 // 従来のロジ?(チェ?を外してSUBMITするケースを想定して?? 795 else { 796 // rowNo は、getParameterRows メソ?でソートされて?ので? 797 // java.util.Arrays#binarySearch(int[] a, int key) が使えるはず? 798 // 十?に?トして??め?今?変更しな?? 799 for( int i=0; i<rowNo.length; i++ ) { 800 if( rowNo[i] == row ) { 801 // 4.3.7.3 (2009/06/22) HSQLDB対? 802 if( val != null && val.length() == 0 ){ 803 val = null; 804 } 805 table.setValue(row, column, val ); 806 } 807 } 808 } 809 } 810 } 811 } 812 813 /** 814 * ColumnSetTag で?された条件を?に、その行?値を書き換えます? 815 * 816 * @og.rev 3.6.0.6 (2004/10/22) conditionKey と?conditionList 属?を追? 817 * @og.rev 3.8.1.5 (2006/03/30) writableControl を使用したカラ?ータの先?アン??バ?を削除します? 818 * @og.rev 4.0.0.0 (2006/09/31) strictCheck 追?? 819 * @og.rev 4.3.7.3 (2009/06/22) HSQLDB対応で空??NULL 820 * @og.rev 5.6.5.2 (2013/06/21) valueの初期値を利用して?レコードごとに?1した?をセ?します? 821 * 822 * @param val ?行データ配? 823 * 824 * @return 変更後??行データ配? 825 */ 826 private String[] setColumnValues( final String[] val ) { 827 if( values != null ) { 828 int size = values.size(); 829 for( int i=0; i<size; i++ ) { 830 Attributes attri = values.get( i ); 831 String columnId = attri.get( "columnId" ); 832 int clmNo = table.getColumnNo( columnId,strictCheck ); 833 if( clmNo < 0 ) { continue; } // strictCheck 対? 834 String action = attri.get( "action" ); 835 String newVal = attri.get( "value" ); 836 String oldVal = val[clmNo]; 837 838 // 3.6.0.6 (2004/10/22) 条件による処??実行可否判? 839 String conditionList = attri.get( "conditionList" ); 840 if( conditionList != null ) { // null の場合?、無条件実? 841 String conditionKey = attri.get( "conditionKey" ); 842 int condClmNo = table.getColumnNo( conditionKey ); 843 String condValue = "|" + val[condClmNo] + "|"; 844 if( conditionList.indexOf( condValue ) < 0 ) { 845 continue; 846 } 847 } 848 849 if( ACT_COPY.equals( action ) ) { 850 int copyClmNo = table.getColumnNo( newVal ); // newVal はコピ??ラ? 851 val[clmNo] = val[copyClmNo]; 852 } 853 else if( ACT_TBLSET.equals( action ) ) { 854 // if( format == null ) { 855 // format = new Formatter( model ); 856 // } 857 ArrayDataModel model = new ArrayDataModel( table.getNames() ); 858 model.setValues( val,0 ); 859 Formatter format = new Formatter( model ); 860 format.setFormat( newVal ); // newValue はフォーマットされた?? 861 val[clmNo] = format.getFormatString( 0 ); 862 } 863 // 3.8.1.5 (2006/03/30) writableControl を使用したカラ?ータの先?アン??バ?を削除します? 864 else if( ACT_WRTCTRL.equals( action ) ) { 865 if( oldVal != null && oldVal.length() > 0 && oldVal.charAt(0) == '_' ) { 866 val[clmNo] = oldVal.substring( 1 ); 867 } 868 } 869 // 3.8.5.3 (2006/08/07) DBMENUでパラメータ設?コロン連結文?を使用したカラ?ータの先???タのみにします? 870 else if( ACT_DBMENU.equals( action ) ) { 871 if( oldVal != null && oldVal.length() > 0 ) { 872 int adrs = oldVal.indexOf( ':' ); 873 if( adrs >= 0 ) { 874 val[clmNo] = oldVal.substring( 0,adrs ); 875 } 876 } 877 } 878 // 5.4.2.1 (2011/12/09) valueで?したカラ??値をキーに、リクエスト変数から値を取出し?セ?します? 879 else if( ACT_REQSET.equals( action ) ) { 880 if( newVal != null && newVal.length() > 0 ) { 881 int reqClmNo = table.getColumnNo( newVal ); // newVal はリクエスト取得?カラ? 882 String reqClm = val[reqClmNo]; // こ?時点では、コロン引数が付いて?可能性がある? 883 884 int adrs = reqClm.indexOf( ':' ); // 先?がカラ? 885 if( adrs >= 0 ) { 886 reqClm = reqClm.substring( 0,adrs ); // コロンより前方の?け取り?す? 887 } 888 val[clmNo] = getRequestValue( reqClm ); 889 } 890 } 891 // 5.6.5.2 (2013/06/21) valueの初期値を利用して?レコードごとに?1した?をセ?します? 892 else if( ACT_SEQSET.equals( action ) ) { 893 int intVal = seqsetCnt ; 894 if( newVal != null && newVal.length() > 0 ) { 895 intVal += Integer.parseInt( newVal ); // value の設定? 896 } 897 val[clmNo] = String.valueOf( intVal ); 898 } 899 else { 900 val[clmNo] = actionExec( action,columnId,oldVal,newVal ); 901 } 902 903 // 4.3.7.3 (2009/06/22) HSQLDB対? 904 if( val[clmNo] != null && val[clmNo].length() == 0){ 905 val[clmNo] = null; 906 } 907 } 908 } 909 seqsetCnt ++ ; // // 5.6.5.2 (2013/06/21) SEQSET のカウンター? 910 911 return val; 912 } 913 914 /** 915 * アクションを実行します? 916 * 917 * アクションは,??アクションコマンドに対応する??入力データに 918 * 対して行います? 919 * 920 * @og.rev 3.4.0.3 (2003/09/10) NULLSET Action を追?ます? 921 * @og.rev 5.6.0.3 (2012/01/24) ADD Action に、value引数の値を加算する機?を追?ます? 922 * @og.rev 5.6.6.1 (2013/07/12) action に、PREFIX,SUFIX を追?ます? 923 * 924 * @param action アクションコマン? 925 * @param clmId カラ?? 926 * @param oldValue 入力データ(旧??タ) 927 * @param newValue 入力データ(新??タ) 928 * 929 * @return 実行後???タ 930 * @see <a href="../../../../constant-values.html#org.opengion.hayabusa.taglib.EntryTag.ACT_DEFAULT">アクション定数</a> 931 */ 932 private String actionExec( final String action,final String clmId, 933 final String oldValue,final String newValue ) { 934 String rtnVal = oldValue; 935 936 DBColumn dbColumn = getDBColumn( clmId ); 937 if( ACT_DEFAULT.equals( action ) ) { rtnVal = dbColumn.getDefault(); } 938 else if( ACT_CLEAR.equals( action ) ) { rtnVal = ""; } 939 else if( ACT_SET.equals( action ) ) { rtnVal = dbColumn.valueSet( newValue ); } 940 // else if( ACT_ADD.equals( action ) ) { rtnVal = dbColumn.valueAdd( oldValue ); } 941 else if( ACT_ADD.equals( action ) ) { rtnVal = dbColumn.valueAdd( oldValue,newValue ); } // 5.6.0.3 (2012/01/24) 942 else if( ACT_LOWER.equals( action ) ) { 943 if( oldValue == null ) { rtnVal = dbColumn.getDefault(); } 944 else { rtnVal = oldValue.toLowerCase(Locale.JAPAN); } 945 } 946 else if( ACT_UPPER.equals( action ) ) { 947 if( oldValue == null ) { rtnVal = dbColumn.getDefault(); } 948 else { rtnVal = oldValue.toUpperCase(Locale.JAPAN); } 949 } 950 // 3.4.0.3 (2003/09/10) NULLSET Action を追?ます? 951 else if( ACT_NULLSET.equals( action ) ) { 952 if( oldValue == null || oldValue.length() == 0 ) { 953 rtnVal = dbColumn.valueSet( newValue ); 954 } 955 } 956 // 5.6.6.1 (2013/07/12) PREFIX Action を追?ます? 957 else if( ACT_PREFIX.equals( action ) ) { 958 if( oldValue != null && oldValue.length() > 0 && newValue != null && newValue.length() > 0 ) { 959 int indx = oldValue.lastIndexOf( newValue ); 960 if( indx >= 0 ) { 961 rtnVal = oldValue.substring( 0,indx ); 962 } 963 } 964 } 965 // 5.6.6.1 (2013/07/12) SUFIX Action を追?ます? 966 else if( ACT_SUFIX.equals( action ) ) { 967 if( oldValue != null && oldValue.length() > 0 && newValue != null && newValue.length() > 0 ) { 968 int indx = oldValue.lastIndexOf( newValue ); 969 if( indx >= 0 ) { 970 rtnVal = oldValue.substring( indx+1 ); // ?記号は含まな??で?1する? 971 } 972 } 973 } 974 else { 975 rtnVal = dbColumn.valueAction( action,oldValue,newValue ); 976 } 977 978 if( rtnVal == null ) { rtnVal = dbColumn.getDefault(); } 979 980 return rtnVal; 981 } 982 983 /** 984 * 【TAG】指定?回数?け?繰り返し処?行う回数を指定しま?初期値:1)? 985 * 986 * @og.tag 987 * 追???時に、指定?回数?け?処?繰り返して、新規に行を 988 * 作?します? 989 * 繰り返しは、指定?行に対して行われ?繰り返し毎に、直前に作?され? 990 * 行を?処?ます?これは、例えば、columnSet で、action="ADD"の場合に? 991 * 繰り返す毎に、ADD処?実行されることを意味します? 992 * 行が?されて???合?、?頭空行に追?ます? 993 * 初期値は?回です? 994 * 995 * @og.rev 3.5.4.2 (2003/12/15) 新規追? 996 * 997 * @param rc 繰り返し処?行う回数を指?初期値:1) 998 */ 999 public void setRepeatCount( final String rc ) { 1000 repeatCount = nval( getRequestParameter( rc ),repeatCount ); 1001 } 1002 1003 /** 1004 * 【TAG】Consistency キー による整合?チェ?を行うかど?を指定しま?初期値:true)? 1005 * 1006 * @og.tag 1007 * 検索結果?DBTableModel にセ?する時に、整合?キーの Consistency キー? 1008 * 作?します?これを?Viewタグでhidden出力しておき、Entryタグで??タ書き換え時に 1009 * 整合?チェ?を行います?これは、IEの戻る?タンで戻った?合に、画面の 1010 * キーと検索結果の DBTableModel の?が??しな??合?エラーチェ?に 1011 * なります? 1012 * こ?属?は、何らか?ケースで、このエラーチェ?を行いたくな??合に? 1013 * false に設定することで、整合?チェ?を行いません? 1014 * 初期値は、true(整合?チェ?を行う)です? 1015 * 1016 * @og.rev 3.5.5.7 (2004/05/10) 新規登録 1017 * 1018 * @param ck Consistency Key の使用するかど?(初期値:true) 1019 */ 1020 public void setUseConsistency( final String ck ) { 1021 useConsistency = nval( getRequestParameter( ck ),useConsistency ); 1022 } 1023 1024 /** 1025 * DBTableModel の 整合?パラメータとリクエスト情報を比?ェ?します? 1026 * リクエスト情報は、その DBTableModel が?力された view で hidden 属?で 1027 * 設定されます? 1028 * 設定されるキーは、tableId が変更されて?ければ、HybsSystem.CONSISTENCY_KEY です? 1029 * 変更されて?ば、HybsSystem.CONSISTENCY_KEY + tableId です? 1030 * 1031 * @og.rev 3.5.5.8 (2004/05/20) Consistency キー による整合?チェ??checkConsistency() に??ます? 1032 * 1033 * @return チェ?結果 true:正常/false:異常 1034 * @see org.opengion.hayabusa.common.HybsSystem#CONSISTENCY_KEY 1035 */ 1036 private boolean checkConsistency() { 1037 boolean rtn = true; 1038 String key = HybsSystem.CONSISTENCY_KEY ; 1039 1040 String consisKey = getRequestValue( key ); 1041 if( consisKey != null && consisKey.length() > 0 ) { 1042 if( useConsistency && ! consisKey.equals( table.getConsistencyKey() ) ) { 1043 1044 ErrorMessage errMsgObj = new ErrorMessage( "Consistency Key Check Error!" ); 1045 errMsgObj.addMessage( 0,ErrorMessage.NG,"ERR0033.1" ); 1046 errMsgObj.addMessage( 0,ErrorMessage.NG,"ERR0033.2" ); 1047 errMsgObj.addMessage( 0,ErrorMessage.NG,"ERR0033.3" ); 1048 jspPrint( TaglibUtil.makeHTMLErrorTable( errMsgObj,getResource() ) ); 1049 rtn = false; 1050 } 1051 } 1052 else { 1053 System.out.println( "EntryTag:Consistency Key is null" ); 1054 } 1055 return rtn ; 1056 } 1057 1058 /** 1059 * 表示??タの HybsSystem.ROW_SEL_KEY を?に?ばれた 行を処??対象とします? 1060 * 1061 * @og.rev 3.8.1.1 (2005/11/21) selectedAll 追??全件選択されたこととして、??ます? 1062 * @og.rev 4.0.0.0 (2005/01/31) getParameterRows() を使用するように変更 1063 * 1064 * @return 選択行?配? 1065 */ 1066 @Override 1067 protected int[] getParameterRows() { 1068 final int[] rowNo ; 1069 if( selectedAll ) { 1070 int rowCnt = table.getRowCount(); // 3.5.5.7 (2004/05/10) 1071 rowNo = new int[ rowCnt ]; 1072 for( int i=0; i<rowCnt; i++ ) { 1073 rowNo[i] = i; 1074 } 1075 } else { 1076 rowNo = super.getParameterRows(); // 4.0.0 (2005/01/31) 1077 } 1078 return rowNo ; 1079 } 1080 1081 /** 1082 * 【TAG】データを?件選択済みとして処?るかど?[true/false]を指定しま?初期値:false)? 1083 * 1084 * @og.tag 1085 * 全ての??タを選択済み??タとして扱って処?ます? 1086 * 全件処?る?合に?true/false)を指定します? 1087 * 初期値は false です? 1088 * 1089 * @param all ??タを?件選択済み [true:全件選択済み/false:通常] 1090 */ 1091 public void setSelectedAll( final String all ) { 1092 selectedAll = nval( getRequestParameter( all ),selectedAll ); 1093 } 1094 1095 /** 1096 * 【TAG】カラ??の存在チェ?を行うかど?[true/false]を指定しま?初期値:true)? 1097 * 1098 * @og.tag 1099 * true の場合?カラ??がDBTableModel に存在しな??合?、エラーになります? 1100 * false の場合?カラ??がDBTableModel に存在しな??合?、無視します? 1101 * これは、検索条件によって、設定されるカラ?異なる?合でも?entryタグ? 1102 * 正常に動作させた??合に、使用します? 1103 * 初期値は true (チェ?を行う) です? 1104 * 1105 * @param check 存在チェ?を行うかど? [true:行う/false:行わない] 1106 */ 1107 public void setStrictCheck( final String check ) { 1108 strictCheck = nval( getRequestParameter( check ),strictCheck ); 1109 } 1110 1111 /** 1112 * 【TAG?通常は使?せん)画面遷移を行わな?式?登録方法を使用するかを?します? 1113 * 1114 * @og.tag 1115 * 画面遷移なし?登録を行うかど?を指定します? 1116 * trueが指定された場合?entryタグでは、行?追????時にDBTableModel上??行に??タ? 1117 * 追?ます? 1118 * 画面遷移なしモード?場合?途中行に挿入された?合?既にクライアントに出力されて? 1119 * チェ?ボックスの行番号?入力フィールド?変数名との整合?を合わせるためには? 1120 * 編?以降??数値を?て再計算する?があります? 1121 * こ?処??、レスポンス悪化に繋がるため?DBTableModel上?、中間に行?挿入を行いません? 1122 * ?画面表示上???常通り選択行?直下に行が挿入されるため?DBTableModelの?と標準?? 1123 * 異なります?(エンジン側では、各チェ?ボックスの値で行を識別して?ため、問題?発生しません) 1124 * 1125 * こ?値は、og:headタグで設定?、また?前画面からの値を継承するため??常、この属?ではセ?しません? 1126 * 1127 * @og.rev 4.3.3.0 (2008/10/01) 新規追? 1128 * @og.rev 5.1.3.0 (2010/02/01) noTransition、ajaxSubmitのコントロールは、requestで行う? 1129 * 1130 * @param noTrnstn 画面遷移を行わな?式?登録方法を使用する? 1131 */ 1132 public void setNoTransition( final String noTrnstn ) { 1133 setNoTransitionRequest( nval( getRequestParameter( noTrnstn ), isNoTransitionRequest() ) ); 1134 // noTransition = nval( getRequestParameter( noTrnstn ), noTransition ); 1135 } 1136 1137 /** 1138 * シリアライズ用のカスタ?リアライズ書き込みメソ? 1139 * 1140 * @og.rev 4.0.0.0 (2006/09/31) 新規追? 1141 * @serialData ?のオブジェクト?、シリアライズされません? 1142 * 1143 * @param strm ObjectOutputStreamオブジェク? 1144 * @throws IOException シリアライズに関する入出力エラーが発生した?? 1145 */ 1146 private void writeObject( final ObjectOutputStream strm ) throws IOException { 1147 strm.defaultWriteObject(); 1148 } 1149 1150 /** 1151 * シリアライズ用のカスタ?リアライズ読み込みメソ? 1152 * 1153 * ここでは、transient 宣?れた?変数の??初期化が?なフィールド?み設定します? 1154 * 1155 * @og.rev 4.0.0.0 (2006/09/31) 新規追? 1156 * @serialData ?のオブジェクト?、シリアライズされません? 1157 * 1158 * @param strm ObjectInputStreamオブジェク? 1159 * @see #release2() 1160 * @throws IOException シリアライズに関する入出力エラーが発生した?? 1161 * @throws ClassNotFoundException クラスを見つけることができなかった?? 1162 */ 1163 private void readObject( final ObjectInputStream strm ) throws IOException , ClassNotFoundException { 1164 strm.defaultReadObject(); 1165 } 1166 1167 /** 1168 * こ?オブジェクト???表現を返します? 1169 * 基本???目?使用します? 1170 * 1171 * @return こ?クラスの??表現 1172 */ 1173 @Override 1174 public String toString() { 1175 return org.opengion.fukurou.util.ToString.title( this.getClass().getName() ) 1176 .println( "VERSION" ,VERSION ) 1177 .println( "tableId" ,tableId ) 1178 .println( "command" ,command ) 1179 .println( "rowNo" ,rowNo ) 1180 .println( "repeatCount" ,repeatCount ) 1181 .println( "useConsistency" ,useConsistency ) 1182 .println( "selectedAll" ,selectedAll ) 1183 .println( "strictCheck" ,strictCheck ) 1184 .println( "noTransition" ,noTransition ) 1185 .println( "RESET_ACTION_ALL_USE" ,RESET_ACTION_ALL_USE ) 1186 .println( "Other..." ,getAttributes().getAttribute() ) 1187 .fixForm().toString() ; 1188 } 1189 }