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