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.Arrays;
021 import java.util.Enumeration;
022 import java.util.Locale;
023 import java.util.Set;
024 import java.util.TreeSet;
025
026 import org.opengion.fukurou.util.ErrorMessage;
027 import org.opengion.fukurou.util.StringUtil;
028 import org.opengion.hayabusa.common.HybsSystem;
029 import org.opengion.hayabusa.common.HybsSystemException;
030 import org.opengion.hayabusa.db.DBColumn;
031 import org.opengion.hayabusa.db.DBTableModel;
032
033 /**
034 * 登録ãƒ??タの物ç�?ƒ�ェãƒ?‚¯(整合æ?チェãƒ?‚¯、nullチェãƒ?‚¯)を行うタグですã?
035 *
036 * コマンドに対応したチェãƒ?‚¯方式で、指定ã?カラãƒ?‚’チェãƒ?‚¯しますã?
037 * command="NEW" の場合ã?、columns 引数にCSV形式でæŒ?®šしたカラãƒ?��より
038 * リクエスト情報を取得して、å?をチェãƒ?‚¯しますã?
039 * 引数チェãƒ?‚¯ではã€?%" ã‚?"_" などのあいまã�?¤œ索時にæŒ?®šする記号ã‚?
040 * 含ã‚?�¨エラーになるカラãƒ??チェãƒ?‚¯対象からはずすå¿?¦�がある為ã€?
041 * チェãƒ?‚¯すべきカラãƒ?‚’æŒ?®šするå¿?¦�がありますã?
042 * command="ENTRY" の場合ã?、columns 引数に無関係に、å?てのリクエストされたカラãƒ?
043 * の値をチェãƒ?‚¯しますã?これは、å?の検索時ã?場合と異なりã?ENTRYでは
044 * ãƒ??タベã?スに値を設定する為、無条件にチェãƒ?‚¯するå¿?¦�がありますã?
045 * nullCheck は、command に無関係にæŒ?®šã?カラãƒ?�Œ null (ゼロæ–?—å?)かどã�?�‹ã‚?
046 * 判定しますã?
047 * maxRowCount は、ä¸?¦§検索時ã?チェãƒ?‚¯された件数がã?æŒ?®šã?値をè¶?�ˆたå?合に
048 * エラーになりますã?minRowCount は、同様に、最小選択件数(設定å?を含ã‚?のæŒ?®šですã?
049 * こã?タグは、エラー時には、それ以降ã?JSP画面を評価しませんã€?ODY 部に記述されã�?
050 * 値は、エラー時ã?み表示され、正常時には、なにも表示されません。これã?、エラー時ã?
051 * メãƒ?‚»ージã‚??ユーザーにエラー時ã?アクションを行ってもらã�??合ã?処ç�?例えばã€?
052 * 画面を戻る為のボタンなど)を表示させますã?
053 * useColumnLabel ã‚?true にセãƒ?ƒˆすると、エラー時ã?カラãƒ?��(ラベル)をã?カラãƒ?‚ªブジェクトかã‚?
054 * 取得するよã�?�«なりますã?動的カラãƒ?®Ÿ行時ã‚??DBTableModelに対して、ColumnEditor等で
055 * ラベルを書き換えた場合に、有効ですã?false の場合ã?、基本çš?�«はラベルリソースからの
056 * 取得になりますが、ケースによっては、カラãƒ?‚ªブジェクトから取得してã�?‚‹場合もありますã?
057 * こã?属æ?は、互換性を重視し、å?期å?がã?false になってã�?�¾すã?
058 *
059 * command="MODIFY" , "DELETE" 時には、強制çš?�«、minRowCount="1" で処ç�?�—ますã?
060 *
061 * @og.formSample
062 * ●形式ï¼?lt;og:columnCheck command = "…" />
063 * ●形式ï¼?lt;og:columnCheck command = "…" >エラー時ã?み処ç�?</og:columnCheck>
064 * ●body?šなã�?あり
065 *
066 * ●Tag定義??
067 * <og:columnCheck
068 * command 【TAG】コマンド[NEW/RENEW/ENTRY]をセãƒ?ƒˆしまã�?初期値:NEW)
069 * columns 【TAG】チェãƒ?‚¯すべきカラãƒ??をカンマ区åˆ?‚Š(CSV形å¼?でæŒ?®šしまã�?
070 * nullCheck 【TAG】NULL チェãƒ?‚¯すべきカラãƒ??をカンマ区åˆ?CSV形å¼?りでæŒ?®šしまã�?
071 * mustAnyCheck 【TAG】選択å¿??カラãƒ?æŒ?®šã?カラãƒ??å†?œ€低ã?とつがNULLでなã�?ã‚?AA|BB|CC,XX|YY|ZZ" 形式でæŒ?®šしまã�?
072 * checkType 【TAGã€?チェãƒ?‚¯対象のãƒ??タ[AUTO/NEW/ENTRY]を指定しまã�?初期値:AUTO)
073 * maxRowCount 【TAG】ENTRY時にチェãƒ?‚¯で選択された行数のæœ?¤§値を設定しまã�?
074 * minRowCount 【TAG】ENTRY時にチェãƒ?‚¯で選択された行数のæœ?°�å?を設定しまã�?
075 * tableId 【TAGã€?通常は使ã�?�¾せん) sessionに登録されてã�?‚‹ DBTableModel を取りå?すキーを指定しまã�?
076 * matchKeys 【TAG】正規表現でのマッチングを行うカラãƒ??をカンマ区åˆ?‚Š(CSV形å¼?でæŒ?®šしまã�?
077 * matchVals 【TAG】正規表現でのマッチングを行うカラãƒ??に対する値(正規表現)をカンマ区åˆ?‚Š(CSV形å¼?でæŒ?®šしまã�?
078 * realTime 【TAGã€?通常使ã�?�¾せん)リアルタイãƒ?ƒ�ェãƒ?‚¯を行う場合に有効にしまã�?
079 * useStrict 【TAG】NEWの場合に、厳å¯?�«チェãƒ?‚¯するかどã�?�‹[true/false]を指定しまã�?初期値:false)
080 * useColumnLabel 【TAG】カラãƒ?ƒ©ベルを使用するかどã�?�‹[true/false]を指定しまã�?初期値:false)
081 * checkNames 【TAG】リクエスト変数の正規化を行うカラãƒ?‚’CSV形式でè¤?•°æŒ?®šしまã�?
082 * debug 【TAG】デバッグæƒ??をå?力するかどã�?�‹[true/false]を指定しまã�?初期値:false)
083 * > ... Body ...
084 * </og:columnCheck>
085 *
086 * ●使用ä¾?
087 * <og:columnCheck
088 * command = "{@command}"
089 * columns = "AAA,BBB,CCC" DB定義(DBColumnリソース)で定義したé ?›®(桁数,タイプç?でチェãƒ?‚¯しますã?
090 * maxRowCount = "1" チェãƒ?‚¯で選ばれた æœ?¤§選択件数(設定å?を含ã‚?を指定ã?
091 * minRowCount = "1" チェãƒ?‚¯で選ばれた æœ?°�選択件数(設定å?を含ã‚?を指定ã?
092 * nullCheck = "AAA,CCC" NULLチェãƒ?‚¯を実行しますã?
093 * />
094 *
095 * [エラー時に、BODY部に記述されたå?容をå?力するã?正常時には、このBODY部の記述は出力されませんã€?
096 * <og:columnCheck
097 * command = "{@command}"
098 * columns = "AAA,BBB,CCC" DB定義(DBColumnリソース)で定義したé ?›®(桁数,タイプç?でチェãƒ?‚¯しますã?
099 * nullCheck = "AAA,CCC" NULLチェãƒ?‚¯を実行しますã?
100 * >
101 * <form method="POST" action="forward.jsp" target="RESULT">
102 * <og:input type="button" onClick="history.back()" msg="MSG0049" accesskey="R" td="false" />
103 * </form>
104 * </og:columnCheck>
105 *
106 * mustAnyCheck 属æ?にã€?�¸択å¿??カラãƒ?‚’æŒ?®šしますã?
107 * 例:mustAnyCheck="AA|BB|CC"
108 * AA,BB,CC のカラãƒ?�§選択å¿??(すべてがnullならエラー)
109 * 例:mustAnyCheck="AA|BB|CC,XX|YY|ZZ"
110 * AA,BB,CC のセãƒ?ƒˆと、XX,YY,ZZのセãƒ?ƒˆでそれぞれ選択å¿??ã€?
111 * 例:mustAnyCheck="AA|XX,AA|YY,AA|ZZ"
112 * AA に値があれã?すべて成立ã?そうでなã�??合ã?、XX と YY と ZZ がすべてå¿??ã€?
113 * 例:mustAnyCheck="AA|BB,BB|CC,AA|CC"
114 * AA,BB,CC のå†??どれか?’つがå¿??ã€?Aがæ?立すれã?BBかCCがå¿??。同様にã€?
115 * BBがæ?立すれã?、AAかCCがå¿??ã€?
116 *
117 * 例:query.jsp
118 * <og:column name="AA" mustAny="true" />
119 * <og:column name="BB" mustAny="true" />
120 * <og:column name="XX" mustAny="XYZ" />
121 * <og:column name="YY" mustAny="XYZ" />
122 * result.jsp
123 * <og:columnCheck mustAnyCheck="AA|BB,XX|YY" />
124 * custom/custom.css
125 * .XYZ { background-color: Green; }
126 *
127 * ä¾?動的カラãƒ?�§、entry.jsp でのチェãƒ?‚¯を行う場合ã?
128 * entry.jsp
129 * <og:columnCheck command="NEW" columns="*" useColumnLabel="true" />
130 *
131 * useColumnLabel で、動çš?�«作æ?されたカラãƒ?SAVE=TRUEでキャãƒ?‚·ュ済み)を使って
132 * チェãƒ?‚¯しますã?command="NEW" なので、対象カラãƒ?‚’æŒ?®šするã?にã€?*" ですべてを選択しますã?
133 *
134 * @og.group 画面登録
135 *
136 * @version 4.0
137 * @author Kazuhiko Hasegawa
138 * @since JDK5.0,
139 */
140 public class ColumnCheckTag extends CommonTagSupport {
141 //* こã?プログラãƒ??VERSIONæ–?—å?を設定しますã? {@value} */
142 private static final String VERSION = "5.4.4.0 (2012/02/01)" ;
143
144 private static final long serialVersionUID = 544020120201L ;
145
146 /** command 引数に渡す事ã?出来ã‚?コマンãƒ? 新è¦?{@value} */
147 public static final String CMD_NEW = "NEW" ;
148 /** command 引数に渡す事ã?出来ã‚?コマンãƒ? 再検索 {@value} */
149 public static final String CMD_RENEW = "RENEW" ;
150 /** command 引数に渡す事ã?出来ã‚?コマンãƒ? エントリー {@value} */
151 public static final String CMD_ENTRY = "ENTRY" ;
152 /** command 引数に渡す事ã?出来ã‚?コマンãƒ?リスãƒ? */
153
154 // 4.3.1.1 (2008/08/23) transient 追åŠ?
155 private transient DBTableModel table = null; // 4.1.2.1 (2008/03/13)
156
157 private String tableId = HybsSystem.TBL_MDL_KEY; // 3.5.4.3 (2004/01/05)
158 private String command = CMD_NEW; // 無æŒ?®š時は、チェãƒ?‚¯を行うã€?
159 private String[] columns = null;
160 private String[] nullCheck = null;
161 private String[] mustAnyCheck= null; // 3.8.0.9 (2005/10/17)
162 private int maxRowCount = -1 ; // 初期値として?Œ無制限をæŒ?®?
163 private int minRowCount = -1 ; // 初期値として?Œ無制限をæŒ?®?
164 private String checkType = "AUTO";
165 private String bodyString = null; // 3.5.4.2 (2003/12/15)
166 private String[] matchKeys = null; // 4.0.0 (2005/11/30)
167 private String[] matchVals = null; // 4.0.0 (2005/11/30)
168 // private boolean isViewSimple= false; // 4.3.3.0 (2008/10/01)
169 private boolean isRealTime = false; // 4.3.7.0 (2009/06/01)
170 private boolean isStrict = false; // 5.2.2.0 (2010/11/01) NEWの場合に、厳å¯?�«チェãƒ?‚¯するフラグを追åŠ?
171
172 private boolean isColumnLabel= false; // 5.4.3.4 (2012/01/12) true の場合に、カラãƒ?ƒ©ベルを使用しますã?
173 // private boolean isTblClmLbl = false; // 5.4.3.4 (2012/01/12) true の場合に、DBTableModelのカラãƒ?�‹らラベルを取得しますã?
174
175 private String checkNames = null; // 5.4.3.8 (2012/01/24)
176
177 /**
178 * Taglibの開始タグが見つかったときに処ç�?�™ã‚?doStartTag() ã‚?オーバã?ライドしますã?
179 *
180 * @og.rev 3.5.4.2 (2003/12/15) エラー時に、BODY部に記述されたå?容をå?力するã?
181 * @og.rev 5.0.0.2 (2009/09/15) xss対å¿?>チェãƒ?‚¯する
182 *
183 * @return 後続å?ç�??æŒ?¤º( EVAL_BODY_BUFFERED )
184 */
185 @Override
186 public int doStartTag() {
187 // 5.0.0.2 (2009/09/15) XSSチェãƒ?‚¯しなã�?>する
188 // useXssCheck( false );
189 return ( EVAL_BODY_BUFFERED ); // Body を評価する
190 }
191
192 /**
193 * Taglibのタグ本体を処ç�?�™ã‚?doAfterBody() ã‚?オーバã?ライドしますã?
194 *
195 * @og.rev 3.5.4.2 (2003/12/15) エラー時に、BODY部に記述されたå?容をå?力するã?
196 *
197 * @return 後続å?ç�??æŒ?¤º(SKIP_BODY)
198 */
199 @Override
200 public int doAfterBody() {
201 bodyString = getBodyString();
202
203 return ( SKIP_BODY );
204 }
205
206 /**
207 * Taglibの終äº?‚¿グが見つかったときに処ç�?�™ã‚?doEndTag() ã‚?オーバã?ライドしますã?
208 *
209 * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応ã?release2() ã‚?doEndTag()で呼ぶã€?
210 * @og.rev 3.4.0.3 (2003/09/10) command="NEW" でエラー発生時には、DBTableModel をクリアするã€?
211 * @og.rev 3.5.4.2 (2003/12/15) HTMLTableViewForm クラス名変更(â‡?ViewForm_HTMLTable)
212 * @og.rev 3.5.4.2 (2003/12/15) エラー時に、BODY部に記述されたå?容をå?力するã?
213 * @og.rev 3.5.4.3 (2004/01/05) tableId 属æ?を追åŠ??
214 * @og.rev 3.5.4.4 (2004/01/16) エラー結果を表示するãƒ??ブル形式ã?フォーãƒ?¿®正
215 * @og.rev 3.5.5.2 (2004/04/02) TaglibUtil.makeHTMLErrorTable メソãƒ?ƒ‰を利用
216 * @og.rev 4.1.2.1 (2008/03/13) table 属æ?を追åŠ??
217 * @og.rev 4.3.3.0 (2008/10/01) viewSimple属æ?追åŠ?
218 * @og.rev 4.3.7.0 (2009/06/01) viewSimple属æ?名称変更 -> isRealTime
219 *
220 * @return 後続å?ç�??æŒ?¤º
221 */
222 @Override
223 public int doEndTag() {
224 debugPrint(); // 4.0.0 (2005/02/28)
225 int rtnCode = EVAL_PAGE;
226
227 // 4.1.2.1 (2008/03/13)
228 table = (DBTableModel)getObject( tableId );
229
230 // 3.4.0.3 (2003/09/10) コマンドが、NEW,RENEW 以外ã?場合ã?、DBTableModel はå¿??ã€?
231 if( !CMD_NEW.equals( command ) &&
232 !CMD_RENEW.equals( command ) &&
233 // getObject( tableId ) == null ) { // 3.5.4.3 (2004/01/05)
234 table == null ) { // 4.1.2.1 (2008/03/13)
235 String errMsg = "検索結果のオブジェクトが存在しませんã€?
236 + " command=[" + command + "]" ;
237 jspPrint( errMsg );
238 rtnCode = SKIP_PAGE ;
239 }
240 else {
241 // 3.5.5.2 (2004/04/02) TaglibUtil.makeHTMLErrorTable メソãƒ?ƒ‰を利用
242 ErrorMessage errMsg = makeErrorDBTable();
243 if( errMsg.getKekka() >= ErrorMessage.NG ) {
244 if( bodyString != null ) { jspPrint( bodyString ); } // 3.5.4.2 (2003/12/15)
245
246 // 4.3.3.0 (2008/10/01)
247 // jspPrint( TaglibUtil.makeHTMLErrorTable( errMsg,getResource() ) );
248 // 4.3.7.0 (2009/06/01)
249 if( isRealTime ) { jspPrint( TaglibUtil.makeHTMLSimpleErrorList( errMsg,getResource() ) ); }
250 else { jspPrint( TaglibUtil.makeHTMLErrorTable( errMsg, getResource() ) ); }
251
252 if( CMD_NEW.equals( command ) ) {
253 removeObject( tableId );
254 }
255 rtnCode = SKIP_PAGE ;
256 }
257 else if( errMsg.getKekka() == ErrorMessage.WARNING ) {
258 // 4.3.3.0 (2008/10/01)
259 // jspPrint( TaglibUtil.makeHTMLErrorTable( errMsg,getResource() ) );
260 // 4.3.7.0 (2009/06/01)
261 if( isRealTime ) { jspPrint( TaglibUtil.makeHTMLSimpleErrorList( errMsg,getResource() ) ); }
262 else { jspPrint( TaglibUtil.makeHTMLErrorTable( errMsg, getResource() ) ); } }
263 }
264
265 return( rtnCode );
266 }
267
268 /**
269 * タグリブオブジェクトをリリースしますã?
270 *
271 * キャãƒ?‚·ュされて再利用されるã?で、フィールドã?初期設定を行いますã?
272 *
273 * @og.rev 2.0.0.4 (2002/09/27) カスタãƒ?‚¿グの release() メソãƒ?ƒ‰をã?追åŠ?
274 * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応ã?release2() ã‚?doEndTag()で呼ぶã€?
275 * @og.rev 3.5.4.2 (2003/12/15) エラー時に、BODY部に記述されたå?容をå?力するã?
276 * @og.rev 3.5.4.3 (2004/01/05) tableId 属æ?を追åŠ??
277 * @og.rev 3.8.0.9 (2005/10/17) mustAnyCheck 属æ?を追åŠ??
278 * @og.rev 4.1.2.1 (2008/03/13) table 属æ?を追åŠ??
279 * @og.rev 4.3.3.0 (2008/10/01) viewSimple属æ?追åŠ?
280 * @og.rev 4.3.7.0 (2009/06/01) viewSimple属æ?名称変更 -> isRealTime
281 * @og.rev 5.2.2.0 (2010/11/01) NEWの場合に、厳å¯?�«チェãƒ?‚¯するフラグを追åŠ?
282 * @og.rev 5.4.3.4 (2012/01/12) isColumnLabelを追åŠ?
283 *
284 */
285 @Override
286 protected void release2() {
287 super.release2();
288 command = CMD_NEW; // 無æŒ?®š時は、チェãƒ?‚¯を行うã€?
289 columns = null;
290 nullCheck = null;
291 maxRowCount = -1 ; // 初期値として?Œ無制限をæŒ?®?
292 minRowCount = -1 ; // 初期値として?Œ無制限をæŒ?®?
293 checkType = "AUTO";
294 bodyString = null ; // 3.5.4.2 (2003/12/15)
295 tableId = HybsSystem.TBL_MDL_KEY; // 3.5.4.3 (2004/01/05)
296 mustAnyCheck= null; // 3.8.0.9 (2005/10/17)
297 matchKeys = null; // 4.0.0 (2005/11/30)
298 matchVals = null; // 4.0.0 (2005/11/30)
299 table = null; // 4.1.2.1 (2008/03/13)
300 // isViewSimple= false; // 4.3.3.0 (2008/10/01)
301 isRealTime = false; // 4.3.7.0 (2009/06/01)
302 isStrict = false; // 5.2.2.0 (2010/11/01) NEWの場合に、厳å¯?�«チェãƒ?‚¯するフラグを追åŠ?
303 isColumnLabel= false; // 5.4.3.4 (2012/01/12) true の場合に、カラãƒ?ƒ©ベルを使用しますã?
304 // isTblClmLbl = false; // 5.4.3.4 (2012/01/12) true の場合に、DBTableModelのカラãƒ?�‹らラベルを取得しますã?
305 checkNames = null; // 5.4.3.8 (2012/01/24)
306 }
307
308 /**
309 * DBColumn オブジェクトを作æ?して、DBColumn#valueCheck( String )で
310 * チェãƒ?‚¯を行う。その結果の、ErrorMessage オブジェクトを DBTableModel に
311 * 取り込んで、エラーの場合ã?、その表示を行うã€?
312 * 表示方法ã?、そのまま ViewForm オブジェクトを作æ?して、表示を行うã€?
313 *
314 * @og.rev 3.5.5.2 (2004/04/02) リターン値をã?DBTableModel から ErrorMessage に変更
315 * @og.rev 4.0.0.0 (2005/01/31) リターン値の ErrorMessage は、å¿?�š存在するã€?
316 * @og.rev 4.1.2.1 (2008/03/13) command="MODIFY" , "DELETE" 時には、強制çš?�«、minRowCount="1" で処ç�?�—ますã?
317 *
318 * @return エラーメãƒ?‚»ージのãƒ??ブルモãƒ?ƒ«
319 */
320 private ErrorMessage makeErrorDBTable() {
321 ErrorMessage errMsg = new ErrorMessage();
322
323 if( "AUTO".equals( checkType ) ) { checkType = command; }
324 if( CMD_ENTRY.equals( checkType ) ) {
325 errMsg.setTitle( "Request Column Error!" );
326 errMsg = makeEntryErrorMessage( errMsg );
327 errMsg = makeMaxRowCountErrorMessage( errMsg );
328 errMsg = makeMinRowCountErrorMessage( errMsg );
329 }
330 else if( CMD_NEW.equals( checkType ) ) {
331 errMsg.setTitle( "Entry Column Error!" );
332 errMsg = makeErrorMessage( errMsg );
333 errMsg = makeMaxRowCountErrorMessage( errMsg );
334 errMsg = makeMinRowCountErrorMessage( errMsg );
335 }
336 else if( minRowCount >= 0 || maxRowCount >= 0) { // -1 は制限無ã�?
337 errMsg.setTitle( "Row Count Error Limited Error!" );
338 errMsg = makeMaxRowCountErrorMessage( errMsg );
339 errMsg = makeMinRowCountErrorMessage( errMsg );
340 }
341 // 4.1.2.1 (2008/03/13) command="MODIFY" , "DELETE" 時には、強制çš?�«、minRowCount="1" で処ç�?�—ますã?
342 else if( "MODIFY,DELETE".indexOf( checkType ) >= 0 && minRowCount < 0 ) {
343 minRowCount = 1;
344 errMsg = makeMinRowCountErrorMessage( errMsg );
345 }
346 return errMsg;
347 }
348
349 /**
350 * ErrorMessageをセãƒ?ƒˆしますã?
351 * 引数のカラãƒ?��配å?よりリクエスト情報を取得して、å?をチェãƒ?‚¯しますã?
352 * DBColumn#valueCheck( String ) の結果のErrorMessageをすべて append
353 * してã�?��ますã?
354 *
355 * @og.rev 3.8.0.9 (2005/10/17) 選択å¿?? mustAnyCheck のチェãƒ?‚¯追åŠ?
356 * @og.rev 3.8.1.0 (2005/10/24) リクエスト情報の正規化変換(DBColumn#valueSet(String))中止
357 * @og.rev 3.8.5.3 (2006/06/30) リクエストに % , _ が含まれたときã?、削除しますã?
358 * @og.rev 4.1.2.1 (2008/03/13) must , mustAny の自動取得追åŠ?
359 * @og.rev 5.0.0.2 (2009/09/15) 個別にxssチェãƒ?‚¯をfalse
360 * @og.rev 5.1.9.0 (2010/08/01) 同じ名前のé ?›®はã€?つにまとめる(ラジオボタンç?
361 * @og.rev 5.2.0.0 (2010/09/01) リアルタイãƒ?ƒ�ェãƒ?‚¯の場合ã?、must,mustAnyの自動チェãƒ?‚¯は行わなã�?
362 * @og.rev 5.2.2.0 (2010/11/01) DBColumn#valueCheck で、甘ã�?ƒ�ェãƒ?‚¯を行うように、引数に isStrict を追åŠ?
363 * @og.rev 5.4.3.4 (2012/01/12) getLabel( String )をã?リソースからに統ä¸?�™るとともに、isColumnLabel 対応を行うã€?
364 * @og.rev 5.4.3.8 (2012/01/28) checkNames対å¿?
365 *
366 * @param errMsg ErrorMessageオブジェクãƒ?
367 *
368 * @return カラãƒ?‚ー ??値 のエラーメãƒ?‚»ージオブジェクãƒ?
369 */
370 private ErrorMessage makeErrorMessage( final ErrorMessage errMsg ) {
371
372 // 4.1.2.1 (2008/03/13) must , mustAny の自動取得追åŠ?
373 // request から取å?ã�?注意:mustAny 以外ã?自由形式ã?値はæ‰?¾—してã�?�¾せんã€?
374 // 5.2.0.0 (2010/09/01) リアルタイãƒ?ƒ�ェãƒ?‚¯の場合ã?、must,mustAnyの自動チェãƒ?‚¯は行わなã�?
375 // (基本çš?�«パラメーターをé?らなã�?™�りè?動チェãƒ?‚¯は動かなã�?�Œ、RequestCacheにより動くことがあã‚?
376 if( !isRealTime ) {
377 if( nullCheck == null ) {
378 nullCheck = getRequestValues( HybsSystem.MUST_KEY + "must" );
379 // 5.1.9.0 (2010/08/01) 同じ名前のé ?›®はã€?つにまとめる(ラジオボタンç?
380 // if( nullCheck != null ) { Arrays.sort( nullCheck ); }
381 if( nullCheck != null ) {
382 Set<String> ss = new TreeSet<String>();
383 ss.addAll( Arrays.asList( nullCheck ) );
384 // nullCheck = ss.toArray( new String[0] );
385 nullCheck = ss.toArray( new String[ss.size()] ); // 5.1.9.0 (2010/08/01) K.H
386 }
387 }
388 if( mustAnyCheck == null ) {
389 String[] mustAnyReq = getRequestValues( HybsSystem.MUST_KEY + "mustAny" );
390 if( mustAnyReq != null && mustAnyReq.length > 0 ) {
391 mustAnyCheck = new String[] { StringUtil.array2line( mustAnyReq,"|" ) };
392 }
393 }
394 }
395
396 if( nullCheck != null && nullCheck.length != 0 ) {
397 for( int i=0; i<nullCheck.length; i++ ) {
398 String clmKey = nullCheck[i]; // 5.4.3.4 (2012/01/12)
399 // String val = getRequestValue( nullCheck[i] );
400 // String val = getRequestValue( nullCheck[i], false ); // 5.0.0.2 (2009/09/15)
401 String val = getRequestValue( clmKey, false ); // 5.0.0.2 (2009/09/15)
402 if( val == null || val.length() == 0 ) {
403 // 5.4.3.4 (2012/01/12) isColumnLabel 追åŠ?
404 // String label = getLabel( nullCheck[i] ); // 4.0.0 (2005/01/31)
405 String label = (isColumnLabel) ? getDBColumn( clmKey ).getLabel() : getResource().getLabel( clmKey );
406 // ERR0012 : æŒ?®šã?ãƒ??タがセãƒ?ƒˆされてã�?�¾せんã€?NULLエラー)。key={0}
407 errMsg.addMessage( 0,ErrorMessage.NG,"ERR0012",label );
408 }
409 }
410 }
411 // 3.8.0.9 (2005/10/17) 選択å¿?? mustAnyCheck のチェãƒ?‚¯追åŠ?
412 if( mustAnyCheck != null && mustAnyCheck.length != 0 ) {
413 for( int i=0; i<mustAnyCheck.length; i++ ) {
414 boolean flag = false;
415 String[] mustSub = StringUtil.csv2Array( mustAnyCheck[i],'|' );
416 for( int j=0; j<mustSub.length; j++ ) {
417 // String val = getRequestValue( mustSub[j] );
418 String val = getRequestValue( mustSub[j], false ); // 5.0.0.2 (2009/09/15)
419 if( val != null && val.length() > 0 ) {
420 flag = true; break; // ひとつでもnullでなければ、OK
421 }
422 }
423 if( ! flag ) {
424 StringBuilder buf = new StringBuilder();
425 for( int j=0; j<mustSub.length; j++ ) {
426 String clmKey = mustSub[j]; // 5.4.3.4 (2012/01/12)
427 // 5.4.3.4 (2012/01/12) isColumnLabel 追åŠ?
428 // buf.append( getResource().getLabel( mustSub[j] ) ).append( "," );
429 String label = (isColumnLabel) ? getDBColumn( clmKey ).getLabel() : getResource().getLabel( clmKey );
430 buf.append( label ).append( "," );
431 }
432 // ERR0036 : 選択å¿??エラー。以下ã?ãƒ??タのå†?�©れかは入力してください。key={0}
433 errMsg.addMessage( 0,ErrorMessage.NG,"ERR0036",buf.toString() );
434 }
435 }
436 }
437 if( columns != null && columns.length != 0 ) {
438 for( int i=0; i<columns.length; i++ ) {
439 // 3.8.1.0 (2005/10/24) リクエスト情報の正規化変換(DBColumn#valueSet(String))中止
440 // String clmVal = getRequestValue( columns[i] );
441 String clmVal = getRequestValue( columns[i], false ); // 5.0.0.2 (2009/09/15)
442 if( clmVal != null && clmVal.length() > 0 ) {
443 clmVal = StringUtil.replace( clmVal,"%","" ); // 3.8.5.3 (2006/06/30)
444 clmVal = StringUtil.replace( clmVal,"_","" ); // 3.8.5.3 (2006/06/30)
445 DBColumn dbColumn = getDBColumn( columns[i] );
446 // 5.4.3.8 (2012/01/24) checkNames対å¿?
447 if( ( "," + checkNames + "," ).indexOf( "," + columns[i] + "," ) >= 0 ) {
448 String val = dbColumn.valueSet( clmVal );
449 if( val != null ) { clmVal = val; }
450 }
451 // 5.2.2.0 (2010/11/01) DBColumn#valueCheck で、甘ã�?ƒ�ェãƒ?‚¯を行うように、引数に isStrict を追åŠ?
452 // errMsg.append( dbColumn.valueCheck( clmVal ) );
453 errMsg.append( dbColumn.valueCheck( clmVal,isStrict ) );
454 }
455 }
456 }
457 // 4.0.0 (2005/11/30) 正規表現チェãƒ?‚¯の追åŠ?
458 if( matchKeys != null && matchKeys.length != 0 ) {
459 for( int i=0; i<matchKeys.length; i++ ) {
460 String clmKey = matchKeys[i]; // 5.4.3.4 (2012/01/12)
461 // String val = getRequestValue( matchKeys[i] );
462 // String val = getRequestValue( matchKeys[i], false ); // 5.0.0.2 (2009/09/15)
463 String val = getRequestValue( clmKey, false ); // 5.0.0.2 (2009/09/15)
464 if( val != null && ! val.matches( matchVals[i] ) ) {
465 // 5.4.3.4 (2012/01/12) isColumnLabel 追åŠ?
466 // String label = getLabel( matchKeys[i] );
467 String label = (isColumnLabel) ? getDBColumn( clmKey ).getLabel() : getResource().getLabel( clmKey );
468 // ERR0037 : ãƒ??タ整合æ?エラー。指定ã?キーは整合æ?チェãƒ?‚¯の結果マッチしませんでした。key={0} val={1} regex={2}
469 errMsg.addMessage( 0,ErrorMessage.NG,"ERR0037",label,val,matchVals[i] );
470 }
471 }
472 }
473
474 return errMsg;
475 }
476
477 /**
478 * エントリーãƒ??タのErrorMessageをセãƒ?ƒˆしますã?
479 * 引数のカラãƒ?��配å?よりエントリーãƒ??タ形式ã?リクエスト情報を取得してã€?
480 * 値をチェãƒ?‚¯しますã?
481 * DBColumn#valueCheck( String ) の結果のErrorMessageをすべて append
482 * してã�?��ますã?
483 *
484 * @og.rev 3.1.0.0 (2003/03/20) 名前と行番号の区åˆ?‚Š記号ã‚?"^" から "__" に変更ã€?
485 * @og.rev 3.5.5.0 (2004/03/12) 名前と行番号の区åˆ?‚Š記号("__")をã?HybsSystem.JOINT_STRING に変更ã€?
486 * @og.rev 3.8.0.9 (2005/10/17) 選択å¿?? mustAnyCheck のチェãƒ?‚¯追åŠ?
487 * @og.rev 4.1.2.1 (2008/03/13) must , mustAny の自動取得追åŠ?
488 * @og.rev 4.3.6.4 (2009/05/01) 削除時にå¿?�šmustAnyチェãƒ?‚¯エラーになるバグを修正(書込み可能行ã?みをå?ç�?�™ã‚?
489 * @og.rev 4.3.7.0 (2009/06/01) リアルタイãƒ?ƒ�ェãƒ?‚¯の場合ã?、must,mustAnyの自動チェãƒ?‚¯は行わなã�?
490 * @og.rev 5.0.0.2 (2009/09/15) xssチェãƒ?‚¯
491 * @og.rev 5.4.3.4 (2012/01/12) getLabel( String )をã?リソースからに統ä¸?�™るとともに、isColumnLabel 対応を行うã€?
492 *
493 * @param errMsg ErrorMessageオブジェクãƒ?
494 *
495 * @return カラãƒ?‚ー ??値 のエラーメãƒ?‚»ージオブジェクãƒ?
496 */
497 private ErrorMessage makeEntryErrorMessage( final ErrorMessage errMsg ) {
498 int[] rowNo = getParameterRows();
499 if( rowNo.length == 0 ) { return errMsg; }
500
501 // 4.1.2.1 (2008/03/13) must , mustAny の自動取得追åŠ?
502 // table から取å?ã�?(ソート済み)
503 // 4.3.7.0 (2009/06/01) リアルタイãƒ?ƒ�ェãƒ?‚¯の場合ã?、must,mustAnyの自動チェãƒ?‚¯は行わなã�?
504 if( !isRealTime ) {
505 if( nullCheck == null ) { nullCheck = table.getMustArray(); }
506 if( mustAnyCheck == null ) { mustAnyCheck = table.getMustAnyArray(); }
507 }
508
509 // 3.8.0.9 (2005/10/17) 選択å¿?? mustAnyCheck のチェãƒ?‚¯追åŠ?
510 boolean[][] rowAnyOne = null;
511 // 4.3.6.4 (2009/05/01)
512 boolean[] rowForCheck = null;
513 if( mustAnyCheck != null && mustAnyCheck.length != 0 ) {
514 rowAnyOne = new boolean[rowNo.length][mustAnyCheck.length];
515 rowForCheck = new boolean[rowNo.length];
516 // for( int i=0; i<rowNo.length; i++ ) {
517 // Arrays.fill( rowAnyOne[i],false );
518 // }
519 }
520
521 DBColumn dbColumn = null; // 5.4.3.4 (2012/01/12) isColumnLabel 対å¿?
522 Enumeration<?> enume = getParameterNames(); // 4.3.3.6 (2008/11/15) Generics警告対å¿?
523 while( enume.hasMoreElements() ) {
524 String key = (String)(enume.nextElement());
525 int idx = key.lastIndexOf(HybsSystem.JOINT_STRING);
526
527 if( idx > 0 ) {
528 String column = key.substring(0,idx);
529 int row = Integer.parseInt( key.substring(idx + 2) );
530 // String val = getRequestValue( key );
531 String val = getRequestValue( key, false ); // 5.0.0.2 (2009/09/15)
532
533 int i = Arrays.binarySearch( rowNo,row );
534 if( i >= 0 ) {
535 // 5.4.3.4 (2012/01/12) isColumnLabel 対å¿?
536 // DBColumn dbColumn = getDBColumn( column );
537 dbColumn = null;
538 if( isColumnLabel && table != null ) {
539 int clmNo = table.getColumnNo( column,false ); // エラーをå?さなã�??
540 if( clmNo >= 0 ) {
541 dbColumn = table.getDBColumn( clmNo );
542 }
543 }
544 if( dbColumn == null ) {
545 dbColumn = getDBColumn( column );
546 }
547
548 String val2 = dbColumn.valueSet( val );
549 errMsg.append( row+1,dbColumn.valueCheck( val2 ) );
550 if( nullCheck != null && nullCheck.length != 0 ) {
551 int j = Arrays.binarySearch( nullCheck,column );
552 if( j>=0 && ( val2 == null || val2.length() == 0 )) {
553 // ERR0012 : æŒ?®šã?ãƒ??タがセãƒ?ƒˆされてã�?�¾せんã€?NULLエラー)。key={0}
554 errMsg.addMessage( row+1,ErrorMessage.NG,"ERR0012",dbColumn.getLabel() );
555 }
556 }
557 // 3.8.0.9 (2005/10/17) 選択å¿?? mustAnyCheck のチェãƒ?‚¯追åŠ?
558 if( rowAnyOne != null ) {
559 for( int j=0; j<mustAnyCheck.length; j++ ) {
560 if( !rowAnyOne[i][j] &&
561 mustAnyCheck[j].indexOf( column ) >= 0 &&
562 val2 != null && val2.length() > 0 ) {
563 rowAnyOne[i][j] = true; // どれかが存在
564 }
565 }
566 // 4.3.6.4 (2009/05/01)
567 rowForCheck[i] = true;
568 }
569
570 // 4.0.0 (2005/11/30) 正規表現チェãƒ?‚¯の追åŠ?
571 if( matchKeys != null && matchKeys.length != 0 ) {
572 for( int j=0; j<matchKeys.length; j++ ) {
573 if( column.equals( matchKeys[j] ) ) {
574 if( val2 != null && ! val2.matches( matchVals[j] ) ) {
575 // 互換性はなくなってã�?‚‹がã?正規表現チェãƒ?‚¯は余り使ってã�?�ªã�??で、統ä¸?�—ておくã€?
576 // 5.4.3.4 (2012/01/12) isColumnLabel 対å¿?
577 dbColumn = null;
578 if( isColumnLabel && table != null ) {
579 int clmNo = table.getColumnNo( column,false ); // エラーをå?さなã�??
580 if( clmNo >= 0 ) {
581 dbColumn = table.getDBColumn( clmNo );
582 }
583 }
584 if( dbColumn == null ) {
585 dbColumn = getDBColumn( column );
586 }
587 // String label = getLabel( column );
588
589 // ERR0037 : ãƒ??タ整合æ?エラー。指定ã?キーは整合æ?チェãƒ?‚¯の結果マッチしませんでした。key={0} val={1} regex={2}
590 // errMsg.addMessage( 0,ErrorMessage.NG,"ERR0037",label,val2,matchVals[i] );
591 errMsg.addMessage( row+1,ErrorMessage.NG,"ERR0037",dbColumn.getLabel(),val2,matchVals[i] );
592 }
593 break;
594 }
595 }
596 }
597 }
598 }
599 }
600
601 // 3.8.0.9 (2005/10/17) 選択å¿?? mustAnyCheck のチェãƒ?‚¯追åŠ?
602 if( rowAnyOne != null ) {
603 for( int row=0; row<rowAnyOne.length; row++ ) {
604 // 4.3.6.4 (2009/05/01) 書込み可能行ã?みをå?ç�?�™ã‚?
605 if ( rowForCheck[row] ) {
606 for ( int i = 0; i < mustAnyCheck.length; i++ ) {
607 if ( !rowAnyOne[row][i] ) {
608 String[] mustSub = StringUtil.csv2Array( mustAnyCheck[i], '|' );
609
610 StringBuilder buf = new StringBuilder();
611 buf.append( "row=[" ).append( rowNo[row]+1 ).append( "] " );
612 for ( int j = 0; j < mustSub.length; j++ ) {
613 // ここの処ç�?� けã?他と異なるã?は、互換性重視ã?ためã€?選択å¿??は利用頻度が高いのでã€?
614 // 5.4.3.4 (2012/01/12) isColumnLabel 対å¿?
615 String label = null ;
616 if( isColumnLabel && table != null ) {
617 int clmNo = table.getColumnNo( mustSub[j],false ); // エラーをå?さなã�??
618 if( clmNo >= 0 ) {
619 dbColumn = table.getDBColumn( clmNo );
620 }
621 if( dbColumn == null ) {
622 dbColumn = getDBColumn( mustSub[j] );
623 }
624 label = dbColumn.getLabel();
625 }
626 else {
627 label = getResource().getLabel( mustSub[j] ); // 互換性のための処置ã€?
628 }
629 // buf.append( getResource().getLabel( mustSub[j] ) ).append( "|" );
630 buf.append( label ).append( "|" );
631 }
632 // ERR0036 : 選択å¿??エラー。以下ã?ãƒ??タのå†?�©れかは入力してください。key={0}
633 // errMsg.addMessage( 0, ErrorMessage.NG, "ERR0036", buf.toString() );
634 errMsg.addMessage( rowNo[row]+1, ErrorMessage.NG, "ERR0036", buf.toString() );
635 }
636 }
637 }
638 }
639 }
640
641 return errMsg;
642 }
643
644 /**
645 * ErrorMessageをセãƒ?ƒˆしますã?
646 * リクエストされた件数のæœ?¤§値に制限をåŠ?�ˆますã?
647 * ?‘件ã�?�‘にしたã�??合ã??Œé?常はViewでチェãƒ?‚¯ボックスを使用せずに
648 * ラジオボタンを使用してくださいã€?
649 *
650 * @param errMsg ErrorMessageオブジェクãƒ?
651 *
652 * @return カラãƒ?‚ー ??値 のエラーメãƒ?‚»ージオブジェクãƒ?
653 */
654 private ErrorMessage makeMaxRowCountErrorMessage( final ErrorMessage errMsg ) {
655 if( maxRowCount < 0 ) { return errMsg; } // 無制é™?
656
657 // 件数制限ã?チェãƒ?‚¯
658 int[] rowNo = getParameterRows();
659 int rowCount = rowNo.length ;
660 if( rowCount > maxRowCount ) {
661 // ERR0017 : 選択エラー。選択行数({0} 件)がã?æœ?¤§制限å?({1} 件)以上選ばれましたã€?
662 String arg0 = String.valueOf( rowCount );
663 String arg1 = String.valueOf( maxRowCount );
664 errMsg.addMessage( 0,ErrorMessage.NG,"ERR0017",arg0,arg1 );
665 }
666
667 return errMsg;
668 }
669
670 /**
671 * ErrorMessageをセãƒ?ƒˆしますã?
672 * リクエストされた件数のæœ?°�å?に制限をåŠ?�ˆますã?
673 * ?‘件ã�?�‘にしたã�??合ã??Œé?常はViewでチェãƒ?‚¯ボックスを使用せずに
674 * ラジオボタンを使用してくださいã€?
675 *
676 * @param errMsg ErrorMessageオブジェクãƒ?
677 *
678 * @return カラãƒ?‚ー ??値 のエラーメãƒ?‚»ージオブジェクãƒ?
679 */
680 private ErrorMessage makeMinRowCountErrorMessage( final ErrorMessage errMsg ) {
681 if( minRowCount < 0 ) { return errMsg; } // 無制é™?
682
683 // 件数制限ã?チェãƒ?‚¯
684 int[] rowNo = getParameterRows();
685 int rowCount = rowNo.length ;
686 if( rowCount < minRowCount ) {
687 // ERR0018 : 選択エラー。選択行数({0} 件)がã?æœ?°�制限å?({1} 件)以下選ばれましたã€?
688 String arg0 = String.valueOf( rowCount );
689 String arg1 = String.valueOf( minRowCount );
690 errMsg.addMessage( 0,ErrorMessage.NG,"ERR0018",arg0,arg1 );
691 }
692
693 return errMsg;
694 }
695
696 /**
697 * 【TAG】チェãƒ?‚¯すべきカラãƒ??をカンマ区åˆ?‚Š(CSV形å¼?でæŒ?®šしますã?
698 *
699 * @og.tag columns="AAA,BBB,CCC,DDD"
700 * <del>先に配å?にåˆ?§£してからリクエスト変数の値を取得するよã�?�«しますã?
701 * こうする事で、リクエストにカンマ区åˆ?‚Šの値を設定できるようになりますã?</del>
702 * åˆ?§£方法ã?ã€??常のパラメータ取得後に、CSVåˆ?§£しますã?
703 * "*" を指定すると、command="NEW" のときã?判定にすべてのリクエスト文字å?ã‚?
704 * チェãƒ?‚¯対象としますã?通常は、å¿?¦�å?ã�?�‘æŒ?®šしますが、動çš?‚«ラãƒ?�ªどの
705 * 場合ã?、カラãƒ?��を予めæŒ?®šできなã�?�Ÿめã?"*" でæŒ?®šできるようにしますã?
706 * そã?場合ã?"h_" , "hX_" , maxRowCount , command , pageSize , pagePlus ,
707 * GAMENID , BACK_JSPID , BACK_GAMENID の予ç´?ªžã?、対象から除きますã?
708 *
709 * @og.rev 3.5.6.2 (2004/07/05) 先に配å?にåˆ?§£してからリクエスト変数の値を取å¾?
710 * @og.rev 3.8.8.5 (2007/03/09) 通常のパラメータ取得後に、CSVåˆ?§£に戻しますã?
711 * @og.rev 5.4.3.4 (2012/01/12) command="NEW" のときã?動的カラãƒ?¯¾å¿? "*" ですべてのリクエスãƒ?
712 *
713 * @param clms カラãƒ??(CSV形å¼?
714 */
715 public void setColumns( final String clms ) {
716 columns = StringUtil.csv2Array( getRequestParameter( clms ) );
717 if( columns.length == 0 ) { columns = null; }
718
719 // 5.4.3.4 (2012/01/12) command="NEW" のときã?動的カラãƒ?¯¾å¿? "*" ですべてのリクエスãƒ?
720 if( columns != null && "*".equals( columns[0] ) ) {
721 Set<String> clmSet = new TreeSet<String>(); // リクエストã?バラバラなので、とりあえずソートしてきますã?
722
723 Enumeration<?> enume = getParameterNames(); // Generics警告対å¿?
724 while( enume.hasMoreElements() ) {
725 String clm = (String)(enume.nextElement());
726 // 予ç´?ªž以外を登録しますã?
727 if( clm != null && !clm.isEmpty() && !clm.startsWith( "h_" ) && !clm.startsWith( "hX_" ) ) {
728 clmSet.add( clm );
729 }
730 }
731 // 予ç´?ªžを削除しますã?
732 clmSet.remove( "maxRowCount" );
733 clmSet.remove( "command" );
734 clmSet.remove( "pageSize" );
735 clmSet.remove( "pagePlus" );
736 clmSet.remove( "GAMENID" );
737 clmSet.remove( "BACK_JSPID" );
738 clmSet.remove( "BACK_GAMENID" );
739
740 columns = clmSet.toArray( new String[clmSet.size()] );
741 }
742 }
743
744 /**
745 * 【TAG】NULL チェãƒ?‚¯すべきカラãƒ??をカンマ区åˆ?CSV形å¼?りでæŒ?®šしますã?
746 *
747 * @og.tag
748 * (must 属æ?のセãƒ?ƒˆにより、è?動å?ç�?�•れまã�?
749 * nullCheck="AAA,BBB,CCC,DDD"
750 * <del>先に配å?にåˆ?§£してからリクエスト変数の値を取得するよã�?�«しますã?
751 * こうする事で、リクエストにカンマ区åˆ?‚Šの値を設定できるようになりますã?</del>
752 * åˆ?§£方法ã?ã€??常のパラメータ取得後に、CSVåˆ?§£しますã?
753 *
754 * @og.rev 3.5.6.2 (2004/07/05) 先に配å?にåˆ?§£してからリクエスト変数の値を取å¾?
755 * @og.rev 3.8.8.5 (2007/03/09) 通常のパラメータ取得後に、CSVåˆ?§£に戻しますã?
756 *
757 * @param clms カラãƒ??(CSV形å¼?
758 */
759 public void setNullCheck( final String clms ) {
760 nullCheck = StringUtil.csv2Array( getRequestParameter( clms ) );
761 if( nullCheck.length == 0 ) { nullCheck = null; }
762 else {
763 Arrays.sort( nullCheck );
764 }
765 }
766
767 /**
768 * 【TAG】選択å¿??カラãƒ?æŒ?®šã?カラãƒ??å†?œ€低ã?とつがNULLでなã�?ã‚?AA|BB|CC,XX|YY|ZZ" 形式でæŒ?®šしますã?
769 *
770 * @og.tag
771 * (mustAny 属æ?のセãƒ?ƒˆにより、è?動å?ç�?�•れまã�?
772 * è¤?•°のカラãƒ?±žæ?の値のã�?�¡、どれかã�?null でなã�??合ã?正常としã?
773 * すべてã�?null の場合を警告しますã?
774 *
775 * 例:mustAnyCheck="AA|BB|CC"
776 * AA,BB,CC のカラãƒ?�§選択å¿??(すべてがnullならエラー)
777 * 例:mustAnyCheck="AA|BB|CC,XX|YY|ZZ"
778 * AA,BB,CC のセãƒ?ƒˆと、XX,YY,ZZのセãƒ?ƒˆでそれぞれ選択å¿??ã€?
779 * 例:mustAnyCheck="AA|XX,AA|YY,AA|ZZ"
780 * AA に値があれã?すべて成立ã?そうでなã�??合ã?、XX と YY と ZZ がすべてå¿??ã€?
781 * 例:mustAnyCheck="AA|BB,BB|CC,AA|CC"
782 * AA,BB,CC のå†??どれか?’つがå¿??ã€?Aがæ?立すれã?BBかCCがå¿??。同様にã€?
783 * BBがæ?立すれã?、AAかCCがå¿??ã€?
784 *
785 * 選択å¿??は、must と同様に、色づけを行う(query.jsp)画面では、mustAny 属æ?ã‚?
786 * セãƒ?ƒˆしますã?チェãƒ?‚¯を行う(result.jsp)画面では、columnCheck タグの
787 * mustAnyCheck 属æ?にã€?�¸択å¿??カラãƒ?‚’æŒ?®šしますã?(上記参照)
788 * column タグ等ã? mustAny 属æ?に、mustAny="true" とセãƒ?ƒˆすると、生成される
789 * HTMLは、class="mustAny" がå?力されますã?エンジン標準では、default.css に
790 * .mustAny が定義されてã�?�¾すã?( background-color: #CCFFFF; )
791 * なおã?mustAny 属æ?に、true 以外ã?値をセãƒ?ƒˆした場å�?mustAny="XYZ")はã€?
792 * 生æ?されるHTMLに、class="XYZ" がå?力されますã?これは、è¤?•°のグループ間で
793 * 色を変えてã€?�¸択å¿??を指定するå?合に使用しますã?色は、custom/custom.css
794 * でæŒ?®šしますã?
795 * åˆ?§£方法ã?ã€??常のパラメータ取得後に、CSVåˆ?§£しますã?
796 *
797 * @og.rev 3.8.0.9 (2005/10/17) 新規追åŠ?
798 * @og.rev 3.8.8.5 (2007/03/09) 通常のパラメータ取得後に、CSVåˆ?§£に戻しますã?
799 *
800 * @param clms 選択å¿??カラãƒ?
801 */
802 public void setMustAnyCheck( final String clms ) {
803 mustAnyCheck = StringUtil.csv2Array( getRequestParameter( clms ) );
804 if( mustAnyCheck.length == 0 ) { mustAnyCheck = null; }
805 else {
806 Arrays.sort( mustAnyCheck );
807 }
808 }
809
810 /**
811 * 【TAG】コマンド[NEW/RENEW/ENTRY]をセãƒ?ƒˆしまã�?初期値:NEW)ã€?
812 *
813 * @og.tag
814 * コマンドã?,HTMLから(get/post)æŒ?®šされますã?で,CMD_xxx で設定される
815 * フィールド定数値のã�?�¥れかをã?æŒ?®šできますã?
816 * 何も設定されなã�??またã?、null の場合ã?ã€?NEW" がå?期å?にセãƒ?ƒˆされますã?
817 *
818 * @param cmd コマンãƒ?public static final 宣è¨?�•れてã�?‚‹æ–?—å?)
819 * @see <a href="{@docRoot}/constant-values.html#org.opengion.hayabusa.taglib.ColumnCheckTag.CMD_NEW">コマンド定数</a>
820 */
821 public void setCommand( final String cmd ) {
822 String cmd2 = getRequestParameter( cmd );
823 if( cmd2 != null && cmd2.length() > 0 ) { command = cmd2.toUpperCase(Locale.JAPAN); }
824 }
825
826 /**
827 * 【TAGã€?チェãƒ?‚¯対象のãƒ??タ[AUTO/NEW/ENTRY]を指定しまã�?初期値:AUTO)ã€?
828 *
829 * @og.tag
830 * 通常のリクエストデータは、キーそã?もã?ですが,エントリãƒ??タは表形式ã?
831 * ãƒ??タをä¸?‹¬で登録する為ã€?キー??__" ??行番号)形式を、バラすå¿?¦�がありますã?
832 *
833 * ENTRY は、DBTableModelのリクエスト情報をチェãƒ?‚¯しますã?
834 * これは、å?ãƒ??タが対象になりますã?(columns/nullCheck 属æ?は無効)
835 * AUTO は、command がã?上è¨?NEW ã�?ENTRY かを判断して処ç�?‚’振りå?けますã?
836 * 初期値は、AUTO ですã?
837 *
838 * @param flag チェãƒ?‚¯対象のãƒ??タ(AUTO,NEW,ENTRY)
839 */
840 public void setCheckType( final String flag ) {
841 String ct = getRequestParameter( flag );
842 if( ct != null && ct.length() > 0 ) { checkType = ct ; }
843 }
844
845 /**
846 * 【TAGã€?del>ENTRY時に</del>チェãƒ?‚¯で選択された行数のæœ?¤§値を設定しますã?
847 *
848 * @og.tag
849 * æœ?¤§選択件数をè¶?�ˆたå?合ã?,エラーメãƒ?‚»ージを返しますã?
850 * 例えばã€?¼‘件のみを正常とする場合ã?、maxRowCount="1" としますã?
851 *
852 * @param count 制限をかけたい行数(こã?件数と同じ場合ã?正常 )
853 */
854 public void setMaxRowCount( final String count ) {
855 maxRowCount = nval( getRequestParameter( count ),maxRowCount );
856 }
857
858 /**
859 * 【TAGã€?del>ENTRY時に</del>チェãƒ?‚¯で選択された行数のæœ?°�å?を設定しますã?
860 *
861 * @og.tag
862 * æœ?°�選択件数をè¶?�ˆなã�??合ã?、エラーメãƒ?‚»ージを返しますã?
863 * 例えばã€?¼‘件のみを正常とする場合ã?、minRowCount="1" としますã?
864 *
865 * @param count 制限をかけたい行数(こã?件数と同じ場合ã?正常 )
866 */
867 public void setMinRowCount( final String count ) {
868 minRowCount = nval( getRequestParameter( count ), minRowCount );
869 }
870
871 /**
872 * 【TAGã€?通常は使ã�?�¾せん) sessionに登録されてã�?‚‹ DBTableModel を取りå?すキーを指定しますã?
873 *
874 * @og.tag
875 * 検索結果のDBTableModelを別メモリーにåˆ?�‘るå?合ã?、このキーを指定しますã?
876 * そã?場合ã?メモリ上から削除する方法がなã�?�Ÿã‚?session タイãƒ?‚¢ウトで破æ£?大量ã?
877 * ãƒ??タをå?けた場合ã?、ご注意くã�?�•ã�??
878 * 初期値は、HybsSystem.TBL_MDL_KEY ですã?
879 *
880 * @og.rev 3.5.4.3 (2004/01/05) 新規追åŠ?
881 *
882 * @param id sessionに登録する時ã? ID
883 */
884 public void setTableId( final String id ) {
885 tableId = nval( getRequestParameter( id ),tableId );
886 }
887
888 /**
889 * 【TAG】正規表現でのマッチングを行うカラãƒ??をカンマ区åˆ?‚Š(CSV形å¼?でæŒ?®šしますã?
890 *
891 * @og.tag matchKeys="AAA,BBB,CCC,DDD"
892 * matchKeys属æ?とmatchVals属æ?の個数は、同じでなければなりませんã€?
893 * 先に配å?にåˆ?§£してからリクエスト変数の値を取得するよã�?�«しますã?
894 * こうする事で、リクエストにカンマ区åˆ?‚Šの値を設定できるようになりますã?
895 *
896 * @og.rev 4.0.0.0 (2005/11/30) 新規作æ?
897 *
898 * @param keys カラãƒ??(CSV形å¼?
899 * @see #setMatchVals( String )
900 */
901 public void setMatchKeys( final String keys ) {
902 matchKeys = getCSVParameter( keys );
903
904 if( matchVals != null && matchKeys.length != matchVals.length ) {
905 String errMsg = "matchKeys属æ?とmatchVals属æ?の個数が合ã�?�¾せんã€?
906 + HybsSystem.CR
907 + " matchKeys=[" + matchKeys.length + "]:KEYS="
908 + StringUtil.array2csv( matchKeys ) + HybsSystem.CR
909 + " matchVals=[" + matchVals.length + "]:VLAS="
910 + StringUtil.array2csv( matchVals ) + HybsSystem.CR ;
911 throw new HybsSystemException( errMsg );
912 }
913 }
914
915 /**
916 * 【TAG】正規表現でのマッチングを行うカラãƒ??に対する値(正規表現)をカンマ区åˆ?‚Š(CSV形å¼?でæŒ?®šしますã?
917 *
918 * @og.tag matchVals="AAA,BBB,CCC,DDD"
919 * matchKeys属æ?とmatchVals属æ?の個数は、同じでなければなりませんã€?
920 * 先に配å?にåˆ?§£してからリクエスト変数の値を取得するよã�?�«しますã?
921 * こうする事で、リクエストにカンマ区åˆ?‚Šの値を設定できるようになりますã?
922 *
923 * @og.rev 4.0.0.0 (2005/11/30) 新規作æ?
924 *
925 * @param vals カラãƒ??に対する値(正規表現)(CSV形å¼?
926 * @see #setMatchKeys( String )
927 */
928 public void setMatchVals( final String vals ) {
929 matchVals = getCSVParameter( vals );
930
931 if( matchKeys != null && matchKeys.length != matchVals.length ) {
932 String errMsg = "matchKeys属æ?とmatchVals属æ?の個数が合ã�?�¾せんã€?
933 + HybsSystem.CR
934 + " matchKeys=[" + matchKeys.length + "]:KEYS="
935 + StringUtil.array2csv( matchKeys ) + HybsSystem.CR
936 + " matchVals=[" + matchVals.length + "]:VLAS="
937 + StringUtil.array2csv( matchVals ) + HybsSystem.CR ;
938 throw new HybsSystemException( errMsg );
939 }
940 }
941
942 /**
943 * 【TAGã€?通常使ã�?�¾せん)リアルタイãƒ?ƒ�ェãƒ?‚¯を行う場合に有効にしますã?
944 *
945 * @og.tag
946 * リアルタイãƒ?ƒ�ェãƒ?‚¯を行う場合に有効にする属æ?ですã?
947 * trueが指定された場合ã?通常のチェãƒ?‚¯と比è¼?�—、以下ã?差異がありますã?
948 * â‘?‚¨ラー結果を簡易フォーマットで出力しますã?
949 * (ViewFormType="HTMLSimpleErrorList"で表示されますã?)
950 * こã?簡易フォーマットで出力したå?合ã?、ラベル(短)の定義で出力されã?
951 * カラãƒ?��ã‚?ƒ‡ータ等ã?出力されませんã€?
952 * ②must,mustAny属æ?のチェãƒ?‚¯を行いませんã€?
953 * å¿??及ã?選択å¿??は、視覚的に判別できるため、リアルタイãƒ?ƒ�ェãƒ?‚¯の
954 * 対象外としますã?
955 *
956 * @og.rev 4.3.3.0 (2008/10/01) 新規作æ?
957 * @og.rev 4.3.7.0 (2009/06/01) viewSimple属æ?名称変更 -> isRealTime
958 *
959 * @param flg 簡易表示を行うかどã�?�‹
960 */
961 public void setRealTime( final String flg ) {
962 isRealTime = nval( getRequestParameter( flg ),isRealTime );
963 }
964
965 /**
966 * 【TAG】NEWの場合に、厳å¯?�«チェãƒ?‚¯するかどã�?�‹[true/false]を指定しまã�?初期値:false)ã€?
967 *
968 * @og.tag
969 * ãƒ??タをチェãƒ?‚¯するに当たりã?あいまã�?¤œ索などで厳å¯?�«チェãƒ?‚¯すると
970 * エラーになるケースがあるためã?command="NEW" のチェãƒ?‚¯時には、甘ã�?›®の
971 * チェãƒ?‚¯を行ってã�?�¾すã?DBColumn#valueCheck( String , false )
972 * command="ENTRY" のチェãƒ?‚¯は、厳å¯?�ªチェãƒ?‚¯ですã?
973 * こã?フラグは、検索時でもã?厳å¯?�ªチェãƒ?‚¯を行いたい場合に、true をセãƒ?ƒˆしますã?
974 *
975 * @og.rev 5.2.2.0 (2010/11/01) 新規作æ?
976 *
977 * @param flg 厳å¯?�«チェãƒ?‚¯するかどã�?�‹ [true:厳å¯?false:甘い]
978 */
979 public void setUseStrict( final String flg ) {
980 isStrict = nval( getRequestParameter( flg ),isStrict );
981 }
982
983 /**
984 * 【TAG】カラãƒ?ƒ©ベルを使用するかどã�?�‹[true/false]を指定しまã�?初期値:false)ã€?
985 *
986 * @og.tag
987 * カラãƒ?ƒ©ベルはラベルローãƒ??を利用せずにアプリケーション側で
988 * 追åŠ?�—たラベルをResourceManagerにキャãƒ?‚·ュしてã�?‚‹æ‰?�‹ら取りå?ã�?
989 * かどã�?�‹を指定しますã?
990 * カラãƒ?ƒ©ベルに存在しなã�??合ã?ã€??常のラベルから検索しますã?
991 *
992 * @og.rev 5.4.3.4 (2012/01/12) 新規作æ?
993 *
994 * @param flg カラãƒ?ƒ©ベルを使用するかどã�?�‹ true:する/false:しない]
995 */
996 public void setUseColumnLabel( final String flg ) {
997 isColumnLabel = nval( getRequestParameter( flg ),isColumnLabel );
998 }
999
1000 /**
1001 * 【TAG】ラベルをDBTableModel のカラãƒ?�‹ら取得するかどã�?�‹を指定しまã�?初期値:false)ã€?
1002 *
1003 * @og.tag
1004 * エラー時ã?ラベルは通常はラベルリソースから取得してã�?�¾すがã€?
1005 * ColumnEditor等で、ラベルを書き換えた場合ã?画面に表示されてã�?‚‹名称と
1006 * エラー時に表示される名称が異なることがありましたã€?
1007 * そこで、command=ENTRY 時に、ラベルをã?DBTableModel のカラãƒ?�‹ら取å¾?
1008 * するように設定できるようにしましたã€?
1009 * DBTableModel に該当するカラãƒ?�Œ存在しなã�??合ã?ラベルリソースから取得しますã?
1010 * 通常は、この方法が主ですがã€?�Ž去の互換性をè?慮しã?初期値は、false に
1011 * してã�?�¾すã?
1012 *
1013 * @og.rev 5.4.3.4 (2012/01/12) 新規作æ?
1014 *
1015 * @param flg カラãƒ?ƒ©ベルを使用するかどã�?�‹(true:する/false:しなã�?
1016 */
1017 // public void setUseTblClmLbl( final String flg ) {
1018 // isTblClmLbl = nval( getRequestParameter( flg ),isTblClmLbl );
1019 // }
1020
1021 /**
1022 * 【TAG】リクエスト変数の正規化を行うカラãƒ?‚’CSV形式でè¤?•°æŒ?®šしますã?
1023 *
1024 * @og.tag
1025 * カラãƒ?ƒ�ェãƒ?‚¯で正規化が行われてã�?�ªã�??ラグインに対して強制çš?�«正規化を行いますã?
1026 * こã?属æ?を利用したチェãƒ?‚¯を行ったå?合ã?、queryタグでPL/SQLを動作させる場合にã‚?
1027 * 同名属æ?でカラãƒ??æŒ?®šを行うå¿?¦�がありますã?
1028 * (queryタグでcheckNamesを利用しなã�??合ã?こã?属æ?はnullにしてください)
1029 * こã?属æ?はチェãƒ?‚¯タイプがNEWの場合ã?み有効ですã?
1030 * リアルタイãƒ?ƒ�ェãƒ?‚¯でこã?機è?を利用したã�??合ã?、columnTag等ã?optionAttributes
1031 * 属æ?にrtOption='checkNames=VIEW_DATE'のように記述してくださいã€?
1032 *
1033 * @og.rev 5.4.3.8 (2012/01/24) 新規追åŠ?
1034 * @og.rev 5.4.4.0 (2012/02/01) コメント修正
1035 *
1036 * @param nm リクエスト変数の正規化を行うカラãƒ?
1037 */
1038 public void setCheckNames( final String nm ) {
1039 checkNames = nval( getRequestParameter( nm ),checkNames );
1040 }
1041
1042 /**
1043 * こã?オブジェクトã?æ–?—å?表現を返しますã?
1044 * 基本çš?�«ãƒ?ƒ�ãƒ?‚°目çš?�«使用しますã?
1045 *
1046 * @return こã?クラスのæ–?—å?表現
1047 */
1048 @Override
1049 public String toString() {
1050 return org.opengion.fukurou.util.ToString.title( this.getClass().getName() )
1051 .println( "VERSION" ,VERSION )
1052 .println( "tableId" ,tableId )
1053 .println( "command" ,command )
1054 .println( "columns" ,columns )
1055 .println( "nullCheck" ,nullCheck )
1056 .println( "mustAnyCheck" ,mustAnyCheck )
1057 .println( "maxRowCount" ,maxRowCount )
1058 .println( "minRowCount" ,minRowCount )
1059 .println( "checkType" ,checkType )
1060 .println( "matchKeys" ,matchKeys )
1061 .println( "matchVals" ,matchVals )
1062 .println( "realTime" ,isRealTime )
1063 .println( "bodyString" ,StringUtil.htmlFilter( bodyString ) )
1064 .println( "Other..." ,getAttributes().getAttribute() )
1065 .fixForm().toString() ;
1066 }
1067 }