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 */ 016package org.opengion.hayabusa.html; 017 018import org.opengion.hayabusa.common.HybsSystem; 019import org.opengion.hayabusa.db.DBTableModel; 020import org.opengion.fukurou.security.HybsCryptography; // 5.8.8.0 (2015/06/05) 021import org.opengion.fukurou.security.URLHashMap; 022import org.opengion.fukurou.util.StringUtil; 023import org.opengion.fukurou.util.Attributes; 024import org.opengion.fukurou.util.XHTMLTag; 025import org.opengion.fukurou.model.Formatter; 026import static org.opengion.fukurou.system.HybsConst.BUFFER_LARGE; // 6.1.0.0 (2014/12/26) refactoring 027 028import java.util.concurrent.ConcurrentMap; // 6.4.3.3 (2016/03/04) 029import java.util.concurrent.ConcurrentHashMap; // 6.4.3.1 (2016/02/12) refactoring 030import java.util.List; 031import java.util.ArrayList; 032import java.util.Arrays ; 033 034/** 035 * ViewLink インターフェース の実装オブジェクトです。 036 * これを共通のスーパークラスとして 各種表示フォーム(例:HTML表示等)に使います。 037 * 038 * このクラスは、setter/getterメソッドのデフォルト実装を提供しています。 039 * 各種表示フォームに対応したサブクラス上で、 create() をオーバーライドして下さい。 040 * 041 * @og.rev 2.1.0.3 (2002/11/08) エンコードの開始/終了アドレスを求める処理の修正 042 * @og.rev 4.0.0.0 (2005/08/31) 同一カラムの複数登録を許可します。 043 * @og.group 画面表示 044 * 045 * @version 4.0 046 * @author Kazuhiko Hasegawa 047 * @since JDK5.0, 048 */ 049public class ViewLink_LINK implements ViewMarker { 050 private static final String REQ_KEY = HybsSystem.URL_HASH_REQ_KEY ; 051 052 private static final int ACCS_LVL = HybsSystem.sysInt( "URL_ACCESS_SECURITY_LEVEL" ); 053 private static final int MARK_NULL = -1; // リンク未設定 054 private static final int MARK_TRUE = 1; // リンク作成 055 private static final int MARK_FALSE = 0; // リンク作成せず 056 057 private List<Attributes> markData ; // 4.0.0 (2005/08/31) 058 /** 6.4.3.1 (2016/02/12) PMD refactoring. HashMap → ConcurrentHashMap に置き換え。 */ 059 private final ConcurrentMap<Integer,Formatter> formMap = new ConcurrentHashMap<>(); // 6.4.3.1 (2016/02/12) 060 061 /** 6.4.3.1 (2016/02/12) PMD refactoring. HashMap → ConcurrentHashMap に置き換え。 */ 062 private final ConcurrentMap<Integer,List<Integer>> clmMap = new ConcurrentHashMap<>(); // 6.4.3.1 (2016/02/12) 063 064 private DBTableModel table ; 065 private int[] markCmlNo ; 066 private int[] isMark ; 067 // 2.1.0.3 (2002/11/08) エンコードの開始/終了アドレスを求める処理の修正 068 // 6.2.0.1 (2015/03/06) hrefアドレスのASCII以外の文字の、URLエンコードを行う。 069 private int[] hrefIn ; // 初期値:範囲外 6.2.0.1 (2015/03/06) 070 private int[] encodeIn ; // 初期値:範囲外 071 private int[] encodeOut ; // 初期値:範囲外 072 // 3.5.2.0 (2003/10/20) 073 private String[] markKey ; 074 private String[] markLists ; 075 private int[] markListNo ; 076 077 private boolean[] useURLCheck ; // 4.3.7.1 (2009/06/08) 078 private String[] urlCheckUser ; // 4.3.7.1 (2009/06/08) 079 private long[] urlCheckTime ; // 4.3.7.1 (2009/06/08) 080 private HybsCryptography[] urlCheckCrypt ; // 5.8.8.0 (2015/06/05) 081 private boolean[] useHrefEncode ; // 6.0.2.0 (2014/09/19) 082 private boolean[] hrefOnly ; // 7.1.0.1 (2020/02/07) 083 084// private String[] extToken ; // 5.8.2.1 (2014/12/13) 6.9.5.0 (2018/04/23) extToken 廃止 085 086 private int editClmNo ; // 6.4.7.0 (2016/06/03) エディット機能で、rowCount カラムが存在するときのカラム番号。無ければ-1 087 088 /** 089 * デフォルトコンストラクター 090 * 091 * @og.rev 6.4.2.0 (2016/01/29) PMD refactoring. Each class should declare at least one constructor. 092 */ 093 public ViewLink_LINK() { super(); } // これも、自動的に呼ばれるが、空のメソッドを作成すると警告されるので、明示的にしておきます。 094 095 /** 096 * 内容をクリア(初期化)します。 097 * 098 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 099 * @og.rev 3.5.2.0 (2003/10/20) markLists,markListNo,markKey属性を追加 100 * @og.rev 3.5.6.1 (2004/06/25) formMap属性を追加 101 * @og.rev 4.3.7.1 (2009/06/08) URLチェック属性追加 102 * @og.rev 6.0.2.0 (2014/09/19) useHrefEncode属性追加 103 * @og.rev 5.8.2.1 (2014/12/13) extToken追加 104 * @og.rev 6.2.0.1 (2015/03/06) hrefアドレスのASCII以外の文字の、URLエンコードを行う。 105 * @og.rev 5.8.8.0 (2015/06/05) urlCheckCrypt追加 106 * @og.rev 6.4.3.1 (2016/02/12) PMD refactoring. HashMap → ConcurrentHashMap に置き換え。 107 * @og.rev 6.4.7.0 (2016/06/03) エディット機能で、rowCount カラムが存在するときのカラム番号。無ければ-1; 108 * @og.rev 6.9.5.0 (2018/04/23) extToken 廃止 109 * @og.rev 7.1.0.1 (2020/02/07) hrefOnly属性追加 110 */ 111 @Override // ViewMarker 112 public void clear() { 113 markData = null; // 4.0.0 (2005/08/31) 114 formMap.clear(); // 6.4.3.3 (2016/03/04) 115 table = null; 116 isMark = null; 117 hrefIn = null; // 6.2.0.1 (2015/03/06) 118 encodeIn = null; 119 encodeOut = null; 120 markKey = null; 121 markLists = null; 122 markListNo = null; 123 clmMap.clear(); // 6.4.3.3 (2016/03/04) 124 useURLCheck = null; // 4.3.7.1 (2009/06/08) 125 urlCheckUser = null; // 4.3.7.1 (2009/06/08) 126 urlCheckTime = null; // 4.3.7.1 (2009/06/08) 127 urlCheckCrypt = null; // 5.8.8.0 (2015/06/05) 128 useHrefEncode = null; // 6.0.2.0 (2014/09/19) 129 hrefOnly = null; // 6.0.2.0 (2014/09/19) 130// extToken = null; // 5.8.2.1 (2014/12/14) 131 editClmNo = -1; // 7.1.0.1 (2020/02/07) 132 } 133 134 /** 135 * カラムに対するリンクアトリビュートをセットします。 136 * 137 * @og.rev 3.1.0.0 (2003/03/20) Hashtable を使用している箇所で、非同期でも構わない箇所を、HashMap に置換え。 138 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 139 * @og.rev 4.0.0.0 (2005/08/31) 同一カラムの複数登録を許可します。 140 * 141 * @param attri リンクアトリビュート 142 */ 143 @Override // ViewMarker 144 public void addAttribute( final Attributes attri ) { 145 if( markData == null ) { markData = new ArrayList<>(); } 146 markData.add( attri ); 147 } 148 149 /** 150 * このマーカーが、初期化されているかどうかを判定します。 151 * 152 * 使用できる状態の場合は、true , 初期化が出来ていない場合は、false を返します。 153 * 154 * @og.rev 6.7.2.0 (2017/01/16) caseKey,caseVal等で未使用のときの対応。 155 * 156 * @return 初期化状況 [true:初期化済み/false:未初期化] 157 */ 158 @Override // ViewMarker 159 public boolean isUsable() { 160// return markData != null && markData.size() > 0 ; // 本当は、ゼロということは無いはず。 161 return markData != null && !markData.isEmpty() ; // 本当は、ゼロということは無いはず。 // 6.9.7.0 (2018/05/14) PMD 162 } 163 164 /** 165 * 内部に DBTableModel をセットします。 166 * 167 * @og.rev 2.1.0.3 (2002/11/08) エンコードの開始/終了アドレスを求める処理の修正 168 * @og.rev 3.1.1.0 (2003/03/28) 同期メソッド(synchronized付き)を非同期に変更する。 169 * @og.rev 3.5.2.0 (2003/10/20) markLists,markListNo,markKey属性を追加 170 * @og.rev 3.5.5.0 (2004/03/12) xlink 属性によるリンク情報作成方法の分岐を追加 171 * @og.rev 3.5.6.1 (2004/06/25) DBTableModel の再設定に対応。 172 * @og.rev 3.5.6.2 (2004/07/05) linkFormat をパラメータで取得するように変更。 173 * @og.rev 3.8.1.1 (2005/11/21) linkFormat が "[","]" をエンコードしてしまった場合に元に戻します。 174 * @og.rev 4.0.0.0 (2005/08/31) 同一カラムの複数登録を許可します。 175 * @og.rev 4.3.7.1 (2009/06/08) URLチェック機能追加 176 * @og.rev 6.0.2.0 (2014/09/19) useHrefEncode属性追加 177 * @og.rev 6.2.0.1 (2015/03/06) hrefアドレスのASCII以外の文字の、URLエンコードを行う。 178 * @og.rev 5.8.8.0 (2015/06/05) urlCheckCrypt対応 179 * @og.rev 6.4.3.3 (2016/03/04) Map#computeIfAbsent で対応する。 180 * @og.rev 6.4.3.4 (2016/03/11) Formatterに新しいコンストラクターを追加する。 181 * @og.rev 6.4.7.0 (2016/06/03) エディット機能で、rowCount カラムが存在するときのカラム番号。無ければ-1; 182 * @og.rev 6.7.6.0 (2017/03/17) strictCheck 追加。 183 * @og.rev 6.9.5.0 (2018/04/23) extToken 廃止 184 * @og.rev 7.1.0.1 (2020/02/07) hrefOnly属性追加 185 * 186 * @param tbl DBTableModelオブジェクト 187 */ 188 @Override // ViewMarker 189 public void setDBTableModel( final DBTableModel tbl ) { 190 table = tbl; 191 final int count = markData.size(); // 4.0.0 (2005/08/31) 192 193 isMark = new int[count]; 194 markKey = new String[count]; 195 markCmlNo = new int[count]; 196 markLists = new String[count]; 197 markListNo = new int[count]; 198 hrefIn = new int[count]; // 6.2.0.1 (2015/03/06) 199 encodeIn = new int[count]; 200 encodeOut = new int[count]; 201 useURLCheck = new boolean[count]; // 4.3.7.1 (2009/06/08) 202 urlCheckUser = new String[count]; // 4.3.7.1 (2009/06/08) 203 urlCheckTime = new long[count]; // 4.3.7.1 (2009/06/08) 204 urlCheckCrypt = new HybsCryptography[count]; // 5.8.8.0 (2015/06/05) 205 useHrefEncode = new boolean[count]; // 6.0.2.0 (2014/09/19) 206 hrefOnly = new boolean[count]; // 7.1.0.1 (2020/02/07) 207// extToken = new String[count]; // 5.8.2.1 (2014/12/13) 6.9.5.0 (2018/04/23) extToken 廃止 208 209 Arrays.fill( isMark,MARK_FALSE ); // リンクの表示可否 210 Arrays.fill( markCmlNo ,-1 ); // リンクの可否を判断するカラム番号 211 Arrays.fill( hrefIn ,10000 ); // 初期値:範囲外 6.2.0.1 (2015/03/06) 212 Arrays.fill( encodeIn ,10000 ); // 初期値:範囲外 213 Arrays.fill( encodeOut ,-1 ); // 初期値:範囲外 214 Arrays.fill( useURLCheck , false ); // 4.3.7.1 (2009/06/08) 215 Arrays.fill( urlCheckTime , 0L ); // 4.3.7.1 (2009/06/08) 216 Arrays.fill( useHrefEncode , false ); // 6.0.2.0 (2014/09/19) 決め打ちに近いがとりあえず初期化は false 217 Arrays.fill( hrefOnly , false ); // 7.1.0.1 (2020/02/07) 218 219 // 6.4.7.0 (2016/06/03) エディット機能で、rowCount カラムが存在するときのカラム番号。無ければ-1; 220 editClmNo = table.getColumnNo( "rowCount" , false ); 221 222 // 4.0.0 (2005/08/31) 同一カラムの複数登録を許可します。 223 for( int intKey=0; intKey<count; intKey++ ) { 224 final Attributes attri = markData.get( intKey ); 225 226 final String column = attri.get( "column" ); 227 228 // 6.7.6.0 (2017/03/17) カラムのDBTableModel存在チェック。初期値が true なので、attri に無い場合も、true になる。 229 final String strChk = attri.get( "strictCheck" ); 230 final boolean strictCheck = ! "false".equalsIgnoreCase( strChk ); 231 232 // 6.4.3.1 (2016/02/12) ConcurrentMap 系は、key,val ともに not null 制限です。 233 final int clm = table.getColumnNo( column,strictCheck ); // 6.7.6.0 (2017/03/17) strictCheck で、true の場合は、clm番号が見つからないときは、Exception発生 234 235 if( clm < 0 ) { continue; } // 6.7.6.0 (2017/03/17) 存在しない場合、以下の処理を行わない。= clmMap に、カラムが登録されない。 236 237 // 6.4.3.3 (2016/03/04) Map#compute で対応する。 238 // Map#computeIfAbsent : 戻り値は、既存の、または計算された値。追加有り、置換なし、削除なし 239 clmMap.computeIfAbsent( clm,k -> new ArrayList<>() ).add( intKey ); 240 241 String linkFormat = attri.get( "linkFormat" ); 242 linkFormat = StringUtil.replace( linkFormat,"%5B","[" ); // 3.8.1.1 (2005/11/21) 243 linkFormat = StringUtil.replace( linkFormat,"%5D","]" ); // 3.8.1.1 (2005/11/21) 244 245 final Formatter formatter = new Formatter( table,linkFormat ); // 6.4.3.4 (2016/03/11) 246 // 6.4.3.1 (2016/02/12) ConcurrentMap 系は、key,val ともに not null 制限です。 247 formMap.put( intKey, formatter ); 248 249 // URLエンコード用の範囲設定。この範囲内のデータをURLエンコードする。 250 final String[] format = formatter.getFormat(); 251 boolean findHref = false; 252 for( int j=0; j<format.length; j++ ) { 253 // 6.2.0.1 (2015/03/06) hrefアドレスのASCII以外の文字の、URLエンコードを行う。 254 if( format[j] != null && format[j].indexOf( "href" ) >= 0 ) { findHref = true; hrefIn[intKey] = j; } 255 if( findHref && format[j].indexOf( '?' ) >= 0 ) { encodeIn[intKey] = j; } 256 if( findHref && format[j].indexOf( "\" " ) >= 0 ) { encodeOut[intKey] = j; findHref = false; } 257 } 258 259 // 4.3.7.1 (2009/06/08) 260 useURLCheck[intKey] = StringUtil.nval( attri.get( "useURLCheck" ) , false ); 261 urlCheckUser[intKey] = StringUtil.nval( attri.get( "urlCheckUser" ) , null ); 262 urlCheckTime[intKey] = StringUtil.nval( attri.get( "urlCheckTime" ) , 0L ); 263 final String cryptKey= StringUtil.nval( attri.get( "urlCheckCrypt" ), null ); // 5.8.8.0 (2015/06/05) 264 urlCheckCrypt[intKey]= new HybsCryptography( cryptKey ); // 5.8.8.0 (2015/06/05) 265 useHrefEncode[intKey]= StringUtil.nval( attri.get( "useHrefEncode") , false ); // 6.0.2.0 (2014/09/19) 266 hrefOnly[intKey] = StringUtil.nval( attri.get( "hrefOnly") , false ); // 7.1.0.1 (2020/02/07) 267// extToken[intKey] = StringUtil.nval( attri.get( "extToken" ) , null ); // 5.8.2.1 (2014/12/14) 6.9.5.0 (2018/04/23) extToken 廃止 268 makeOnLinkFormat( intKey,attri ); 269 } 270 } 271 272 /** 273 * 指定の行列に対するマーカー文字列を返します。 274 * この値は、すでにマーカー文字列処理されている為、RendererValue で 275 * 変換する必要はありません。 276 * 引数の value はそのカラムの値として利用されます。この値は、修飾済みの 277 * 値を与えることが可能です。 278 * 279 * @og.rev 2.1.0.3 (2002/11/08) エンコードの開始/終了アドレスを求める処理の修正 280 * @og.rev 3.0.0.0 (2002/12/25) URLEncoder.encode を StringUtil#urlEncode に置換え 281 * @og.rev 3.0.0.1 (2003/02/14) リンクの引数部分に、RendererValue が適用される箇所を修正 282 * @og.rev 3.0.0.1 (2003/02/14) リンクの引数部分に、RendererValue が適用される箇所を修正 283 * @og.rev 3.5.6.1 (2004/06/25) formMap属性を使用します。 284 * @og.rev 3.7.0.3 (2005/03/01) "{I}" 文字列に、行番号(row)を割り当てます。 285 * @og.rev 3.8.5.0 (2006/03/20) "{I}" ⇒ "%7BI%7D" として、行番号(row)を割り当てます。 286 * @og.rev 4.3.7.1 (2009/06/08) URLチェック機能追加 287 * @og.rev 4.3.7.4 (2009/07/01) 循環参照を解消 288 * @og.rev 5.2.3.0 (2010/12/01) URLのハッシュ化/暗号化を行います。 289 * @og.rev 6.0.2.0 (2014/09/19) useHrefEncode属性追加 290 * @og.rev 5.8.2.1 (2014/12/13) トークンプラグイン対応 291 * @og.rev 6.2.0.1 (2015/03/06) ASCII以外の文字の、URLエンコードを行う。 292 * @og.rev 6.2.4.0 (2015/05/15) エンコード範囲内の value は、値を使う。(元に戻す) 293 * @og.rev 5.8.8.0 (2015/06/05) urlCheckCrypt対応 294 * @og.rev 6.4.3.3 (2016/03/04) HybsSystem.newInstance(String,String) への置き換え。 295 * @og.rev 6.4.3.4 (2016/03/11) hrefIn の部分エンコードと、?以下のパラメータエンコードの判定間違い、修正 296 * @og.rev 6.4.7.0 (2016/06/03) エディット機能で、rowCount カラムが存在するときのカラム番号。無ければ-1; 297 * @og.rev 6.9.5.0 (2018/04/23) extToken 廃止 298 * @og.rev 7.1.0.1 (2020/02/07) hrefOnly属性追加 299 * 300 * @param row 指定の行 301 * @param clm 指定の列 302 * @param value カラムの値 303 * 304 * @return row行、colum列 のマーカー文字列 305 */ 306 @Override // ViewMarker 307 public String getMarkerString( final int row,final int clm,final String value ) { 308 final int intKey = isOnLink(row,clm) ; 309 if( intKey < 0 ) { return value; } 310 311 final Formatter formatter = formMap.get( intKey ); 312 final int[] clmNo = formatter.getClmNos(); 313 final String[] format = formatter.getFormat(); 314 315 final StringBuilder strLink = new StringBuilder( BUFFER_LARGE ); 316 int j=0; 317 318 for( ; j<clmNo.length; j++ ) { 319 strLink.append( format[j] ); 320 321 // 6.2.4.0 (2015/05/15) エンコード範囲内の value は、値を使う。(元に戻す) 322 String val = formatter.getValue(row,clmNo[j]); 323 324 // 6.4.3.4 (2016/03/11) hrefIn の部分エンコードと、?以下のパラメータエンコードの判定間違い、修正 325 if( hrefIn[intKey] <= j && j < encodeOut[intKey] ) { // (href) encode範囲内 326 if( encodeIn[intKey] <= j ) { 327 val = StringUtil.urlEncode( val ); // パラメータはフルエンコード 328 } 329 else if( useHrefEncode[intKey] ) { // 6.0.2.0 (2014/09/19) useHrefEncode属性追加 330 val = StringUtil.urlEncode2( val ); // ファイル名などは、部分エンコード 331 } 332 } 333 else { // encode範囲外 334 // なにもしない。 335 if( clm == clmNo[j] ) { val = value; } // 一致する場合の valueは、通常レンデラー 336 else if( hrefOnly[intKey] ) { // 7.1.0.1 (2020/02/07) hrefOnly属性追加 337// val = StringUtil.urlEncode( val ); 338 val = StringUtil.urlEncode2( val ); // 7.2.1.0 (2020/03/13) 部分エンコード 339 } 340 } 341 342// // 6.4.3.4 (2016/03/11) hrefIn の部分エンコードと、?以下のパラメータエンコードの判定間違い、修正 343// if( hrefIn[intKey] <= j && j < encodeOut[intKey] ) { // (href) encode範囲内 344// if( encodeIn[intKey] <= j ) { 345// val = StringUtil.urlEncode( val ); // パラメータはフルエンコード 346// } 347// else if( useHrefEncode[intKey] ) { // 6.0.2.0 (2014/09/19) useHrefEncode属性追加 348// val = StringUtil.urlEncode2( val ); // ファイル名などは、部分エンコード 349// } 350// } 351// else { // encode範囲外 352// // なにもしない。 353// if( clm == clmNo[j] ) { val = value;} // 一致する場合の valueは、通常レンデラー 354// } 355 356 strLink.append( val ); 357 } 358 strLink.append( format[j] ); 359 360 // 3.8.5.0 (2006/03/27) "{I}" と そのエンコード文字 "%7BI%7D" に、行番号(row)を割り当てます。 361 String rtn = strLink.toString(); 362 final String sRow = String.valueOf( row ); 363 rtn = StringUtil.replace( rtn,"{I}",sRow ); 364 rtn = StringUtil.replace( rtn,"%7BI%7D",sRow ); 365 366 // 4.3.7.1 (2009/06/08) 367 if( useURLCheck[intKey] ) { 368 // 4.3.7.4 (2009/07/01) 369 rtn = XHTMLTag.embedURLCheckKey( rtn, HybsSystem.URL_CHECK_KEY, urlCheckUser[intKey], urlCheckTime[intKey], urlCheckCrypt[intKey] ); // 5.8.8.0 (2015/06/05) 370 } 371 372// // 5.8.2.1 (2014/12/13) トークンプラグイン対応 373// // 6.9.5.0 (2018/04/23) extToken 廃止 374// if( extToken[intKey] != null && extToken[intKey].length() > 0 ){ 375// final String[] tokens = StringUtil.csv2Array( extToken[intKey] ); 376// for( final String tk :tokens ){ 377// final CreateToken ct = HybsSystem.newInstance( "CreateToken_" , tk ); 378// rtn = ct.embedToken( rtn, urlCheckTime[intKey], null ); 379// } 380// } 381 382 // 5.2.3.0 (2010/12/01) URLのハッシュ化/暗号化 383 if( ACCS_LVL == 2 ) { 384 // ACCS_LVL == 2 の場合は、外部のみ処理するので、extOnly=true をセットする。 385 rtn = URLHashMap.makeUrlChange( rtn,REQ_KEY,true ); 386 } 387 else if( ACCS_LVL == 3 ) { 388 rtn = URLHashMap.makeUrlChange( rtn,REQ_KEY,false ); 389 } 390 391 return rtn ; 392 } 393 394 /** 395 * リンクを張る/張らないの指定カラム番号を求めます。 396 * また、int[列番号] isMark を初期化します。 397 * 398 * @og.rev 3.5.2.0 (2003/10/20) markLists,markListNo,markKey属性を追加 399 * 400 * @param intKey カラムキーの番号 401 * @param attri アトリビュート 402 */ 403 private void makeOnLinkFormat( final int intKey,final Attributes attri ) { 404 final String onMark = attri.get( "onLink" ); 405 final String markList = attri.get( "markList" ); 406 407 // 3.5.6.0 (2004/06/18) nullポインタの参照外しバグの対応 408 // このロジックで値が設定済みであれば、以下の処理は不要である。 409 isMark[intKey] = MARK_NULL; 410 if( onMark == null || onMark.isEmpty() || 411 markList == null || markList.isEmpty() ) { 412 isMark[intKey] = MARK_FALSE; 413 return ; // 3.5.6.0 (2004/06/18) 414 } 415 else if( onMark.charAt(0) != '[' && markList.charAt(0) != '[' ) { 416 isMark[intKey] = markList.indexOf( onMark ) >= 0 ? MARK_TRUE : MARK_FALSE; 417 return ; // 3.5.6.0 (2004/06/18) 418 } 419 420 if( onMark.charAt(0) == '[' ) { 421 markCmlNo[intKey] = table.getColumnNo( onMark.substring( 1,onMark.length()-1 )); 422 } 423 else { 424 markCmlNo[intKey] = -1; 425 markKey[intKey] = onMark ; 426 } 427 428 if( markList.charAt(0) == '[' ) { 429 markListNo[intKey] = table.getColumnNo( markList.substring( 1,markList.length()-1 )); 430 } 431 else { 432 markListNo[intKey] = -1; 433 markLists[intKey] = markList; 434 } 435 } 436 437 /** 438 * リンクを張るかどうかを判断します。 439 * int[列番号] isMark には、 未設定 FALSE TRUE の状態を持っており、 440 * 列でリンクを張る状態が固定の場合(例えば、onLink属性がデフォルト "true" の場合) 441 * カラムに関係なく、同じ値を返すときに、使用します。 442 * 443 * @og.rev 3.5.2.0 (2003/10/20) markLists,markListNo,markKey属性を追加 444 * @og.rev 3.5.4.0 (2003/11/25) onMark ,markList が null(またはゼロストリング)の場合は、false とする。 445 * @og.rev 4.0.0.0 (2005/08/31) 同一カラムの複数登録を許可します。 446 * 447 * @param row 列番号 448 * @param clm カラムキーの名称 449 * 450 * @return 処理するリスト番号、-1 の場合は、該当なし 451 */ 452 private int isOnLink( final int row,final int clm ) { 453 if( editClmNo >= 0 && StringUtil.nval( table.getValue( row,editClmNo ) , null ) != null ) { 454 return -1; 455 } 456 457 final List<Integer> list = clmMap.get( clm ); 458 if( list == null ) { return -1; } 459 460 for( int i=0; i<list.size(); i++ ) { 461 final int intKey = list.get( i ); 462 if( isMark[intKey] != MARK_NULL ) { 463 if( isMark[intKey] == MARK_TRUE ) { return intKey; } 464 else { continue; } 465 } 466 467 String onMark ; 468 if( markCmlNo[intKey] < 0 ) { onMark = markKey[intKey] ; } 469 else { onMark = table.getValue( row,markCmlNo[intKey] ); } 470 471 // 3.5.4.0 (2003/11/25) 追加 472 if( onMark == null || onMark.isEmpty() ) { continue; } 473 474 String markList ; 475 if( markListNo[intKey] < 0 ) { markList = markLists[intKey] ; } 476 else { markList = table.getValue( row,markListNo[intKey] ); } 477 478 // 3.5.4.0 (2003/11/25) 修正 479 if( markList == null || markList.isEmpty() ) { continue; } 480 481 if( markList.indexOf( onMark ) >= 0 ) { return intKey; } 482 } 483 return -1; 484 } 485 486 /** 487 * マーカーされたカラム番号の配列を返します。 488 * 489 * これは特殊処理で、Edit機能で、カラム列をキャッシュしているときに、 490 * JSPのソース等の変更時に、変更が反映されない対応を行う場合、 491 * 通常の ViewFormのサブクラスから、Edit専用の ViewForm_HTMLSeqClmTable で 492 * 制御する場合、ViewMarkerのEditMarkerでは、通常非表示(検索の場合)ですが 493 * Editのポップアップ画面に、表示されてしまうのを避けるため、noDisplay に 494 * 強制的にするカラム番号が必要です。 495 * あくまで、暫定処置です。Edit機能を改修するときに、この機能は削除します。 496 * 497 * ※ この処理は、EditMarkerでのみ有効にします。 498 * 499 * @og.rev 6.0.3.0 (2014/11/13) Edit機能で、JSPソース変更時の対応 500 * 501 * @return マーカーされたカラム番号の配列(常に、長さ0の配列を返す) 502 */ 503 @Override // ViewMarker 504 public int[] getColumnNos() { 505 return new int[0]; 506 } 507}