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 org.opengion.hayabusa.common.HybsSystem;
019    import org.opengion.hayabusa.common.HybsSystemException;
020    import org.opengion.hayabusa.db.DBTableModel;
021    import org.opengion.hayabusa.db.DBTableModelUtil;
022    import org.opengion.hayabusa.db.DBColumn;
023    
024    import static org.opengion.fukurou.util.StringUtil.nval ;
025    
026    import java.util.prefs.Preferences;
027    import java.util.prefs.BackingStoreException;
028    import java.util.Locale ;
029    
030    /**
031     * æŒ?®šã? Windowsレジストリã«ã‚¢ã‚¯ã‚»ã‚¹ã™ã‚‹ãŸã‚ã®ã‚¿ã‚°ã§ã?特殊ãªç’°å¢?¨­å®šãŒå¿?¦ã§ã?ã€?
032     *
033     * 検索ã—ãŸçµæžœã¯ã€DBTableModel ã«ã‚»ãƒ?ƒˆã•れるãŸã‚ã?
034     * JDBCQuery ã¨åŒæ§˜ã«ã€viewã‚¿ã‚°ã§è¡¨ç¤ºã•ã›ã‚‹ã“ã¨ãŒå¯èƒ½ã§ã™ã?
035     * 警�
036     * ã“ã?タグを使用ã™ã‚‹ã«ã¯ã€java.util.prefs.WindowsPreferenceクラスを変更ã—ã?
037     * æ­£è¦ã?クラスローãƒ??より先ã«èª­ã¿è¾¼ã¾ã›ã‚‹å¿?¦ãŒã‚りã¾ã™ã?ãれã¯ã€endorsedを利用ã—ã¾ã™ã?
038     * ä½?—ã€ç¾æ™‚点ã§ã¯ã€å?クラスãŒå¯¾è±¡ã«ãªã£ã¦ã—ã¾ã?Ÿã‚ã?標準的ã«åˆ©ç”¨ã™ã‚‹ã“ã¨ã¯ã§ãã¾ã›ã‚“ã€?
039     * (セキュリãƒ?‚£åŠã?ã€ä¸æ­£ãªæ›¸è¾¼ã¿ã‚’防ããŸã‚?
040     *
041     * @og.formSample
042     * â—å½¢å¼ï¼?lt;og:regQuery baseKey="?¥?¥?¥" ?¥?¥?¥ />
043     * â—body?šãªã?
044     *
045     * â—Tag定義??
046     *   <og:regQuery
047     *       baseKey          â—‹ã?TAG】検索ベã?スキーを設定ã—ã¾ã?HKEY_CURRENT_USER\Software 以下をベã?スã¨ã—ã¾ã?ã€?å¿??)
048     *       key                ã€TAG】検索キーを設定ã—ã¾ã?
049     *       value              ã€TAG】検索ãƒãƒªãƒ¥ãƒ¼ã‚’設定ã—ã¾ã?
050     *       maxRowCount        ã€TAGã€‘ãƒ¬ã‚¸ã‚¹ãƒˆãƒªã®æœ?¤§æ¤œç´¢ä»¶æ•°ã‚’ã‚»ãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:0[無制é™])
051     *       orderBy            ã€TAG】検索ã—ãŸçµæžœã‚’表示ã™ã‚‹è¡¨ç¤ºé ?‚’ファイル属æ?åã§æŒ?®šã—ã¾ã?
052     *       maxLevel           ã€TAG】検索時ã?æœ?¤§å±•開レベル(0ã¯ç„¡åˆ¶é™?を指定ã—ã¾ã?åˆæœŸå€¤:1)
053     *       like               ã€TAG】キーãŠã‚ˆã³ãƒãƒªãƒ¥ãƒ¼ã«ã¤ã?¦,like 検索を行ã†ã‹ã©ã?‹[true/false]を指定ã—ã¾ã?åˆæœŸå€¤:false)
054     *       tableId            ã€TAGã€?通常ã¯ä½¿ã?¾ã›ã‚“)çµæžœã‚’DBTableModelã«æ›¸ã込んã§ã€sessionã«ç™»éŒ²ã™ã‚‹ã¨ãã?キーを指定ã—ã¾ã?
055     *       command            ã€TAG】コマンãƒ?NEW,RENEW)ã‚’ã‚»ãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:NEW)
056     *       displayMsg         ã€TAGã€‘æ¤œç´¢çµæžœã‚’ç”»é¢ä¸Šã«è¡¨ç¤ºã™ã‚‹ãƒ¡ãƒ?‚»ãƒ¼ã‚¸IDを指定ã—ã¾ã?åˆæœŸå€¤:MSG0033[ 件検索ã—ã¾ã—ãŸ])
057     *       notfoundMsg        ã€TAGã€‘æ¤œç´¢çµæžœãŒã‚¼ãƒ­ä»¶ã®å ´åˆã«è¡¨ç¤ºã™ã‚‹ãƒ¡ãƒ?‚»ãƒ¼ã‚¸ãƒªã‚½ãƒ¼ã‚¹IDを指定ã—ã¾ã?åˆæœŸå€¤:MSG0077[対象ãƒ??ã‚¿ã¯ã‚りã¾ã›ã‚“ã§ã—ãŸ])
058     *       overflowMsg        ã€TAG】オーãƒã?フロー時ã«ç”»é¢ä¸Šã«è¡¨ç¤ºã™ã‚‹ãƒ¡ãƒ?‚»ãƒ¼ã‚¸IDを指定ã—ã¾ã?åˆæœŸå€¤:MSG0007)
059     *       scope              ã€TAG】キャãƒ?‚·ãƒ¥ã™ã‚‹å ´åˆã?スコープ[request/page/session/applicaton]を指定ã—ã¾ã?åˆæœŸå€¤:session)
060     *       mainTrans          ã€TAGã€?通常使ã?¾ã›ã‚“)ã‚¿ã‚°ã§å‡¦ç?•れる処ç?Œãƒ¡ã‚¤ãƒ³ã¨ãªã‚‹ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³å‡¦ç?‹ã©ã?‹ã‚’指定ã—ã¾ã?åˆæœŸå€¤:false)
061     *       debug              ã€TAG】デãƒãƒƒã‚°æƒ??ã‚’å?力ã™ã‚‹ã‹ã©ã?‹[true/false]を指定ã—ã¾ã?åˆæœŸå€¤:false)
062     *   />
063     *
064     * â—使用ä¾?
065     *    <og:regQuery  debug="false"
066     *        command     = "NEW"                       NEW,RENEW ãŒä½¿ç”¨ã§ãã¾ã™ã?
067     *        baseKey     = "/microsoft/windows nt"     検索時ã?ベã?スã¨ãªã‚‹ãƒ¬ã‚¸ã‚¹ãƒˆãƒªã‚­ãƒ¼å?
068     *        key         = "driver"                    検索ã—ãŸã?ƒ¬ã‚¸ã‚¹ãƒˆãƒªã‚­ãƒ¼å?åˆæœŸå€¤ã¯å…¨ä»¶)
069     *        value       = "Ne"                        検索ã—ãŸã?ƒ¬ã‚¸ã‚¹ãƒˆãƒªå€¤(åˆæœŸå€¤ã¯å…¨ä»¶)
070     *        maxRowCount = "0"                         æœ?¤§æ¤œç´¢ä»¶æ•°(0ã§ç„¡åˆ¶é™?
071     *        maxLevel    = "0"                         æœ?¤§æ¤œç´¢éšŽå±¤ãƒ¬ãƒ™ãƒ«(0ã§ç„¡åˆ¶é™?
072     *        like        = "true"                      true ã§æ›–昧検索/false ã¯ä¸??検索
073     *    />
074     *
075     * like ã¯ã€key / value を設定ã—ãŸã¨ãã?ã¿æœ‰åйã§ã™ã?ã¾ãŸã?key / value ã‚’ä¸¡æ–¹åŒæ™‚ã«è¨­å®šã—ãŸå?åˆã?ã€?
076     * like 属æ?ã¯ä¸¡æ–¹ã«åŒæ™‚ã«é©ç”¨ã•れã¾ã™ã?
077     *
078     * @og.rev 3.1.0.0 (2003/03/20) Windowsレジストリã«ã‚¢ã‚¯ã‚»ã‚¹ã§ãã‚‹ã€RegistryQueryTag.java ã‚’æ–°è¦ã«ä½œæ?ã€?
079     * @og.group ãã?ä»–å?åŠ?
080     *
081     * @version  4.0
082     * @author       Kazuhiko Hasegawa
083     * @since    JDK5.0,
084     */
085    public class RegistryQueryTag extends CommonTagSupport {
086            //* ã“ã?プログラãƒ??VERSIONæ–?­—å?を設定ã—ã¾ã™ã?       {@value} */
087            private static final String VERSION = "5.1.6.0 (2010/05/01)" ;
088    
089            private static final long serialVersionUID = 516020100501L ;
090    
091            /** command å¼•æ•°ã«æ¸¡ã™äº‹ã?出æ¥ã‚?コマンãƒ? æ–°è¦?{@value} */
092            public static final String CMD_NEW       = "NEW" ;
093            /** command å¼•æ•°ã«æ¸¡ã™äº‹ã?出æ¥ã‚?コマンãƒ? 冿¤œç´¢ {@value} */
094            public static final String CMD_RENEW = "RENEW" ;
095            /** command å¼•æ•°ã«æ¸¡ã™äº‹ã?出æ¥ã‚?コマンãƒ?リスãƒ? */
096            private static final String[] COMMAND_LIST = new String[] { CMD_NEW , CMD_RENEW };
097    
098            private static final String PREF_ROOT = "HKEY_CURRENT_USER/Software" ;
099    
100            private static final String[] COLUMN_KEY =
101                            new String[] { "LEBEL","KEY","VALUE","CHILD","PATH" };
102    
103            private String  tableId                 = HybsSystem.TBL_MDL_KEY;                       // session?·?°
104            private String  command                 = CMD_NEW;                                                      // ?º?ï¾ï¾?¾?
105            private String  baseKey                 = null;                                                         // 検索ベã?ス?·?°
106            private String  key                             = null;                                                         // 検索キー
107            private String  value                   = null;                                                         // 検索ãƒãƒªãƒ¥ãƒ¼
108            private int     maxRowCount             = 0;                                                            // æœ?¤§æ¤œç´¢æ•°(0ã¯ç„¡åˆ¶é™?
109            private String  orderBy                 = null;                                                         // ソートé?ç›®
110    //      private String  displayMsg              = "MSG0033";                                            // ã€?»¶æ¤œç´¢ã—ã¾ã—ãŸã€?
111            private String  displayMsg              = HybsSystem.sys( "VIEW_DISPLAY_MSG" );
112            private String  overflowMsg             = "MSG0007";                                            // æ¤œç´¢çµæžœãŒã?制é™è¡Œæ•°ã‚’è¶?ˆã¾ã—ãŸã®ã§ã€æ®‹ã‚Šã¯ã‚«ãƒ?ƒˆã•れã¾ã—ãŸã€?
113            private String  notfoundMsg             = "MSG0077";                                            // 対象ãƒ??ã‚¿ã¯ã‚りã¾ã›ã‚“ã§ã—ãŸã€?
114            private int             maxLevel                = 1;                                                            // 下ä½å±¤å±•é–‹æœ?¤§ãƒ¬ãƒ™ãƒ«(0ã¯ç„¡åˆ¶é™?
115            private boolean like                    = false;                                                        // ã‚ã„ã¾ã?¤œç´¢?Œï¾—ク??
116    
117            private int             executeCount    = 0;                                                            // 検索/実行件数
118            private boolean isMainTrans             = true;                                                         // 5.1.6.0 (2010/05/01) DBLastSqlã®å‡¦ç??見直ã?
119    
120            /**
121             * Taglibã®çµ‚äº?‚¿ã‚°ãŒè¦‹ã¤ã‹ã£ãŸã¨ãã«å‡¦ç?™ã‚?doEndTag() ã‚?オーãƒã?ライドã—ã¾ã™ã?
122             *
123             * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応ã?release2() ã‚?doEndTag()ã§å‘¼ã¶ã€?
124             * @og.rev 3.6.0.8 (2004/11/19) DBTableModel をセーブã™ã‚‹æ™‚ã«ã€ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³ãƒã‚§ãƒ?‚¯ã‚’行ã„ã¾ã™ã?
125             * @og.rev 4.0.0.0 (2007/10/18) メãƒ?‚»ãƒ¼ã‚¸ãƒªã‚½ãƒ¼ã‚¹çµ±å? getResource().getMessage > getResource().getLabel )
126             * @og.rev 5.1.6.0 (2010/05/01) DBLastSqlã®å‡¦ç??ã€DBTableModelãŒæ–°è¦ä½œæ?ã•れãŸå?ç?§ã®ã¿è¡Œã†ã€?
127             *
128             * @return      後続å?ç??æŒ?¤º
129             */
130            @Override
131            public int doEndTag() {
132                    debugPrint();           // 4.0.0 (2005/02/28)
133    
134                    if( check( command, COMMAND_LIST ) ) {
135                            useMainTrans( isMainTrans );                    // 5.1.6.0 (2010/05/01) DBLastSqlã®å‡¦ç??見直ã?
136                            startQueryTransaction( tableId );               // 3.6.0.8 (2004/11/19)
137    
138                            DBTableModel table = makeDBTable();
139                            // 3.6.0.8 (2004/11/19) トランザクションãƒã‚§ãƒ?‚¯ã‚’行ã„ã¾ã™ã?
140                            if( ! commitTableObject( tableId, table ) ) {
141                                    jspPrint( "RegistryQueryTag Query処ç?Œå‰²ã‚Šè¾¼ã¾ã‚Œã¾ã—ãŸã€?BTableModel ã¯ç™»éŒ²ã—ã¾ã›ã‚“ã€? );
142                                    return (SKIP_PAGE);
143                            }
144    
145    //                      String label  = "";                             // 4.0.0 (2005/11/30) 検索ã—ãªã‹ã£ãŸå?åˆã?
146                            StringBuilder buf = new StringBuilder( HybsSystem.BUFFER_SMALL );
147    
148                            // 実行件数ã®è¡¨ç¤º command="NEW" ã®ã¨ãã?ã¿ã€displayMsg を表示ã•ã›ã¾ã™ã?
149                            // 4.0.0 (2005/11/30) 出力é?ã®å¤‰æ›´ã€‚ä¸?•ªæœ??ã«å‡ºåŠ›ã—ã¾ã™ã?
150    //                      boolean useStatusBar = HybsSystem.sysBool( "VIEW_USE_DISPLAY_MSG" );
151                            if( CMD_NEW.equals( command ) ) {
152    //                              if( useStatusBar && executeCount > 0 && displayMsg != null && displayMsg.length() > 0 ) {
153                                    if( executeCount > 0 && displayMsg != null && displayMsg.length() > 0 ) {
154                                            buf.append( executeCount );
155    //                                      buf.append( getResource().getMessage( displayMsg ) );
156                                            buf.append( getResource().getLabel( displayMsg ) );
157                                            buf.append( HybsSystem.BR );
158                                    }
159                                    else if( executeCount == 0 && notfoundMsg != null && notfoundMsg.length() > 0 ) {
160    //                                      buf.append( getResource().getMessage( notfoundMsg ) );
161                                            buf.append( getResource().getLabel( notfoundMsg ) );
162                                            buf.append( HybsSystem.BR );
163                                    }
164                            }
165    
166                            if( maxRowCount > 0 && maxRowCount <= executeCount ) {
167    //                              buf.append( getResource().getMessage( overflowMsg ) );
168                                    buf.append( getResource().getLabel( overflowMsg ) );
169                                    buf.append( HybsSystem.BR );
170                            }
171    //                      label = buf.toString();
172    
173                            jspPrint( buf.toString() );
174                    }
175    
176                    return(EVAL_PAGE);
177            }
178    
179            /**
180             * タグリブオブジェクトをリリースã—ã¾ã™ã?
181             * キャãƒ?‚·ãƒ¥ã•れã¦å†åˆ©ç”¨ã•れるã?ã§ã€ãƒ•ィールドã?åˆæœŸè¨­å®šã‚’行ã„ã¾ã™ã?
182             *
183             * @og.rev 2.0.0.4 (2002/09/27) カスタãƒ?‚¿ã‚°ã® release() メソãƒ?ƒ‰ã‚’ã?追åŠ?
184             * @og.rev 3.1.1.2 (2003/04/04) Tomcat4.1 対応ã?release2() ã‚?doEndTag()ã§å‘¼ã¶ã€?
185             * @og.rev 5.1.6.0 (2010/05/01) DBLastSqlã®å‡¦ç??ã€DBTableModelãŒæ–°è¦ä½œæ?ã•れãŸå?ç?§ã®ã¿è¡Œã†ã€?
186             *
187             */
188            @Override
189            protected void release2() {
190                    super.release2();
191    
192                    tableId                 = HybsSystem.TBL_MDL_KEY;       // session?·?°
193                    orderBy                 = null;                                                         // ソートé?ç›®
194                    command                 = CMD_NEW;                                                      // ?º?ï¾ï¾?¾?
195                    baseKey                 = null;                                                         // 検索ベã?ス?·?°
196                    key                             = null;                                                         // 検索キー
197                    executeCount    = 0;                                                            // 検索/実行件数
198                    maxRowCount             = 0;                                                            // æœ?¤§æ¤œç´¢æ•°(0ã¯ç„¡åˆ¶é™?
199    //              displayMsg              = "MSG0033";                                            // 件検索ã—ã¾ã—ãŸã€?
200                    displayMsg              = HybsSystem.sys( "VIEW_DISPLAY_MSG" );
201                    overflowMsg             = "MSG0007";                                            // æ¤œç´¢çµæžœãŒã?制é™è¡Œæ•°ã‚’è¶?ˆã¾ã—ãŸã®ã§ã€æ®‹ã‚Šã¯ã‚«ãƒ?ƒˆã•れã¾ã—ãŸã€?
202                    notfoundMsg             = "MSG0077";                                            // 対象ãƒ??ã‚¿ã¯ã‚りã¾ã›ã‚“ã§ã—ãŸã€?
203                    maxLevel                = 1;                                                            // 下ä½å±¤å±•é–‹æœ?¤§ãƒ¬ãƒ™ãƒ«(0ã¯ç„¡åˆ¶é™?
204                    like                    = false;                                                        // ã‚ã„ã¾ã?¤œç´¢?Œï¾—ク??
205                    isMainTrans             = true;                                                         // 5.1.6.0 (2010/05/01) DBLastSqlã®å‡¦ç??見直ã?
206            }
207    
208            /**
209             * レジストリ ã‹ã‚‰ã€å?ã‚’å–りå?ã—ã?DBTableModel を作æ?ã—ã¾ã™ã?
210             *
211             * @return      ãƒ??ブルモãƒ?ƒ«
212             */
213            private DBTableModel makeDBTable() {
214                    DBTableModel table = DBTableModelUtil.newDBTable();
215                    table.init( COLUMN_KEY.length );
216                    for( int i=0; i<COLUMN_KEY.length; i++ ) {
217                            DBColumn dbColumn = getResource().makeDBColumn( COLUMN_KEY[i] );
218                            table.setDBColumn( i,dbColumn );
219                    }
220                    Preferences hayabusaRoot = Preferences.userRoot() ;
221    
222                    try {
223                            if( ! hayabusaRoot.nodeExists( baseKey ) ) {
224                                    String errMsg = "Preferences BaseKey ã?Windows Registry ã«å­˜åœ¨ã—ã¾ã›ã‚“ã§ã—ãŸã€?
225                                                                    + "[" + PREF_ROOT + baseKey + "]" ;
226                                    throw new HybsSystemException( errMsg );
227                            }
228    
229                            showChild( table,hayabusaRoot.node(baseKey),1 );
230                    }
231                    catch(BackingStoreException e) {
232                            String errMsg = "レジストリ ã‹ã‚‰ã€å?ã‚’å–りå?ã™äº‹ãŒå‡ºæ¥ã¾ã›ã‚“ã§ã—ãŸã€?
233                                                    + "[" + PREF_ROOT + baseKey + "]" ;             // 5.1.8.0 (2010/07/01) errMsg 修正
234                            throw new HybsSystemException( errMsg,e );              // 3.5.5.4 (2004/04/15) 引数ã®ä¸¦ã³é ?¤‰æ›´
235                    }
236    
237                    return table ;
238            }
239    
240            /**
241             * Preferences ã®å­è¦ç´?‚’検索ã—ã¾ã™ã?
242             *
243             * ã“ã?処ç??ã€å?帰定義ã«ã‚ˆã‚Šã€?šŽå±¤ã‚’é?次下ãŒã£ã¦ã?ã¾ã™ã?
244             * レベル制é™ã?検索æœ?¤§æ•°åˆ¶é™ã?ãƒã‚§ãƒ?‚¯ã‚’行ã£ã¦ã?¾ã™ã?
245             * addTableValue メソãƒ?ƒ‰ã‚’呼ã³å‡ºã—ã¦ã€æ¤œç´¢çµæžœã‚’ã?DBTableModel ã«é ?¬¡è¿½åŠ?—ã¦ã?ã¾ã™ã?
246             *
247             * @param       table   DBTableModelオブジェク�
248             * @param       prefs   Preferencesオブジェク�
249             * @param       lvl             レベル制�
250             */
251            private void showChild( final DBTableModel table,
252                                                            final Preferences prefs,
253                                                            final int lvl ) throws BackingStoreException {
254    
255                    if( maxRowCount > 0 && maxRowCount <= executeCount ) { return ; }
256                    if( maxLevel > 0 && lvl > maxLevel ) { return; }
257    
258                    String [] child = prefs.childrenNames();
259    
260                    if( child != null && child.length > 0 ) {
261                            for( int i = 0; i < child.length; i++) {
262                                    String name = child[i];
263                                    Preferences childPrefs = prefs.node( name.toLowerCase(Locale.JAPAN) );
264    
265                                    addTableValue( name,table,childPrefs,lvl,true );
266                                    showChild( table,childPrefs,lvl+1 );
267                            }
268                    }
269                    else {
270                            showPrefs( table,prefs,lvl );
271                    }
272            }
273    
274            /**
275             * Preferences ã®å±žæ?を検索ã—ã¾ã™ã?
276             *
277             * addTableValue メソãƒ?ƒ‰ã‚’呼ã³å‡ºã—ã¦ã€æ¤œç´¢çµæžœã‚’ã?DBTableModel ã«é ?¬¡è¿½åŠ?—ã¦ã?ã¾ã™ã?
278             *
279             * @param       table   DBTableModelオブジェク�
280             * @param       prefs   Preferencesオブジェク�
281             * @param       lvl             レベル制�
282             */
283            private void showPrefs( final DBTableModel table,
284                                                            final Preferences prefs,
285                                                            final int lvl ) throws BackingStoreException {
286    
287                    String [] keys = prefs.keys();
288    
289                    if( keys != null ) {
290                            for( int i = 0; i < keys.length; i++) {
291                                    String name = keys[i];
292                                    addTableValue( name,table,prefs,lvl,false );
293                            }
294                    }
295            }
296    
297            /**
298             * 検索ã•れã?Preferencesã‚’ã?DBTableModel ã«é ?¬¡è¿½åŠ?—ã¦ã?ã¾ã™ã?
299             *
300             * @param       name    検索キー
301             * @param       table   DBTableModelオブジェク�
302             * @param       prefs   Preferencesオブジェク�
303             * @param       lvl             レベル制�
304             * @param       flag    true:値ã«ç©ºæ–?­—å?/false:Preferencesã‹ã‚‰ã€æ¤œç´¢ã‚­ãƒ¼ã‚’使用ã—ã¦å€¤ã‚’å–å¾?
305             */
306            private void addTableValue( final String name,
307                                                                    final DBTableModel table,
308                                                                    final Preferences prefs,
309                                                                    final int lvl,
310                                                                    final boolean flag ) {
311    
312                    if( maxRowCount > 0 && maxRowCount <= executeCount ) { return ; }
313    
314                    String lowerName = name.toLowerCase(Locale.JAPAN);
315                    String val       = ( flag ) ? "" : prefs.get(lowerName, "");
316    
317                    if( key != null ) {
318                            if( like ) {
319                                    if( lowerName.indexOf( key ) < 0 ) { return; }
320                            }
321                            else {
322                                    if( ! lowerName.equalsIgnoreCase( key ) ) { return; }
323                            }
324                    }
325                    if( value != null ) {
326                            if( like ) {
327                                    if( (val.toLowerCase(Locale.JAPAN)).indexOf( value ) < 0 ) { return; }
328                            }
329                            else {
330                                    if( ! val.equalsIgnoreCase( value ) ) { return; }
331                            }
332                    }
333    
334                    String[] value = new String[COLUMN_KEY.length];
335                    value[0] = String.valueOf( lvl );                               // LEVEL
336                    value[1] = name;                                                                // KEY
337                    value[2] = val;                                                                 // VALUE
338                    value[3] = String.valueOf( flag );                              // CHILD
339                    value[4] = prefs.absolutePath() ;                               // PATH
340    
341                    table.addColumnValues( value );
342                    executeCount++ ;
343            }
344    
345            /**
346             * ã€TAGã€?通常ã¯ä½¿ã?¾ã›ã‚“)çµæžœã‚’DBTableModelã«æ›¸ã込んã§ã€sessionã«ç™»éŒ²ã™ã‚‹ã¨ãã?キーを指定ã—ã¾ã™ã?
347             *
348             * @og.tag
349             * åˆæœŸå€¤ã¯ã€HybsSystem.TBL_MDL_KEY ã§ã™ã?
350             *
351             * @param       id sessionã«ç™»éŒ²ã™ã‚‹æ™‚ã? ID
352             */
353            public void setTableId( final String id ) {
354                    tableId = nval( getRequestParameter( id ), tableId );
355            }
356    
357            /**
358             * ã€TAG】検索ã—ãŸçµæžœã‚’表示ã™ã‚‹è¡¨ç¤ºé ?‚’ファイル属æ?åã§æŒ?®šã—ã¾ã™ã?
359             *
360             * @og.tag
361             * ç¾ä»•様ã§ã¯ã€è¤?•°ã®ã‚­ãƒ¼ã‚’指定ã™ã‚‹ã“ã¨ã¯å‡ºæ¥ã¾ã›ã‚“ã€?
362             *
363             * @param       ordr    ソートキーを指定ã?
364             */
365            public void setOrderBy( final String ordr ) {
366                    orderBy = nval( getRequestParameter( ordr ),orderBy );
367            }
368    
369            /**
370             * ã€TAG】コマンãƒ?NEW,RENEW)ã‚’ã‚»ãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:NEW)ã€?
371             *
372             * @og.tag
373             * コマンドã?,HTMLã‹ã‚‰(get/post)æŒ?®šã•れã¾ã™ã?ã§,CMD_xxx ã§è¨­å®šã•れる
374             * フィールド定数値ã®ã?¥ã‚Œã‹ã‚’ã?æŒ?®šã§ãã¾ã™ã?
375             * 何も設定ã•れãªã??ã¾ãŸã?ã€null ã®å ´åˆã?ã€?NEW" ãŒå?期å?ã«ã‚»ãƒ?ƒˆã•れã¾ã™ã?
376             *
377             * @param       cmd コマンãƒ?public static final 宣è¨?•れã¦ã?‚‹æ–?­—å?)
378             * @see         <a href="{&#064;docRoot}/constant-values.html#org.opengion.hayabusa.taglib.RegistryQueryTag.CMD_NEW">コマンド定数</a>
379             */
380            public void setCommand( final String cmd ) {
381                    String cmd2 = getRequestParameter( cmd );
382                    if( cmd2 != null && cmd2.length() > 0 ) { command = cmd2.toUpperCase(Locale.JAPAN); }
383            }
384    
385            /**
386             * ã€TAG】検索ベã?スキーを設定ã—ã¾ã?HKEY_CURRENT_USER\Software 以下をベã?スã¨ã—ã¾ã?ã€?
387             *
388             * @og.tag
389             * キーã¯,HKEY_CURRENT_USER\Software 以下をベã?スã¨ã—ã¾ã™ã?
390             *
391             * @param       bkey 検索ベã?スキー
392             */
393            public void setBaseKey( final String bkey ) {
394                    baseKey = nval( getRequestParameter( bkey ),baseKey );
395                    if( baseKey != null ) { baseKey = baseKey.toLowerCase(Locale.JAPAN); }
396            }
397    
398            /**
399             * ã€TAG】検索キーを設定ã—ã¾ã™ã?
400             *
401             * @og.tag 検索キーを設定ã—ã¾ã™ã?
402             *
403             * @param       ky 検索キー
404             */
405            public void setKey( final String ky ) {
406                    key = nval( getRequestParameter( ky ),key );
407                    if( key != null ) { key = key.toLowerCase(Locale.JAPAN); }
408            }
409    
410            /**
411             * ã€TAG】検索ãƒãƒªãƒ¥ãƒ¼ã‚’設定ã—ã¾ã™ã?
412             *
413             * @og.tag 検索ãƒãƒªãƒ¥ãƒ¼ã‚’設定ã—ã¾ã™ã?
414             *
415             * @param       val 検索ãƒãƒªãƒ¥ãƒ¼
416             */
417            public void setValue( final String val ) {
418                    value = nval( getRequestParameter( val ),value );
419                    if( value != null ) { value = value.toLowerCase(Locale.JAPAN); }
420            }
421    
422            /**
423             * ã€TAGã€‘ãƒ¬ã‚¸ã‚¹ãƒˆãƒªã®æœ?¤§æ¤œç´¢ä»¶æ•°ã‚’ã‚»ãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:0[無制é™])ã€?
424             *
425             * @og.tag
426             * DBTableModelã®ãƒ??ã‚¿ã¨ã—ã¦ç™»éŒ²ã™ã‚‹æœ?¤§ä»¶æ•°ã‚’ã“ã®å€¤ã«è¨­å®šã—ã¾ã™ã?
427             * サーãƒã?ã®ãƒ¡ãƒ¢ãƒªè³?ºã¨å¿œç­”時間ã?確ä¿ã?為ã§ã™ã?
428             * åˆæœŸå€¤ã¯ã€? ã¯ã€ç„¡åˆ¶é™ã§ã™ã?
429             *
430             * @param       count ãƒ¬ã‚¸ã‚¹ãƒˆãƒªã®æœ?¤§æ¤œç´¢ä»¶æ•°
431             */
432            public void setMaxRowCount( final String count ) {
433                    maxRowCount = nval( getRequestParameter( count ),maxRowCount );
434            }
435    
436            /**
437             * ã€TAGã€‘æ¤œç´¢çµæžœã‚’ç”»é¢ä¸Šã«è¡¨ç¤ºã™ã‚‹ãƒ¡ãƒ?‚»ãƒ¼ã‚¸IDを指定ã—ã¾ã?åˆæœŸå€¤:MSG0033[ 件検索ã—ã¾ã—ãŸ])ã€?
438             *
439             * @og.tag
440             * ã“ã“ã§ã¯ã€æ¤œç´¢çµæžœã®ä»¶æ•°ã‚?™»éŒ²ã•れãŸä»¶æ•°ã‚’ã¾ãšå?力ã—ã€?
441             * ãã?次ã«ã€ã“ã“ã§æŒ?®šã—ãŸãƒ¡ãƒ?‚»ãƒ¼ã‚¸ã‚’リソースã‹ã‚‰å–å¾—ã—ã¦
442             * 表示ã—ã¾ã™ã?
443             * 表示ã•ã›ãŸããªã??åˆã?, displayMsg = "" ã‚’ã‚»ãƒ?ƒˆã—ã¦ãã ã•ã„ã€?
444             * åˆæœŸå€¤ã¯ã€æ¤œç´¢ä»¶æ•°ã‚’表示ã—ã¾ã™ã?
445             *
446             * @param       id ãƒ?‚£ã‚¹ãƒ—レイã«è¡¨ç¤ºã•ã›ã‚‹ãƒ¡ãƒ?‚»ãƒ¼ã‚¸ ID
447             */
448            public void setDisplayMsg( final String id ) {
449                    displayMsg = getRequestParameter( id );
450            }
451    
452            /**
453             * ã€TAGã€‘æ¤œç´¢çµæžœãŒã‚¼ãƒ­ä»¶ã®å ´åˆã«è¡¨ç¤ºã™ã‚‹ãƒ¡ãƒ?‚»ãƒ¼ã‚¸ãƒªã‚½ãƒ¼ã‚¹IDを指定ã—ã¾ã?åˆæœŸå€¤:MSG0077[対象ãƒ??ã‚¿ã¯ã‚りã¾ã›ã‚“ã§ã—ãŸ])ã€?
454             *
455             * @og.tag
456             * ã“ã“ã§ã¯ã€æ¤œç´¢çµæžœãŒã‚¼ãƒ­ä»¶ã®å ´åˆã?ã¿ã€ç‰¹åˆ¥ãªãƒ¡ãƒ?‚»ãƒ¼ã‚¸ã‚’表示ã•ã›ã¾ã™ã?
457             * 従æ¥ã¯ã€displayMsg ã¨å…¼ç”¨ã§ã€ã?0ã€?»¶æ¤œç´¢ã—ã¾ã—ãŸã€ã¨ã?†è¡¨ç¤ºã§ã—ãŸãŒã?
458             * displayMsg ã®åˆæœŸè¡¨ç¤ºã¯ã€OFF ã«ãªã‚Šã¾ã—ãŸã®ã§ã€ã‚¼ãƒ­ä»¶ã®å ´åˆã?ã¿åˆ¥ã«è¡¨ç¤ºã•ã›ã¾ã™ã?
459             * 表示ã•ã›ãŸããªã??åˆã?, notfoundMsg = "" ã‚’ã‚»ãƒ?ƒˆã—ã¦ãã ã•ã„ã€?
460             * åˆæœŸå€¤ã¯ã€MSG0077[対象ãƒ??ã‚¿ã¯ã‚りã¾ã›ã‚“ã§ã—ãŸ]ã§ã™ã?
461             *
462             * @param       id ãƒ?‚£ã‚¹ãƒ—レイã«è¡¨ç¤ºã•ã›ã‚‹ãƒ¡ãƒ?‚»ãƒ¼ã‚¸ ID
463             */
464            public void setNotfoundMsg( final String id ) {
465                    String ids = getRequestParameter( id );
466                    if( ids != null ) { notfoundMsg = ids; }
467            }
468    
469            /**
470             * ã€TAG】オーãƒã?フロー時ã«ç”»é¢ä¸Šã«è¡¨ç¤ºã™ã‚‹ãƒ¡ãƒ?‚»ãƒ¼ã‚¸IDを指定ã—ã¾ã?åˆæœŸå€¤:MSG0007)ã€?
471             *
472             * @og.tag
473             * 表示ã•ã›ãŸããªã??åˆã?, overflowMsg = "" ã‚’ã‚»ãƒ?ƒˆã—ã¦ãã ã•ã„ã€?
474             *
475             * @param       id ãƒ?‚£ã‚¹ãƒ—レイã«è¡¨ç¤ºã•ã›ã‚‹ãƒ¡ãƒ?‚»ãƒ¼ã‚¸ ID
476             */
477            public void setOverflowMsg( final String id ) {
478                    overflowMsg = getRequestParameter( id );
479            }
480    
481            /**
482             * ã€TAG】検索時ã?æœ?¤§å±•開レベル(0ã¯ç„¡åˆ¶é™?を指定ã—ã¾ã?åˆæœŸå€¤:1)ã€?
483             *
484             * @og.tag
485             * ?ã‚’æŒ?®šã™ã‚‹ã¨ã€ç„¡åˆ¶é™ã«éšŽå±¤ã‚’展開ã—ã¾ã™ã?
486             * åˆæœŸå€¤ã¯ã€?¼‘レベルã§ã™ã?
487             *
488             * @param       lvl 検索時ã?æœ?¤§å±•開レベル
489             */
490            public void setMaxLevel( final String lvl ) {
491                    maxLevel = nval( getRequestParameter( lvl ),maxLevel );
492            }
493    
494            /**
495             * ã€TAG】キーãŠã‚ˆã³ãƒãƒªãƒ¥ãƒ¼ã«ã¤ã?¦,like 検索を行ã†ã‹ã©ã?‹[true/false]を指定ã—ã¾ã?åˆæœŸå€¤:false)ã€?
496             *
497             * @og.tag
498             * like検索ã¨ã¯ã€ã‚­ãƒ¼ã®ä¸?ƒ¨ã®æ–?­—ã‚’å«ã‚??åˆã«ãƒžãƒƒãƒã—ãŸã¨ã—ã¦ã€å?ã‚’å–りå?ã—ã¾ã™ã?
499             * ã“ã“ã§ã®è¨­å®šã?ã€ã‚­ãƒ¼ã‚‚ãƒãƒªãƒ¥ãƒ¼ã‚‚åŒæ™‚ã«é©ç”¨ã•れã¾ã™ã?ã¾ãŸã?大æ–?­—å°æ–‡å­—ã?区別も行ã„ã¾ã›ã‚“ã€?
500             *
501             * @param       lik like 検索を行ã†ã‹ã©ã?‹
502             */
503            public void setLike( final String lik ) {
504                    like = nval( getRequestParameter( lik ),like );
505            }
506    
507            /**
508             * ã‚¿ã‚°ã®åç§°ã‚’ã?è¿”ã—ã¾ã™ã?
509             * 自åˆ??身ã®ã‚¯ãƒ©ã‚¹åよりã?自動的ã«å–り出ã›ãªã?Ÿã‚ã?ã“ã?メソãƒ?ƒ‰ã‚’オーãƒã?ライドã—ã¾ã™ã?
510             *
511             * @og.rev 4.0.0.0 (2005/01/31) æ–°è¦è¿½åŠ?
512             *
513             * @return  ã‚¿ã‚°ã®åç§°
514             */
515            @Override
516            protected String getTagName() {
517                    return "regQuery" ;
518            }
519    
520            /**
521             * ã€TAGã€?通常使ã?¾ã›ã‚“)ã‚¿ã‚°ã§å‡¦ç?•れる処ç?Œãƒ¡ã‚¤ãƒ³ã¨ãªã‚‹ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³å‡¦ç?‹ã©ã?‹ã‚’指定ã—ã¾ã?åˆæœŸå€¤:false)ã€?
522             *
523             * @og.tag
524             * ã“ã?値ã¯ã€ãƒ•ァイルãƒ?‚¦ãƒ³ãƒ­ãƒ¼ãƒ‰å?ç?«å½±éŸ¿ã—ã¾ã™ã?ã“ã?値ãŒtrueã«æŒ?®šã•ã‚ŒãŸæ™‚ã«commitã•れãŸDBTableModelã?
525             * ファイルãƒ?‚¦ãƒ³ãƒ­ãƒ¼ãƒ‰ã?対象ã®è¡¨ã«ãªã‚Šã¾ã™ã?
526             *
527             * ã“ã?パラメーターã¯ã€??常ã€å„ã‚¿ã‚°ã«ã‚ˆã‚Šå®Ÿè£?•れã?ãƒ¦ãƒ¼ã‚¶ãƒ¼ãŒæŒ‡å®šã™ã‚‹å¿?¦ã?ã‚りã¾ã›ã‚“ã€?
528             * ä½?—ã€?ã¤ã®JSPå†?§DBTableModelãŒè¤?•°ç”Ÿæ?ã•れるå?åˆã«ã€å‰ã«å‡¦ç?—ãŸDBTableModelã«ã¤ã?¦ãƒ•ァイルãƒ?‚¦ãƒ³ãƒ­ãƒ¼ãƒ‰ã‚’ã•ã›ãŸã„
529             * å ´åˆã?ã€å¾Œã‚ã§DBTableModelを生æˆã™ã‚‹ã‚¿ã‚°ã§ã€æ?示çš?«ã“ã?値をfalseã«æŒ?®šã™ã‚‹ã“ã¨ã§ã€ãƒ•ァイルãƒ?‚¦ãƒ³ãƒ­ãƒ¼ãƒ‰å?ç??対象ã‹ã‚‰
530             * 除外ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã?
531             *
532             * @og.rev 5.1.6.0 (2010/05/01) æ–°è¦ä½œæ?
533             *
534             * @param  flag メイントランザクションã‹ã©ã?‹
535             */
536            public void setMainTrans( final String flag ) {
537                    isMainTrans = nval( getRequestParameter( flag ),isMainTrans );
538            }
539    
540            /**
541             * ã“ã?オブジェクトã?æ–?­—å?表ç¾ã‚’è¿”ã—ã¾ã™ã?
542             * 基本çš?«ãƒ?ƒãƒ?‚°ç›®çš?«ä½¿ç”¨ã—ã¾ã™ã?
543             *
544             * @return ã“ã?ã‚¯ãƒ©ã‚¹ã®æ–?­—å?表ç¾
545             */
546            @Override
547            public String toString() {
548                    return org.opengion.fukurou.util.ToString.title( this.getClass().getName() )
549                                    .println( "VERSION"             ,VERSION                )
550                                    .println( "tableId"             ,tableId                )
551                                    .println( "command"             ,command                )
552                                    .println( "baseKey"             ,baseKey                )
553                                    .println( "key"                 ,key                    )
554                                    .println( "value"               ,value                  )
555                                    .println( "maxRowCount" ,maxRowCount    )
556                                    .println( "orderBy"             ,orderBy                )
557                                    .println( "displayMsg"  ,displayMsg             )
558                                    .println( "overflowMsg" ,overflowMsg    )
559                                    .println( "maxLevel"    ,maxLevel               )
560                                    .println( "like"                ,like                   )
561                                    .println( "executeCount",executeCount   )
562                                    .println( "PREF_ROOT"   ,PREF_ROOT              )
563                                    .println( "COLUMN_KEY"  ,COLUMN_KEY             )
564                                    .println( "Other..."    ,getAttributes().getAttribute() )
565                                    .fixForm().toString() ;
566            }
567    }