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