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.taglib; 017 018import org.opengion.hayabusa.common.HybsSystem; 019import org.opengion.hayabusa.common.HybsSystemException; 020import org.opengion.hayabusa.db.DBTableModel; 021import org.opengion.hayabusa.db.DBColumn; 022import org.opengion.hayabusa.db.DBTableModelUtil; 023import org.opengion.hayabusa.resource.LDAPSearch; 024 025import org.opengion.fukurou.util.ErrorMessage; 026import org.opengion.fukurou.util.StringUtil ; 027import static org.opengion.fukurou.util.StringUtil.nval ; 028 029import java.util.List; 030import java.util.Locale; 031 032/** 033 * LDAPの内容を検索するための、ldapQueryタグです。 034 * 035 * 検索した結果は、DBTableModel にセットされるため、 036 * JDBCQuery と同様に、viewタグで表示させることが可能です。 037 * 038 * 下記の項目については、src/resource/システムパラメータ に、予め 039 * 設定しておくことで、タグごとに指定する必要がなくなります。 040 * ・LDAP_INITIAL_CONTEXT_FACTORY 041 * ・LDAP_PROVIDER_URL 042 * ・LDAP_ENTRYDN 043 * ・LDAP_SEARCH_BASE 044 * ・LDAP_SEARCH_SCOPE 045 * 046 * このタグリブでは、検索のみサポートしています。 047 * 048 * @og.formSample 049 * ●形式: 050 * <og:ldapQuery debug="false" 051 * command = "NEW" NEW,RENEW が使用可能です。 052 * initctx = "com.sun.jndi.ldap.LdapCtxFactory" 初期コンテキストファクトリ 053 * providerURL = "ldap://ldap.opengion.org:389" サービスプロバイダの構成情報 054 * entrydn = "cn=inquiry-sys,o=opengion,c=JP" 属性の取得元のオブジェクトの名前 055 * password = "xxxxxx" 属性の取得元のオブジェクトのパスワード 056 * searchbase = "soouid=employeeuser,o=opengion,c=JP" 検索するコンテキストまたはオブジェクトのベース名 057 * filter = "(objectClass=person)" 検索に使用するフィルタ式。null は不可 058 * attributes = "uid,cn,officeName,ou,mail,belongOUID" 属性を識別する属性 IDをカンマ区切りで指定 059 * searchScope = "SUBTREE" 検索範囲を設定(『OBJECT』『ONELEVEL』『SUBTREE』のどれか) 060 * maxRowCount = "0" 検索時の最大検索数(0は、無制限:デフォルト) 061 * /> 062 * ●body:なし 063 * 064 * ●Tag定義: 065 * <og:ldapQuery 066 * initctx 【TAG】初期コンテキストファクトリを指定します (初期値:LDAP_INITIAL_CONTEXT_FACTORY[=com.sun.jndi.ldap.LdapCtxFactory]) 067 * providerURL 【TAG】サービスプロバイダの構成情報を指定します (初期値:LDAP_PROVIDER_URL[=ldap://ldap.opengion.org:389]) 068 * entrydn 【TAG】属性の取得元のオブジェクトの名前を設定します (初期値:LDAP_ENTRYDN[=cn=inquiry-sys,o=opengion,c=JP]) 069 * password 【TAG】属性の取得元のオブジェクトのパスワードを設定します (初期値:LDAP_PASSWORD[=password]) 070 * searchbase 【TAG】検索するコンテキストまたはオブジェクトの名前を設定します (初期値:LDAP_SEARCH_BASE[=soouid=employeeuser,o=opengion,c=JP]) 071 * filter ○【TAG】検索に使用するフィルタ式(例:belongOUID=61200)(必須)。 072 * searchScope 【TAG】検索範囲(OBJECT/ONELEVEL/SUBTREE)を設定します (初期値:LDAP_SEARCH_SCOPE[=SUBTREE]) 073 * timeLimit 【TAG】これらの SearchControls の時間制限をミリ秒単位で設定します(初期値:0[無制限]) 074 * derefLinkFlag 【TAG】検索中のリンクへの間接参照を有効または無効[true/false]にします(初期値:false) 075 * maxRowCount 【TAG】レジストリの最大検索件数をセットします(初期値:0[無制限]) 076 * returningObjFlag 【TAG】結果の一部としてオブジェクトを返すことを有効または無効[true/false]にします(初期値:false) 077 * attributes 【TAG】検索の一部として返される属性をCSVで複数指定します 078 * columns 【TAG】作成する DBTableModel のカラム名をCSV形式で指定します 079 * orderBy 【TAG】検索した結果を表示する表示順をファイル属性名で指定します 080 * tableId 【TAG】(通常は使いません)結果をDBTableModelに書き込んで、sessionに登録するときのキーを指定します 081 * command 【TAG】コマンド(NEW,RENEW)をセットします(初期値:NEW) 082 * displayMsg 【TAG】検索結果を画面上に表示するメッセージリソースIDを指定します(初期値は検索件数) 083 * notfoundMsg 【TAG】検索結果がゼロ件の場合に表示するメッセージリソースIDを指定します(初期値:MSG0077[対象データはありませんでした]) 084 * overflowMsg 【TAG】オーバーフロー時に画面上に表示するメッセージIDを指定します(初期値:MSG0007) 085 * scope 【TAG】キャッシュする場合のスコープ[request/page/session/applicaton]を指定します(初期値:session) 086 * mainTrans 【TAG】(通常使いません)タグで処理される処理がメインとなるトランザクション処理かどうかを指定します(初期値:false) 087 * debug 【TAG】デバッグ情報を出力するかどうか[true/false]を指定します(初期値:false) 088 * /> 089 * 090 * ●使用例 091 * システムパラメータ に、必要なLDAP定数を定義しておいた場合は、下記のタグで検索できます。 092 * 例では、filter にあいまい検索(*)とAND条件(&(条件A)(条件B)) を指定した例を挙げておきます。 093 * filter の形式と解釈は、RFC 2254 に準拠しています。 094 * (RFC 2254 で定義されている演算子のすべてをすべての属性に適用できるわけではありません。) 095 * 096 * <og:ldapQuery debug="false" 097 * command = "NEW" 098 * filter = "(&(cnphoneticlangjp=OPENGION*)(businessName=*COMMON*))" 099 * attributes = "uid,cn,officeName,ou,mail,belongOUID" 100 * /> 101 * 102 * ・queryOption タグの内部に記述すれば、プルダウンメニューを作成することが可能です。 103 * <og:select name="UID"> 104 * <og:queryOption> 105 * <og:ldapQuery 106 * filter = "(&amp;(|(belongOUID=60000)(belongOUID=70000))(uid=C*))" 107 * attributes = "uid,uid,sn" 108 * orderBy = "uid" 109 * /> 110 * </og:queryOption> 111 * </og:select> 112 * 113 * @og.rev 3.1.0.0 (2003/03/20) LDAPにアクセスできる、LDAPQueryTag.java を新規に作成。 114 * @og.group その他入力 115 * 116 * @version 4.0 117 * @author Kazuhiko Hasegawa 118 * @since JDK5.0, 119 */ 120public class LDAPQueryTag extends CommonTagSupport { 121 //* このプログラムのVERSION文字列を設定します。 {@value} */ 122 private static final String VERSION = "5.1.6.0 (2010/05/01)" ; 123 124 private static final long serialVersionUID = 516020100501L ; 125 126 /** command 引数に渡す事の出来る コマンド 新規 {@value} */ 127 public static final String CMD_NEW = "NEW" ; 128 /** command 引数に渡す事の出来る コマンド 再検索 {@value} */ 129 public static final String CMD_RENEW = "RENEW" ; 130 /** command 引数に渡す事の出来る コマンド リスト */ 131 private static final String[] COMMAND_LIST = new String[] { CMD_NEW , CMD_RENEW }; 132 133 private String initctx = HybsSystem.sys( "LDAP_INITIAL_CONTEXT_FACTORY" ); 134 private String providerURL = HybsSystem.sys( "LDAP_PROVIDER_URL" ); 135 private String entrydn = HybsSystem.sys( "LDAP_ENTRYDN" ); 136 private String password = HybsSystem.sys( "LDAP_PASSWORD" ); // 4.2.2.0 (2008/05/10) 137 private String searchbase = HybsSystem.sys( "LDAP_SEARCH_BASE" ); 138 private String filter = null; // "employeeNumber=87019"; 139 140 // 検索範囲。OBJECT_SCOPE、ONELEVEL_SCOPE、SUBTREE_SCOPE のどれか 1 つ 141 private String searchScope = HybsSystem.sys( "LDAP_SEARCH_SCOPE" ); 142 private static final long COUNTLIMIT = 0; // 返すエントリの最大数。0 の場合、フィルタを満たすエントリをすべて返す 143 private int timeLimit = 0; // 結果が返されるまでのミリ秒数。0 の場合、無制限 144 private String[] attrs = null; // エントリと一緒に返される属性の識別子。null の場合、すべての属性を返す。空の場合、属性を返さない 145 private String[] columns = null; // DBTableModel を作成する場合のカラム名になります。null の場合は、attributes 属性 146 private boolean returningObjFlag = false; // true の場合、エントリの名前にバインドされたオブジェクトを返す。false 場合、オブジェクトを返さない 147 private boolean derefLinkFlag = false; // true の場合、検索中にリンクを間接参照する 148 149 private String tableId = HybsSystem.TBL_MDL_KEY; // sessionキー 150 private String orderBy = null; // ソート項目(csv) 151 private String command = CMD_NEW; // コマンド 152 private int executeCount = 0; // 検索/実行件数 153 private int errCode = ErrorMessage.OK; // Ver4.3.1.1 (2008/09/05) 検索エラーコード 154 private int maxRowCount = 0; // 最大検索数(0は無制限) 155 private String displayMsg = HybsSystem.sys( "VIEW_DISPLAY_MSG" ); 156 private String overflowMsg = "MSG0007"; // 検索結果が、制限行数を超えましたので、残りはカットされました。 157 private String notfoundMsg = "MSG0077"; // 対象データはありませんでした。 158 private boolean isMainTrans = true; // 5.1.6.0 (2010/05/01) DBLastSqlの処理の見直し 159 160 /** 161 * Taglibの終了タグが見つかったときに処理する doEndTag() を オーバーライドします。 162 * 163 * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応。release2() を doEndTag()で呼ぶ。 164 * @og.rev 3.6.0.8 (2004/11/19) DBTableModel をセーブする時に、トランザクションチェックを行います。 165 * @og.rev 4.0.0.0 (2007/10/18) メッセージリソース統合( getResource().getMessage ⇒ getResource().getLabel ) 166 * @og.rev 4.3.1.1 (2008/09/03) 検索結果の件数、状況コードをリクエスト変数 "DB.COUNT"、"DB.ERR_CODE" にセットする。 167 * @og.rev 5.1.6.0 (2010/05/01) DBLastSqlの処理は、DBTableModelが新規作成された処理でのみ行う。 168 * 169 * @return 後続処理の指示 170 */ 171 @Override 172 public int doEndTag() { 173 debugPrint(); // 4.0.0 (2005/02/28) 174 175 // QueryOptionTag の内部で記述された場合の処理。 176 QueryOptionTag queryOption = (QueryOptionTag)findAncestorWithClass( this,QueryOptionTag.class ); 177 if( queryOption != null ) { 178 queryOption.setTableModel( makeDBTable() ); 179 return EVAL_PAGE ; 180 } 181 182 // 通常の LDAPQuery 処理 183 if( check( command, COMMAND_LIST ) ) { 184 useMainTrans( isMainTrans ); // 5.1.6.0 (2010/05/01) DBLastSqlの処理の見直し 185 startQueryTransaction( tableId ); // 3.6.0.8 (2004/11/19) 186 187 DBTableModel table = makeDBTable(); 188 189 // 3.6.0.8 (2004/11/19) トランザクションチェックを行います。 190 if( ! commitTableObject( tableId, table ) ) { 191 jspPrint( "LDAPQueryTag Query処理が割り込まれました。DBTableModel は登録しません。" ); 192 return SKIP_PAGE ; 193 } 194 StringBuilder buf = new StringBuilder( HybsSystem.BUFFER_SMALL ); 195 196 // 実行件数の表示 command="NEW" のときのみ、displayMsg を表示させます。 197 // 4.0.0 (2005/11/30) 出力順の変更。一番最初に出力します。 198 if( CMD_NEW.equals( command ) ) { 199 if( executeCount > 0 && displayMsg != null && displayMsg.length() > 0 ) { 200 buf.append( executeCount ); 201 buf.append( getResource().getLabel( displayMsg ) ); 202 buf.append( HybsSystem.BR ); 203 } 204 else if( executeCount == 0 && notfoundMsg != null && notfoundMsg.length() > 0 ) { 205 buf.append( getResource().getLabel( notfoundMsg ) ); 206 buf.append( HybsSystem.BR ); 207 } 208 } 209 210 if( maxRowCount > 0 && maxRowCount <= executeCount ) { 211 buf.append( getResource().getLabel( overflowMsg ) ); 212 buf.append( HybsSystem.BR ).append( HybsSystem.CR ); 213 } 214 // 4.3.1.1 (2008/09/03) 検索結果の件数、エラーコードをセットする。 215 setRequestAttribute( "DB.COUNT" , String.valueOf( executeCount ) ); 216 setRequestAttribute( "DB.ERR_CODE", String.valueOf( errCode ) ); 217 218 jspPrint( buf.toString() ); 219 } 220 221 return EVAL_PAGE ; 222 } 223 224 /** 225 * タグリブオブジェクトをリリースします。 226 * キャッシュされて再利用されるので、フィールドの初期設定を行います。 227 * 228 * @og.rev 2.0.0.4 (2002/09/27) カスタムタグの release() メソッドを、追加 229 * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応。release2() を doEndTag()で呼ぶ。 230 * @og.rev 4.2.2.0 (2008/05/10) password 追加 231 * @og.rev 5.1.6.0 (2010/05/01) DBLastSqlの処理は、DBTableModelが新規作成された処理でのみ行う。 232 * 233 */ 234 @Override 235 protected void release2() { 236 super.release2(); 237 238 searchScope = HybsSystem.sys( "LDAP_SEARCH_SCOPE" ); // 検索範囲。OBJECT_SCOPE、ONELEVEL_SCOPE、SUBTREE_SCOPE のどれか 1 つ 239 timeLimit = 0; // 結果が返されるまでのミリ秒数。0 の場合、無制限 240 derefLinkFlag = false; // true の場合、検索中にリンクを間接参照する 241 returningObjFlag = false; // true の場合、エントリの名前にバインドされたオブジェクトを返す。false 場合、オブジェクトを返さない 242 attrs = null; // エントリと一緒に返される属性の識別子。null の場合、すべての属性を返す。空の場合、属性を返さない 243 columns = null; // DBTableModel を作成する場合のカラム名になります。null の場合は、attributes 属性 244 245 initctx = HybsSystem.sys( "LDAP_INITIAL_CONTEXT_FACTORY" ); 246 providerURL = HybsSystem.sys( "LDAP_PROVIDER_URL" ); 247 entrydn = HybsSystem.sys( "LDAP_ENTRYDN" ); 248 password = HybsSystem.sys( "LDAP_PASSWORD" ); // 4.2.2.0 (2008/05/10) 249 searchbase = HybsSystem.sys( "LDAP_SEARCH_BASE" ); 250 filter = null; // "employeeNumber=87019"; 251 252 tableId = HybsSystem.TBL_MDL_KEY; // sessionキー 253 orderBy = null; // ソート項目(csv) 254 command = CMD_NEW; // コマンド 255 executeCount = 0; // 検索/実行件数 256 errCode = ErrorMessage.OK; // Ver4.3.1.1 (2008/09/05) 検索エラーコード 257 maxRowCount = 0; // 最大検索数(0は無制限) 258 displayMsg = HybsSystem.sys( "VIEW_DISPLAY_MSG" ); 259 overflowMsg = "MSG0007"; // 検索結果が、制限行数を超えましたので、残りはカットされました。 */ 260 notfoundMsg = "MSG0077"; // 対象データはありませんでした。 261 isMainTrans = true; // 5.1.6.0 (2010/05/01) DBLastSqlの処理の見直し 262 } 263 264 /** 265 * LDPA から、値を取り出し、DBTableModel を作成します。 266 * 267 * @og.rev 4.2.2.0 (2008/05/10) entrydn と、password 処理の追加 268 * 269 * @return テーブルモデル 270 */ 271 private DBTableModel makeDBTable() { 272 if( filter == null ) { 273 String errMsg = "S検索フィルターに null が指定されました。" ; 274 throw new HybsSystemException( errMsg ); 275 } 276 277 LDAPSearch serch = new LDAPSearch(); 278 serch.setSearchScope( searchScope ) ; 279 serch.setTimeLimit( timeLimit ) ; 280 serch.setDerefLinkFlag( derefLinkFlag ) ; 281 serch.setReturningObjFlag( returningObjFlag ) ; 282 serch.setMaxRowCount( maxRowCount ) ; 283 serch.setAttributes( attrs ) ; 284 serch.setInitctx( initctx ) ; 285 serch.setProviderURL( providerURL ) ; 286 serch.setSearchbase( searchbase ) ; 287 if( entrydn != null ) { serch.setEntrydn( entrydn ) ; } //4 .2.2.0 (2008/05/10) 288 if( password != null ) { serch.setPassword( password ) ; } //4 .2.2.0 (2008/05/10) 289 serch.setOrderBy( orderBy ) ; 290 serch.init(); 291 292 List<String[]> list = serch.search( filter ); 293 executeCount = list.size(); 294 295 String[] ids = serch.getAttributes(); // attrs が null の場合、全件。それ以外は、attrs 296 297 // DBTableModel に使用するカラム名の登録 298 if( columns != null && columns.length > 0 ) { 299 if( ids.length != columns.length ) { 300 String errMsg = "attributes 属性とcolumns属性の個数が異なります。" 301 + "attrs=[" + attrs.length + "]:" + StringUtil.array2csv( attrs ) 302 + HybsSystem.CR 303 + " columns=[" + columns.length + "]:" + StringUtil.array2csv( columns ) 304 + HybsSystem.CR ; 305 throw new HybsSystemException( errMsg ); 306 } 307 for( int i=0; i<columns.length; i++ ) { 308 // columns にカラム名が設定されている場合のみ、使用する。 309 if( columns[i] != null && columns[i].length() > 0 ) { 310 ids[i] = columns[i]; 311 } 312 } 313 } 314 315 DBTableModel table = null; 316 if( ids.length > 0 ) { 317 table = DBTableModelUtil.newDBTable(); 318 table.init( ids.length ); 319 for( int clm=0; clm<ids.length; clm++ ) { 320 DBColumn dbColumn = getResource().makeDBColumn( ids[clm] ); 321 table.setDBColumn( clm,dbColumn ); 322 } 323 324 for( int row=0; row<executeCount; row++ ) { 325 table.addColumnValues( list.get( row ) ); 326 } 327 } 328 return table ; 329 } 330 331 /** 332 * 【TAG】検索範囲(OBJECT/ONELEVEL/SUBTREE)を設定します 333 * (初期値:LDAP_SEARCH_SCOPE[={@og.value org.opengion.hayabusa.common.SystemData#LDAP_SEARCH_SCOPE}])。 334 * 335 * @og.tag 336 * 検索範囲を OBJECT_SCOPE、ONELEVEL_SCOPE、SUBTREE_SCOPE のどれか 1 つです。 337 * 指定文字列は、それぞれ『OBJECT』『ONELEVEL』『SUBTREE』です。 338 * (初期値:システム定数のLDAP_SEARCH_SCOPE[={@og.value org.opengion.hayabusa.common.SystemData#LDAP_SEARCH_SCOPE}])。 339 * 340 * @param scope SearchControls の検索範囲 341 * @see org.opengion.hayabusa.common.SystemData#LDAP_SEARCH_SCOPE 342 */ 343 public void setSearchScope( final String scope ) { 344 searchScope = nval( getRequestParameter( scope ), searchScope ); 345 } 346 347 /** 348 * 【TAG】これらの SearchControls の時間制限をミリ秒単位で設定します(初期値:0[無制限])。 349 * 350 * @og.tag 351 * 値が 0 の場合、無制限に待つことを意味します。 352 * 353 * @param limit ミリ秒単位の時間制限(初期値:無制限) 354 */ 355 public void setTimeLimit( final String limit ) { 356 timeLimit = nval( getRequestParameter( limit ), timeLimit ); 357 } 358 359 /** 360 * 【TAG】検索中のリンクへの間接参照を有効または無効[true/false]にします(初期値:false)。 361 * 362 * @og.tag 検索中のリンクへの間接参照を有効または無効にします。 363 * 364 * @param deref リンクを逆参照する場合は true、そうでない場合は false(初期値:false) 365 */ 366 public void setDerefLinkFlag( final String deref ) { 367 derefLinkFlag = nval( getRequestParameter( deref ), derefLinkFlag ); 368 } 369 370 /** 371 * 【TAG】結果の一部としてオブジェクトを返すことを有効または無効[true/false]にします(初期値:false)。 372 * 373 * @og.tag 374 * 無効にした場合、オブジェクトの名前およびクラスだけが返されます。 375 * 有効にした場合、オブジェクトが返されます。 376 * 377 * @param pbjflag オブジェクトが返される場合は true、そうでない場合は false(初期値:false) 378 */ 379 public void setReturningObjFlag( final String pbjflag ) { 380 returningObjFlag = nval( getRequestParameter( pbjflag ), returningObjFlag ); 381 } 382 383 /** 384 * 【TAG】レジストリの最大検索件数をセットします(初期値:0[無制限])。 385 * 386 * @og.tag 387 * DBTableModelのデータとして登録する最大件数をこの値に設定します。 388 * サーバーのメモリ資源と応答時間の確保の為です。 389 * 初期値は、0 は、無制限です。 390 * 391 * @param count レジストリの最大検索件数 392 */ 393 public void setMaxRowCount( final String count ) { 394 maxRowCount = nval( getRequestParameter( count ),maxRowCount ); 395 } 396 397 /** 398 * 【TAG】検索の一部として返される属性をCSVで複数指定します。 399 * 400 * @og.tag 401 * null は属性が何も返されないことを示します。 402 * このメソッドからは、空の配列をセットすることは出来ません。 403 * 404 * @og.rev 3.5.6.2 (2004/07/05) 先に配列に分解してからリクエスト変数の値を取得 405 * @og.rev 3.7.0.4 (2005/03/18) リクエスト変数の値を取得後、分解します。 406 * 407 * @param val 返される属性を識別する属性 ID の羅列(カンマ区切り文字) 408 */ 409 public void setAttributes( final String val ) { 410 String att = nval( getRequestParameter( val ),null ); 411 if( att != null ) { 412 attrs = StringUtil.csv2Array( att ); 413 } 414 } 415 416 /** 417 * 【TAG】作成する DBTableModel のカラム名をCSV形式で指定します。 418 * 419 * @og.tag 420 * なにも指定しない場合は、attributes 属性が使用されます。 421 * LDAP検索結果に、別名をつけるイメージで使用します。 422 * 423 * @og.rev 3.7.1.0 (2005/04/26) 新規追加 424 * 425 * @param clm 作成する DBTableModel のカラム名(カンマ区切り文字) 426 */ 427 public void setColumns( final String clm ) { 428 String cl = nval( getRequestParameter( clm ),null ); 429 if( cl != null ) { 430 columns = StringUtil.csv2Array( cl ); 431 } 432 } 433 434 /** 435 * 【TAG】初期コンテキストファクトリを指定します 436 * (初期値:LDAP_INITIAL_CONTEXT_FACTORY[={@og.value org.opengion.hayabusa.common.SystemData#LDAP_INITIAL_CONTEXT_FACTORY}])。 437 * 438 * @og.tag 439 * 例)com.sun.jndi.ldap.LdapCtxFactory 440 * (初期値:システム定数のLDAP_INITIAL_CONTEXT_FACTORY[={@og.value org.opengion.hayabusa.common.SystemData#LDAP_INITIAL_CONTEXT_FACTORY}])。 441 * 442 * @param ctx 初期コンテキストファクトリ 443 * @see org.opengion.hayabusa.common.SystemData#LDAP_INITIAL_CONTEXT_FACTORY 444 */ 445 public void setInitctx( final String ctx ) { 446 initctx = nval( getRequestParameter( ctx ), initctx ); 447 } 448 449 /** 450 * 【TAG】サービスプロバイダの構成情報を指定します 451 * (初期値:LDAP_PROVIDER_URL[={@og.value org.opengion.hayabusa.common.SystemData#LDAP_PROVIDER_URL}])。 452 * 453 * @og.tag 454 * プロトコルとサーバーとポートを指定します。 455 * 例)『ldap://ldap.opengion.org:389』 456 * (初期値:システム定数のLDAP_PROVIDER_URL[={@og.value org.opengion.hayabusa.common.SystemData#LDAP_PROVIDER_URL}])。 457 * 458 * @param url サービスプロバイダの構成情報 459 * @see org.opengion.hayabusa.common.SystemData#LDAP_PROVIDER_URL 460 */ 461 public void setProviderURL( final String url ) { 462 providerURL = nval( getRequestParameter( url ), providerURL ); 463 } 464 465 /** 466 * 【TAG】検索するコンテキストまたはオブジェクトの名前を設定します 467 * (初期値:LDAP_SEARCH_BASE[={@og.value org.opengion.hayabusa.common.SystemData#LDAP_SEARCH_BASE}])。 468 * 469 * @og.tag 470 * 例)『soOUID=employeeuser,o=opengion,c=JP』 471 * (初期値:システム定数のLDAP_SEARCH_BASE[={@og.value org.opengion.hayabusa.common.SystemData#LDAP_SEARCH_BASE}])。 472 * 473 * @param base 検索ベース 474 * @see org.opengion.hayabusa.common.SystemData#LDAP_SEARCH_BASE 475 */ 476 public void setSearchbase( final String base ) { 477 searchbase = nval( getRequestParameter( base ), searchbase ); 478 } 479 480 /** 481 * 【TAG】検索に使用するフィルタ式(例:belongOUID=61200)。 482 * 483 * @og.tag 484 * 例)『belongOUID=61200』 485 * 486 * @param siki フィルタ式 487 */ 488 public void setFilter( final String siki ) { 489 filter = nval( getRequestParameter( siki ), filter ); 490 } 491 492 /** 493 * 【TAG】属性の取得元のオブジェクトの名前を設定します 494 * (初期値:LDAP_ENTRYDN[={@og.value org.opengion.hayabusa.common.SystemData#LDAP_ENTRYDN}])。 495 * 496 * @og.tag 497 * 例)『soOUID=opengion-sys,o=opengion,c=JP』 498 * (初期値:システム定数のLDAP_ENTRYDN[={@og.value org.opengion.hayabusa.common.SystemData#LDAP_ENTRYDN}])。 499 * 500 * @og.rev 4.2.2.0 (2008/05/10) 初期値変更 501 * 502 * @param dn 取得元のオブジェクトの名前 503 * @see org.opengion.hayabusa.common.SystemData#LDAP_ENTRYDN 504 */ 505 public void setEntrydn( final String dn ) { 506 entrydn = nval( getRequestParameter( dn ), entrydn ); 507 } 508 509 /** 510 * 【TAG】属性の取得元のオブジェクトのパスワードを設定します 511 * (初期値:LDAP_PASSWORD[={@og.value org.opengion.hayabusa.common.SystemData#LDAP_PASSWORD}])。 512 * 513 * @og.tag 514 * (初期値:システム定数のLDAP_PASSWORD[={@og.value org.opengion.hayabusa.common.SystemData#LDAP_PASSWORD}])。 515 * 516 * @og.rev 4.2.2.0 (2008/05/10) 新規追加 517 * 518 * @param pwd 取得元のオブジェクトのパスワード 519 * @see org.opengion.hayabusa.common.SystemData#LDAP_PASSWORD 520 */ 521 public void setPassword( final String pwd ) { 522 password = nval( getRequestParameter( pwd ), password ); 523 } 524 525 /** 526 * 【TAG】(通常は使いません)結果のDBTableModelを、sessionに登録するときのキーを指定します 527 * (初期値:HybsSystem#TBL_MDL_KEY[={@og.value org.opengion.hayabusa.common.HybsSystem#TBL_MDL_KEY}])。 528 * 529 * @og.tag 530 * 検索結果より、DBTableModelオブジェクトを作成します。これを、下流のviewタグ等に 531 * 渡す場合に、通常は、session を利用します。その場合の登録キーです。 532 * query タグを同時に実行して、結果を求める場合、同一メモリに配置される為、 533 * この tableId 属性を利用して、メモリ空間を分けます。 534 * (初期値:HybsSystem#TBL_MDL_KEY[={@og.value org.opengion.hayabusa.common.HybsSystem#TBL_MDL_KEY}])。 535 * 536 * @param id sessionに登録する時の ID 537 */ 538 public void setTableId( final String id ) { 539 tableId = nval( getRequestParameter( id ), tableId ); 540 } 541 542 /** 543 * 【TAG】検索した結果を表示する表示順をファイル属性名で指定します。 544 * 545 * @og.tag 546 * attributes 属性で指定するキー、または、LDAPから返されたキーについて 547 * その属性でソートします。逆順を行う場合は、DESC を指定のカラム名の後ろに 548 * 付けて下さい。 549 * 550 * @param ordr ソートキーを指定。 551 */ 552 public void setOrderBy( final String ordr ) { 553 orderBy = nval( getRequestParameter( ordr ), orderBy ); 554 if( orderBy != null ) { orderBy = orderBy.toUpperCase(Locale.JAPAN) ; } 555 } 556 557 /** 558 * 【TAG】コマンド(NEW,RENEW)をセットします(初期値:NEW)。 559 * 560 * @og.tag 561 * コマンドは,HTMLから(get/post)指定されますので,CMD_xxx で設定される 562 * フィールド定数値のいづれかを、指定できます。 563 * 何も設定されない、または、null の場合は、"NEW" が初期値にセットされます。 564 * 565 * @param cmd コマンド(public static final 宣言されている文字列) 566 * @see <a href="../../../../constant-values.html#org.opengion.hayabusa.taglib.LDAPQueryTag.CMD_NEW">コマンド定数</a> 567 */ 568 public void setCommand( final String cmd ) { 569 String cmd2 = getRequestParameter( cmd ); 570 if( cmd2 != null && cmd2.length() > 0 ) { command = cmd2.toUpperCase(Locale.JAPAN); } 571 } 572 573 /** 574 * 【TAG】検索結果を画面上に表示するメッセージリソースIDを指定します(初期値は検索件数)。 575 * 576 * @og.tag 577 * ここでは、検索結果の件数や登録された件数をまず出力し、 578 * その次に、ここで指定したメッセージをリソースから取得して 579 * 表示します。 580 * 表示させたくない場合は, displayMsg = "" をセットしてください。 581 * 初期値は、検索件数を表示します。 582 * 583 * @param id ディスプレイに表示させるメッセージ ID 584 */ 585 public void setDisplayMsg( final String id ) { 586 displayMsg = getRequestParameter( id ); 587 } 588 589 /** 590 * 【TAG】検索結果がゼロ件の場合に表示するメッセージリソースIDを指定します(初期値:MSG0077[対象データはありませんでした])。 591 * 592 * @og.tag 593 * ここでは、検索結果がゼロ件の場合のみ、特別なメッセージを表示させます。 594 * 従来は、displayMsg と兼用で、『0 件検索しました』という表示でしたが、 595 * displayMsg の初期表示は、OFF になりましたので、ゼロ件の場合のみ別に表示させます。 596 * 表示させたくない場合は, notfoundMsg = "" をセットしてください。 597 * 初期値は、MSG0077[対象データはありませんでした]です。 598 * 599 * @param id ディスプレイに表示させるメッセージ ID 600 */ 601 public void setNotfoundMsg( final String id ) { 602 String ids = getRequestParameter( id ); 603 if( ids != null ) { notfoundMsg = ids; } 604 } 605 606 /** 607 * 【TAG】オーバーフロー時に画面上に表示するメッセージIDを指定します(初期値:MSG0007)。 608 * 609 * @og.tag 610 * 表示させたくない場合は, overflowMsg = "" をセットしてください。 611 * 612 * @param id ディスプレイに表示させるメッセージ ID 613 */ 614 public void setOverflowMsg( final String id ) { 615 overflowMsg = getRequestParameter( id ); 616 } 617 618 /** 619 * 【TAG】(通常使いません)タグで処理される処理がメインとなるトランザクション処理かどうかを指定します(初期値:false)。 620 * 621 * @og.tag 622 * この値は、ファイルダウンロード処理に影響します。この値がtrueに指定された時にcommitされたDBTableModelが 623 * ファイルダウンロードの対象の表になります。 624 * 625 * このパラメーターは、通常、各タグにより実装され、ユーザーが指定する必要はありません。 626 * 但し、1つのJSP内でDBTableModelが複数生成される場合に、前に処理したDBTableModelについてファイルダウンロードをさせたい 627 * 場合は、後ろでDBTableModelを生成するタグで、明示的にこの値をfalseに指定することで、ファイルダウンロード処理の対象から 628 * 除外することができます。 629 * 630 * @og.rev 5.1.6.0 (2010/05/01) 新規作成 631 * 632 * @param flag メイントランザクションかどうか 633 */ 634 public void setMainTrans( final String flag ) { 635 isMainTrans = nval( getRequestParameter( flag ),isMainTrans ); 636 } 637 638 /** 639 * このオブジェクトの文字列表現を返します。 640 * 基本的にデバッグ目的に使用します。 641 * 642 * @return このクラスの文字列表現 643 */ 644 @Override 645 public String toString() { 646 return org.opengion.fukurou.util.ToString.title( this.getClass().getName() ) 647 .println( "VERSION" ,VERSION ) 648 .println( "initctx" ,initctx ) 649 .println( "providerURL" ,providerURL ) 650 .println( "entrydn" ,entrydn ) 651 .println( "searchbase" ,searchbase ) 652 .println( "filter" ,filter ) 653 .println( "searchScope" ,searchScope ) 654 .println( "COUNTLIMIT" ,COUNTLIMIT ) 655 .println( "timeLimit" ,timeLimit ) 656 .println( "attrs" ,attrs ) 657 .println( "columns" ,columns ) 658 .println( "returningObjFlag" ,returningObjFlag) 659 .println( "derefLinkFlag" ,derefLinkFlag ) 660 .println( "tableId" ,tableId ) 661 .println( "orderBy" ,orderBy ) 662 .println( "command" ,command ) 663 .println( "executeCount" ,executeCount ) 664 .println( "errCode" ,errCode ) 665 .println( "maxRowCount" ,maxRowCount ) 666 .println( "displayMsg" ,displayMsg ) 667 .println( "overflowMsg" ,overflowMsg ) 668 .println( "Other..." ,getAttributes().getAttribute() ) 669 .fixForm().toString() ; 670 } 671}