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.fukurou.util.ErrorMessage;
019 import org.opengion.hayabusa.common.HybsSystem;
020 import org.opengion.hayabusa.common.HybsSystemException;
021 import org.opengion.hayabusa.db.DBTableModel;
022 import org.opengion.hayabusa.db.DBMetaData;
023
024 import static org.opengion.fukurou.util.StringUtil.nval ;
025
026 import java.util.Locale ;
027
028 /**
029 * ãƒ??タベã?スæƒ??(DBMetaData)よりã€ãƒ†ãƒ¼ãƒ–ルã€ã‚«ãƒ©ãƒ?‰ã?æƒ??ã‚’å–å¾—ã™ã‚‹ã‚¿ã‚°ã§ã™ã?
030 *
031 * ãƒ??タベã?スã«é–¢ã™ã‚‹åŒ?‹¬çš?ªæƒ??ã‚’æä¾›ã™ã‚‹ã?DatabaseMetaData ã®å†?®¹ã‚?
032 * å–å¾—ã—ã¦ã€DBTableModel ã«ã‚»ãƒ?ƒˆã™ã‚‹ã‚¿ã‚°ã§ã™ã?
033 *
034 * @og.formSample
035 * â—å½¢å¼ï¼?lt;og:dbMetaDataQuery action="?¥?¥?¥" ?¥?¥?¥ />
036 * â—body?šãªã?
037 *
038 * â—Tag定義??
039 * <og:dbMetaDataQuery
040 * command ã€TAG】コマンド[NEW/RENEW]ã‚’ã‚»ãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:NEW)
041 * action â—‹ã?TAG】アクション(SCHEMAS,TABLES,COLUMNS,INDEXINFO,PROCEDURES)を指定ã—ã¾ã?å¿??)ã€?
042 * catalog ã€TAG】カタãƒã‚°åã‚’ã‚»ãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:null)
043 * schema ã€TAG】スã‚ーマåパターンをセãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:null)
044 * tableName ã€TAG】テーブルåパターンをセãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:null)
045 * columnName ã€TAG】å?åパターンをセãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:null)
046 * procName ã€TAG】ã?ãƒã‚·ãƒ¼ã‚¸ãƒ£åパターンをセãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:null)
047 * unique ã€TAG】返ã™ã‚¤ãƒ³ãƒ?ƒƒã‚¯ã‚¹ã®ç¨®é¡ž[true:ユニã?クã®ã¿/false:éžãƒ¦ãƒ‹ã?クå«ã‚?を指定ã—ã¾ã?åˆæœŸå€¤:false)
048 * approximate ã€TAGã€‘çµ±è¨ˆæƒ…å ±ã®ç²¾åº¦[true:概数/false:æ£ç¢º]を指定ã—ã¾ã?åˆæœŸå€¤:true)
049 * scope ã€TAG】ã‚ャãƒ?‚·ãƒ¥ã™ã‚‹å ´åˆã?スコープ[request/page/session/applicaton]を指定ã—ã¾ã?åˆæœŸå€¤:session)
050 * displayMsg ã€TAGã€‘æ¤œç´¢çµæžœã‚’ç”»é¢ä¸Šã«è¡¨ç¤ºã™ã‚‹ãƒ¡ãƒ?‚»ãƒ¼ã‚¸ãƒªã‚½ãƒ¼ã‚¹IDを指定ã—ã¾ã?åˆæœŸå€¤:MSG0033[ã€?»¶æ¤œç´¢ã—ã¾ã—ãŸ])
051 * notfoundMsg ã€TAGã€‘æ¤œç´¢çµæžœãŒã‚¼ãƒä»¶ã®å ´åˆã«è¡¨ç¤ºã™ã‚‹ãƒ¡ãƒ?‚»ãƒ¼ã‚¸ãƒªã‚½ãƒ¼ã‚¹IDを指定ã—ã¾ã?åˆæœŸå€¤:MSG0077[対象ãƒ??ã‚¿ã¯ã‚りã¾ã›ã‚“ã§ã—ãŸ])
052 * tableId ã€TAGã€?通常ã¯ä½¿ã?¾ã›ã‚“)çµæžœã‚’DBTableModelã«æ›¸ã込んã§ã€sessionã«ç™»éŒ²ã™ã‚‹ã¨ãã?ã‚ーを指定ã—ã¾ã?
053 * dbid ã€TAGã€?通常ã¯ä½¿ã?¾ã›ã‚“)Queryオブジェクトを作æ?ã™ã‚‹æ™‚ã?DB接続IDを指定ã—ã¾ã?
054 * mainTrans ã€TAGã€?通常使ã?¾ã›ã‚“)ã‚¿ã‚°ã§å‡¦ç?•れる処ç?Œãƒ¡ã‚¤ãƒ³ã¨ãªã‚‹ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³å‡¦ç?‹ã©ã?‹ã‚’指定ã—ã¾ã?åˆæœŸå€¤:false)
055 * debug ã€TAG】デãƒãƒƒã‚°æƒ??ã‚’å?力ã™ã‚‹ã‹ã©ã?‹[true/false]を指定ã—ã¾ã?åˆæœŸå€¤:false)
056 * />
057 *
058 * â—使用ä¾?
059 * command属æ? ã¯ã€columnSetã‚¿ã‚°ã®command属æ?ã¨åŒä¸??å ´åˆã?ã¿ã€å?ç?—ã¾ã™ã?
060 * [command属æ?]
061 * NEW 新�
062 * RENEW 冿¤œç´¢
063 *
064 * [action属æ?]
065 * SCHEMAS ã“ã?ãƒ??タベã?スã§ä½¿ç”¨å¯èƒ½ãªã‚¹ã‚ーマåã‚’å–å¾—ã—ã¾ã™ã?
066 * TABLES æŒ?®šã•れãŸã‚«ã‚¿ãƒã‚°ã§ä½¿ç”¨å¯èƒ½ãªãƒ??ブルã«é–¢ã™ã‚‹è¨˜è¿°ã‚’å–å¾—ã—ã¾ã™ã?
067 * COLUMNS æŒ?®šã•れãŸã‚«ã‚¿ãƒã‚°ã§ä½¿ç”¨å¯èƒ½ãªãƒ??ブル列ã?記述をå–å¾—ã—ã¾ã™ã?
068 * INDEXINFO æŒ?®šã•れãŸãƒ??ブルã®ã‚¤ãƒ³ãƒ?ƒƒã‚¯ã‚¹ã¨çµ±è¨ˆæƒ…å ±ã«é–¢ã™ã‚‹è¨˜è¿°ã‚’å–å¾—ã—ã¾ã™ã?
069 * PROCEDURES æŒ?®šã•れãŸã‚«ã‚¿ãƒã‚°ã§ä½¿ç”¨å¯èƒ½ãªã‚¹ãƒˆã‚¢ãƒ‰ã?ãƒã‚·ãƒ¼ã‚¸ãƒ£ã«é–¢ã™ã‚‹è¨˜è¿°ã‚’å–å¾—ã—ã¾ã™ã?
070 *
071 * @og.group ?¤?¢æ¤œç´¢
072 *
073 * @version 4.0
074 * @author Kazuhiko Hasegawa
075 * @since JDK5.0,
076 */
077 public class DBMetaDataQueryTag extends CommonTagSupport {
078 //* ã“ã?プãƒã‚°ãƒ©ãƒ??VERSIONæ–?—å?ã‚’è¨å®šã—ã¾ã™ã? {@value} */
079 private static final String VERSION = "5.1.6.0 (2010/05/01)" ;
080
081 private static final long serialVersionUID = 516020100501L ;
082
083 /** command å¼•æ•°ã«æ¸¡ã™äº‹ã?出æ¥ã‚?コマンãƒ? æ–°è¦?{@value} */
084 public static final String CMD_NEW = "NEW" ;
085 /** command å¼•æ•°ã«æ¸¡ã™äº‹ã?出æ¥ã‚?コマンãƒ? 冿¤œç´¢ {@value} */
086 public static final String CMD_RENEW = "RENEW" ;
087 /** command å¼•æ•°ã«æ¸¡ã™äº‹ã?出æ¥ã‚?コマンãƒ?リスãƒ? */
088 private static final String[] COMMAND_LIST = new String[] { CMD_NEW , CMD_RENEW };
089
090 /** action å¼•æ•°ã«æ¸¡ã™äº‹ã?出æ¥ã‚?アクションコマンãƒ? スã‚ーマå {@value} */
091 public static final String ACT_SCHEMAS = "SCHEMAS" ;
092 /** action å¼•æ•°ã«æ¸¡ã™äº‹ã?出æ¥ã‚?アクションコマンãƒ? ãƒ??ブル {@value} */
093 public static final String ACT_TABLES = "TABLES" ;
094 /** action å¼•æ•°ã«æ¸¡ã™äº‹ã?出æ¥ã‚?アクションコマンãƒ? ãƒ??ブルåˆ?{@value} */
095 public static final String ACT_COLUMNS = "COLUMNS" ;
096 /** action å¼•æ•°ã«æ¸¡ã™äº‹ã?出æ¥ã‚?アクションコマンãƒ? インãƒ?ƒƒã‚¯ã‚¹ã¨çµ±è¨ˆæƒ…å ±{@value} */
097 public static final String ACT_INDEXINFO = "INDEXINFO" ;
098 /** action å¼•æ•°ã«æ¸¡ã™äº‹ã?出æ¥ã‚?アクションコマンãƒ? ストアドã?ãƒã‚·ãƒ¼ã‚¸ãƒ£{@value} */
099 public static final String ACT_PROCEDURES = "PROCEDURES" ;
100
101 /** action å¼•æ•°ã«æ¸¡ã™äº‹ã?出æ¥ã‚?コマンãƒ?リスãƒ? */
102 private static final String[] ACTION_LIST = new String[] {
103 ACT_SCHEMAS , ACT_TABLES , ACT_COLUMNS , ACT_INDEXINFO , ACT_PROCEDURES };
104
105 private String tableId = HybsSystem.TBL_MDL_KEY;
106
107 private String command = "NEW";
108 private String action = null; // taglib ã§å¿??属æ?ã«ã—ã¾ã™ã?
109 private long dyStart = 0; // 実行時間測定用ã®DIVè¦ç´?
110 // private String displayMsg = "MSG0033"; // ã€?»¶æ¤œç´¢ã—ã¾ã—ãŸã€?
111 private String displayMsg = HybsSystem.sys( "VIEW_DISPLAY_MSG" );
112 private String notfoundMsg = "MSG0077"; // 対象ãƒ??ã‚¿ã¯ã‚りã¾ã›ã‚“ã§ã—ãŸã€?
113
114 // 4.0.0.0 (2007/10/10) dbid ã®åˆæœŸå€¤ã‚’ã?"DEFAULT" ã‹ã‚‰ null ã«å¤‰æ›´
115 // private String dbid = "DEFAULT";
116 private String dbid = null;
117 private String catalog = null;
118 private String schema = null;
119 private String tableName = null;
120 private String procName = null;
121 private String columnName = null;
122 private boolean unique = false; // true:ユニã?クã®ã¿ / false:éžãƒ¦ãƒ‹ã?クå«ã‚?
123 private boolean approximate = true; // true:概数 / false:æ£ç¢º
124 private boolean isMainTrans = true; // 5.1.6.0 (2010/05/01) DBLastSqlã®å‡¦ç??見直ã?
125
126 /**
127 * Taglibã®é–‹å§‹ã‚¿ã‚°ãŒè¦‹ã¤ã‹ã£ãŸã¨ãã«å‡¦ç?™ã‚?doStartTag() ã‚?オーãƒã?ライドã—ã¾ã™ã?
128 *
129 * @og.rev 5.1.6.0 (2010/05/01) DBLastSqlã®å‡¦ç??ã€DBTableModelãŒæ–°è¦ä½œæ?ã•れãŸå?ç?§ã®ã¿è¡Œã†ã€?
130 *
131 * @return 後続å?ç??æŒ?¤º(SKIP_BODY)
132 */
133 @Override
134 public int doStartTag() {
135 dyStart = System.currentTimeMillis();
136 if( ! check( command, COMMAND_LIST ) ) { return(SKIP_BODY); }
137
138 useMainTrans( isMainTrans ); // 5.1.6.0 (2010/05/01) DBLastSqlã®å‡¦ç??見直ã?
139 startQueryTransaction( tableId ); // 3.6.0.8 (2004/11/19)
140
141 // 3.5.6.5 (2004/08/09) 削除ã™ã‚‹ã®ã¯ã€ã‚»ãƒ?‚·ãƒ§ãƒ³ã®ã‚ªãƒ–ジェクトã§ã‚ˆã„ã€?
142 // 3.6.0.0 (2004/09/24) 削除ã™ã‚‹ã®ã¯ã€scope="session" ã®å ´åˆã?ã¿ã€?
143 if( "session".equals( getScope() ) ) {
144 removeSessionAttribute( tableId );
145 removeSessionAttribute( HybsSystem.VIEWFORM_KEY );
146 }
147
148 return(SKIP_BODY); // Body を評価ã—ãªã?
149 }
150
151 /**
152 * Taglibã®çµ‚äº?‚¿ã‚°ãŒè¦‹ã¤ã‹ã£ãŸã¨ãã«å‡¦ç?™ã‚?doEndTag() ã‚?オーãƒã?ライドã—ã¾ã™ã?
153 *
154 * @og.rev 4.0.0.0 (2006/11/14) notfoundMsg 属æ?を追åŠ??displayMsg ã¯ã€VIEW_USE_DISPLAY_MSG ã§åˆ¶å¾¡
155 * @og.rev 4.0.0.0 (2007/10/18) メãƒ?‚»ãƒ¼ã‚¸ãƒªã‚½ãƒ¼ã‚¹çµ±å? getResource().getMessage â‡?getResource().getLabel )
156 *
157 * @return 後続å?ç??æŒ?¤º
158 */
159 @Override
160 public int doEndTag() {
161 debugPrint(); // 4.0.0 (2005/02/28)
162
163 String label = ""; // 4.0.0 (2005/11/30) 検索ã—ãªã‹ã£ãŸå?åˆã?
164 if( check( command, COMMAND_LIST ) ) {
165 StringBuilder buf = new StringBuilder( HybsSystem.BUFFER_SMALL );
166
167 DBTableModel table = actionExec( action );
168 int executeCount = table.getRowCount(); // 検索ã—ãŸæ•°
169
170 // 実行件数ã®è¡¨ç¤º command="NEW" ã®ã¨ãã?ã¿ã€displayMsg を表示ã•ã›ã¾ã™ã?
171 // 4.0.0 (2005/11/30) 出力é?ã®å¤‰æ›´ã€‚ä¸?•ªæœ??ã«å‡ºåŠ›ã—ã¾ã™ã?
172 // boolean useStatusBar = HybsSystem.sysBool( "VIEW_USE_DISPLAY_MSG" );
173 if( CMD_NEW.equals( command ) ) {
174 // if( useStatusBar && executeCount > 0 && displayMsg != null && displayMsg.length() > 0 ) {
175 if( executeCount > 0 && displayMsg != null && displayMsg.length() > 0 ) {
176 buf.append( executeCount );
177 // buf.append( getResource().getMessage( displayMsg ) );
178 buf.append( getResource().getLabel( displayMsg ) );
179 buf.append( HybsSystem.BR );
180 }
181 else if( executeCount == 0 && notfoundMsg != null && notfoundMsg.length() > 0 ) {
182 // buf.append( getResource().getMessage( notfoundMsg ) );
183 buf.append( getResource().getLabel( notfoundMsg ) );
184 buf.append( HybsSystem.BR );
185 }
186 }
187
188 // 3.3.3.3 (2003/08/06) æ¤œç´¢çµæžœã®ä»¶æ•°ã‚’ã?"DB.COUNT" ã‚ーã§ãƒªã‚¯ã‚¨ã‚¹ãƒˆã«ã‚»ãƒ?ƒˆã™ã‚‹ã€?
189 setRequestAttribute( "DB.COUNT" , String.valueOf( executeCount ) );
190 // 3.3.3.3 (2003/08/06) æ¤œç´¢çµæžœã‚’ã?"DB.ERR_CODE" ã‚ーã§ãƒªã‚¯ã‚¨ã‚¹ãƒˆã«ã‚»ãƒ?ƒˆã™ã‚‹ã€?
191 setRequestAttribute( "DB.ERR_CODE", String.valueOf( ErrorMessage.OK ) );
192
193 // オーãƒã?フãƒãƒ¼æ™‚ã?メãƒ?‚»ãƒ¼ã‚¸ã‚’表示
194 // if( table != null && table.isOverflow() ) {
195 // buf.append( getResource().getMessage( overflowMsg ) );
196 // buf.append( HybsSystem.BR );
197 // }
198
199 // 実行件数ã®è¡¨ç¤º
200 // 2.0.0.8 (2002/10/09) command="NEW" ã®ã¨ãã?ã¿ã€displayMsg を表示ã•ã›ã¾ã™ã?
201 // if( displayMsg != null && displayMsg.length() > 0 && command.equals( CMD_NEW ) ) {
202 // buf.append( executeCount );
203 // buf.append( getResource().getMessage( displayMsg ) );
204 // buf.append( HybsSystem.BR );
205 // }
206
207 label = buf.toString();
208
209 // 3.6.0.8 (2004/11/19) トランザクションãƒã‚§ãƒ?‚¯ã‚’行ã„ã¾ã™ã?
210 if( ! commitTableObject( tableId, table ) ) {
211 jspPrint( "DBMetaDataQueryTag Query処ç?Œå‰²ã‚Šè¾¼ã¾ã‚Œã¾ã—ãŸã€?BTableModel ã¯ç™»éŒ²ã—ã¾ã›ã‚“ã€? );
212 return (SKIP_PAGE);
213 }
214 }
215 jspPrint( label );
216
217 // 3.5.4.7 (2004/02/06)
218 long dyTime = System.currentTimeMillis()-dyStart;
219 jspPrint( "<div id=\"queryTime\" value=\"" + (dyTime) + "\"></div>" ); // 3.5.6.3 (2004/07/12)
220 return(EVAL_PAGE);
221 }
222
223 /**
224 * タグリブオブジェクトをリリースã—ã¾ã™ã?
225 * ã‚ャãƒ?‚·ãƒ¥ã•れã¦å†åˆ©ç”¨ã•れるã?ã§ã€ãƒ•ィールドã?åˆæœŸè¨å®šã‚’行ã„ã¾ã™ã?
226 *
227 * @og.rev 4.0.0.0 (2007/10/10) dbid ã®åˆæœŸå€¤ã‚’ã?"DEFAULT" ã‹ã‚‰ null ã«å¤‰æ›´
228 * @og.rev 5.1.6.0 (2010/05/01) DBLastSqlã®å‡¦ç??ã€DBTableModelãŒæ–°è¦ä½œæ?ã•れãŸå?ç?§ã®ã¿è¡Œã†ã€?
229 */
230 @Override
231 protected void release2() {
232 super.release2();
233 tableId = HybsSystem.TBL_MDL_KEY;
234 // dbid = "DEFAULT";
235 dbid = null;
236 catalog = null;
237 schema = null;
238 tableName = null;
239 procName = null;
240 columnName = null;
241 unique = false; // true:ユニã?クã®ã¿ / false:éžãƒ¦ãƒ‹ã?クå«ã‚?
242 approximate = true; // true:概数 / false:æ£ç¢º
243 dyStart = 0;
244 // displayMsg = "MSG0033"; // ã€?»¶æ¤œç´¢ã—ã¾ã—ãŸã€?
245 displayMsg = HybsSystem.sys( "VIEW_DISPLAY_MSG" );
246 notfoundMsg = "MSG0077"; // 対象ãƒ??ã‚¿ã¯ã‚りã¾ã›ã‚“ã§ã—ãŸã€?
247 isMainTrans = true; // 5.1.6.0 (2010/05/01) DBLastSqlã®å‡¦ç??見直ã?
248 }
249
250 /**
251 * æŒ?®šã?アクションを実行ã—ã€çµæžœã‚’ã?DBTableModel ã«ã‚»ãƒ?ƒˆã—ã¦è¿”ã—ã¾ã™ã?
252 * アクションã¯ã€?SCHEMAS,TABLES,COLUMNS,INDEXINFO,PROCEDURES)を指定ã—ã¾ã™ã?
253 *
254 * SCHEMAS ã“ã?ãƒ??タベã?スã§ä½¿ç”¨å¯èƒ½ãªã‚¹ã‚ーマåã‚’å–å¾—ã—ã¾ã™ã?
255 * TABLES æŒ?®šã•れãŸã‚«ã‚¿ãƒã‚°ã§ä½¿ç”¨å¯èƒ½ãªãƒ??ブルã«é–¢ã™ã‚‹è¨˜è¿°ã‚’å–å¾—ã—ã¾ã™ã?
256 * COLUMNS æŒ?®šã•れãŸã‚«ã‚¿ãƒã‚°ã§ä½¿ç”¨å¯èƒ½ãªãƒ??ブル列ã?記述をå–å¾—ã—ã¾ã™ã?
257 * INDEXINFO æŒ?®šã•れãŸãƒ??ブルã®ã‚¤ãƒ³ãƒ?ƒƒã‚¯ã‚¹ã¨çµ±è¨ˆæƒ…å ±ã«é–¢ã™ã‚‹è¨˜è¿°ã‚’å–å¾—ã—ã¾ã™ã?
258 * PROCEDURES æŒ?®šã•れãŸã‚«ã‚¿ãƒã‚°ã§ä½¿ç”¨å¯èƒ½ãªã‚¹ãƒˆã‚¢ãƒ‰ã?ãƒã‚·ãƒ¼ã‚¸ãƒ£ã«é–¢ã™ã‚‹è¨˜è¿°ã‚’å–å¾—ã—ã¾ã™ã?
259 *
260 * @og.rev 3.8.7.0 (2006/12/15) アクセスãƒã‚°å–å¾—ã?為,ApplicationInfoオブジェクトをè¨å®?
261 *
262 * @param action アクションæ–?—å?
263 *
264 * @return ãƒ??ブルモãƒ?ƒ«
265 * @see <a href="../../../../constant-values.html#org.opengion.hayabusa.taglib.DBMetaDataQueryTag.ACT_COLUMNS">アクション定数</a>
266 */
267 private DBTableModel actionExec( final String action ) {
268 DBMetaData metaData = new DBMetaData();
269 metaData.setDbid( dbid );
270 metaData.setResourceManager( getResource() );
271 metaData.setApplicationInfo( getApplicationInfo() ); // 3.8.7.0 (2006/12/15)
272
273 DBTableModel tbl = null;
274
275 if( ACT_SCHEMAS.equals( action ) ) {
276 tbl = metaData.getSchemas() ;
277 }
278 else if( ACT_TABLES.equals( action ) ) {
279 tbl = metaData.getTables( catalog, schema, tableName ) ;
280 }
281 else if( ACT_COLUMNS.equals( action ) ) {
282 tbl = metaData.getColumns(catalog, schema, tableName, columnName) ;
283 }
284 else if( ACT_INDEXINFO.equals( action ) ) {
285 tbl = metaData.getIndexInfo(catalog, schema, tableName, unique, approximate) ;
286 }
287 else if( ACT_PROCEDURES.equals( action ) ) {
288 tbl = metaData.getProcedures(catalog, schema, procName) ;
289 }
290
291 return tbl ;
292 }
293
294 /**
295 * ã€TAG】コマンド[NEW/RENEW]ã‚’ã‚»ãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:NEW)ã€?
296 *
297 * @og.tag
298 * コマンドã?,HTMLã‹ã‚‰(get/post)æŒ?®šã•れã¾ã™ã?ã§,CMD_xxx ã§è¨å®šã•れる
299 * フィールド定数値ã®ã?¥ã‚Œã‹ã‚’ã?æŒ?®šã§ãã¾ã™ã?
300 *
301 * @param cmd コマンãƒ?public static final 宣è¨?•れã¦ã?‚‹æ–?—å?)
302 * @see <a href="../../../../constant-values.html#org.opengion.hayabusa.taglib.DBMetaDataQueryTag.CMD_NEW">コマンド定数</a>
303 */
304 public void setCommand( final String cmd ) {
305 String cmd2 = getRequestParameter( cmd );
306 if( cmd2 != null && cmd2.length() > 0 ) { command = cmd2.toUpperCase(Locale.JAPAN); }
307 }
308
309 /**
310 * ã€TAG】アクション(SCHEMAS,TABLES,COLUMNS,INDEXINFO,PROCEDURES)を指定ã—ã¾ã™ã?
311 *
312 * @og.tag
313 * アクションã¯,HTMLã‹ã‚‰(get/post)æŒ?®šã•れã¾ã™ã?ã§,ACT_xxx ã§è¨å®šã•れる
314 * フィールド定数値ã®ã?¥ã‚Œã‹ã‚’ã?æŒ?®šã§ãã¾ã™ã?
315 *
316 * SCHEMAS ã“ã?ãƒ??タベã?スã§ä½¿ç”¨å¯èƒ½ãªã‚¹ã‚ーマåã‚’å–å¾—ã—ã¾ã™ã?
317 * TABLES æŒ?®šã•れãŸã‚«ã‚¿ãƒã‚°ã§ä½¿ç”¨å¯èƒ½ãªãƒ??ブルã«é–¢ã™ã‚‹è¨˜è¿°ã‚’å–å¾—ã—ã¾ã™ã?
318 * COLUMNS æŒ?®šã•れãŸã‚«ã‚¿ãƒã‚°ã§ä½¿ç”¨å¯èƒ½ãªãƒ??ブル列ã?記述をå–å¾—ã—ã¾ã™ã?
319 * INDEXINFO æŒ?®šã•れãŸãƒ??ブルã®ã‚¤ãƒ³ãƒ?ƒƒã‚¯ã‚¹ã¨çµ±è¨ˆæƒ…å ±ã«é–¢ã™ã‚‹è¨˜è¿°ã‚’å–å¾—ã—ã¾ã™ã?
320 * PROCEDURES æŒ?®šã•れãŸã‚«ã‚¿ãƒã‚°ã§ä½¿ç”¨å¯èƒ½ãªã‚¹ãƒˆã‚¢ãƒ‰ã?ãƒã‚·ãƒ¼ã‚¸ãƒ£ã«é–¢ã™ã‚‹è¨˜è¿°ã‚’å–å¾—ã—ã¾ã™ã?
321 *
322 * @param cmd アクションæ–?—å?
323 * @see <a href="../../../../constant-values.html#org.opengion.hayabusa.taglib.DBMetaDataQueryTag.ACT_COLUMNS">アクション定数</a>
324 */
325 public void setAction( final String cmd ) {
326 action = getRequestParameter( cmd );
327
328 if( ! check( action, ACTION_LIST ) ) {
329
330 StringBuilder errMsg = new StringBuilder( HybsSystem.BUFFER_MIDDLE );
331 errMsg.append( "æŒ?®šã?アクションã¯å®Ÿè¡Œã§ãã¾ã›ã‚“。アクションエラー" );
332 errMsg.append( HybsSystem.CR );
333 errMsg.append( "action=[" ).append( action ).append( "] " );
334 errMsg.append( HybsSystem.CR );
335
336 for( int i=0; i<ACTION_LIST.length; i++ ) {
337 errMsg.append( " | " );
338 errMsg.append( ACTION_LIST[i] );
339 }
340 errMsg.append( " | " );
341 throw new HybsSystemException( errMsg.toString() );
342 }
343 }
344
345 /**
346 * ã€TAGã€?通常ã¯ä½¿ã?¾ã›ã‚“)Queryオブジェクトを作æ?ã™ã‚‹æ™‚ã?DB接続IDを指定ã—ã¾ã™ã?
347 *
348 * @og.tag Queryオブジェクトを作æ?ã™ã‚‹æ™‚ã?DB接続IDを指定ã—ã¾ã™ã?
349 *
350 * @param id ãƒ??タベã?ス接続ID
351 */
352 public void setDbid( final String id ) {
353 dbid = nval( getRequestParameter( id ),dbid );
354 }
355
356 /**
357 * ã€TAG】カタãƒã‚°åã‚’ã‚»ãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:null)ã€?
358 *
359 * @og.tag ãƒ??タベã?ã‚¹ã«æ ¼ç´ã•れãŸã‚«ã‚¿ãƒã‚°åã¨ä¸??ã—ãªã‘れã°ãªã‚‰ãªã??
360 * "" ã¯ã‚«ã‚¿ãƒã‚°ãªã—ã§ã‚«ã‚¿ãƒã‚°åを検索ã™ã‚‹ã€?
361 * null ã¯ã€ã‚«ã‚¿ãƒã‚°åを検索ã®é™å®šã«ä½¿ç”¨ã—ã¦ã¯ãªã‚‰ãªã?“ã¨ã‚’æ„味ã™ã‚‹
362 *
363 * @param catalog ã‚«ã‚¿ãƒã‚°å?
364 */
365 public void setCatalog( final String catalog ) {
366 this.catalog = nval( getRequestParameter( catalog ),this.catalog );
367 }
368
369 /**
370 * ã€TAG】スã‚ーマåパターンをセãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:null)ã€?
371 *
372 * @og.tag ãƒ??タベã?ã‚¹ã«æ ¼ç´ã•れãŸã‚¹ã‚ーマåã¨ä¸??ã—ãªã‘れã°ãªã‚‰ãªã??
373 * "" ã¯ã‚¹ã‚ーマãªã—ã§ã‚¹ã‚ーマåを検索ã™ã‚‹ã€?
374 * null ã¯ã€ã‚¹ã‚ーマåを検索ã®é™å®šã«ä½¿ç”¨ã—ã¦ã¯ãªã‚‰ãªã?“ã¨ã‚’æ„味ã™ã‚‹
375 *
376 * @param schema スã‚ーマåパターン
377 */
378 public void setSchema( final String schema ) {
379 this.schema = nval( getRequestParameter( schema ),this.schema );
380 }
381
382 /**
383 * ã€TAG】テーブルåパターンをセãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:null)ã€?
384 *
385 * @og.tag 。データベã?ã‚¹ã«æ ¼ç´ã•れãŸãƒ??ブルåã¨ä¸??ã—ãªã‘れã°ãªã‚‰ãªã?
386 *
387 * @param tableName ãƒ??ブルåパターン
388 */
389 public void setTableName( final String tableName ) {
390 this.tableName = nval( getRequestParameter( tableName ),this.tableName );
391 }
392
393 /**
394 * ã€TAG】ã?ãƒã‚·ãƒ¼ã‚¸ãƒ£åパターンをセãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:null)ã€?
395 *
396 * @og.tag 。データベã?ã‚¹ã«æ ¼ç´ã•れãŸãƒ—ãƒã‚·ãƒ¼ã‚¸ãƒ£åã¨ä¸??ã—ãªã‘れã°ãªã‚‰ãªã?
397 *
398 * @param procName プãƒã‚·ãƒ¼ã‚¸ãƒ£åパターン
399 */
400 public void setProcName( final String procName ) {
401 this.procName = nval( getRequestParameter( procName ),this.procName );
402 }
403
404 /**
405 * ã€TAG】å?åパターンをセãƒ?ƒˆã—ã¾ã?åˆæœŸå€¤:null)ã€?
406 *
407 * @og.tag ãƒ??タベã?ã‚¹ã«æ ¼ç´ã•れãŸåˆ—åã¨ä¸??ã—ãªã‘れã°ãªã‚‰ãªã?
408 *
409 * @param columnName 列åパターン
410 */
411 public void setColumnName( final String columnName ) {
412 this.columnName = nval( getRequestParameter( columnName ),this.columnName );
413 }
414
415 /**
416 * ã€TAG】返ã™ã‚¤ãƒ³ãƒ?ƒƒã‚¯ã‚¹ã®ç¨®é¡ž[true:ユニã?クã®ã¿/false:éžãƒ¦ãƒ‹ã?クå«ã‚?を指定ã—ã¾ã?åˆæœŸå€¤:false)ã€?
417 *
418 * @og.tag true ã®å ´åˆã?ã€ä¸?„ã®å€¤ã®ã‚¤ãƒ³ãƒ?ƒƒã‚¯ã‚¹ã?‘ã‚’è¿”ã™ã€?
419 * false ã®å ´åˆã?ã€ä¸?„ã§ã‚ã‚‹ã‹ã©ã?‹ã«ã‹ã‹ã‚らãšã‚¤ãƒ³ãƒ?ƒƒã‚¯ã‚¹ã‚’è¿”ã™
420 * åˆæœŸå€¤ã¯ã€false:éžãƒ¦ãƒ‹ã?クå«ã‚?ã§ã™ã?
421 *
422 * @param uniqFlag è¿”ã™ã‚¤ãƒ³ãƒ?ƒƒã‚¯ã‚¹ã®ç¨®é¡?[true:ユニã?クã®ã¿/false:éžãƒ¦ãƒ‹ã?クå«ã‚?
423 */
424 public void setUnique( final String uniqFlag ) {
425 this.unique = nval( getRequestParameter( uniqFlag ),this.unique );
426 }
427
428 /**
429 * ã€TAGã€‘çµ±è¨ˆæƒ…å ±ã®ç²¾åº¦[true:概数/false:æ£ç¢º]を指定ã—ã¾ã?åˆæœŸå€¤:true)ã€?
430 *
431 * @og.tag æŒ?®šã•れãŸãƒ??ブルã®ã‚¤ãƒ³ãƒ?ƒƒã‚¯ã‚¹ã¨çµ±è¨ˆæƒ…å ±ã«é–¢ã™ã‚‹è¨˜è¿°ã‚’å–å¾—ã™ã‚‹å?åˆã«
432 * çµæžœã®ç²¾åº¦ã‚’指定ã—ã¾ã™ã?
433 * true ã®å ´åˆã?ã€çµæžœã¯æ¦‚æ•°ã¾ãŸã?ãƒ??タ値ã‹ã‚‰å¤–れるã“ã¨ã‚‚ã‚ã‚‹ã?
434 * false ã®å ´åˆã?ã€æ£ç¢ºã§ã‚ã‚‹ã“ã¨ãŒè¦æ±‚ã•れる
435 * åˆæœŸå€¤ã¯ã€true:概数 ã§ã™ã?
436 *
437 * @param appFlag çµ±è¨ˆæƒ…å ±ã®ç²¾åº¦ [true:概数/false:æ£ç¢º]
438 */
439 public void setApproximate( final String appFlag ) {
440 this.approximate = nval( getRequestParameter( appFlag ),this.approximate );
441 }
442
443 /**
444 * ã€TAGã€?通常ã¯ä½¿ã?¾ã›ã‚“)çµæžœã®DBTableModelã‚’ã?sessionã«ç™»éŒ²ã™ã‚‹ã¨ãã?ã‚ーを指定ã—ã¾ã?
445 * (åˆæœŸå€¤:HybsSystem#TBL_MDL_KEY[={@og.value org.opengion.hayabusa.common.HybsSystem#TBL_MDL_KEY}])ã€?
446 *
447 * @og.tag
448 * æ¤œç´¢çµæžœã‚ˆã‚Šã€DBTableModelオブジェクトを作æ?ã—ã¾ã™ã?ã“れをã?下æµã?viewã‚¿ã‚°ç‰ã«
449 * 渡ã™å?åˆã«ã€??常ã¯ã€session を利用ã—ã¾ã™ã?ãã?å ´åˆã?登録ã‚ーã§ã™ã?
450 * query ã‚¿ã‚°ã‚’åŒæ™‚ã«å®Ÿè¡Œã—ã¦ã€çµæžœã‚’求ã‚ã‚‹å?åˆã?åŒä¸?ƒ¡ãƒ¢ãƒªã«é…ç½®ã•れる為ã€?
451 * ã“ã? tableId 属æ?を利用ã—ã¦ã€ãƒ¡ãƒ¢ãƒªç©ºé–“ã‚’åˆ?‘ã¾ã™ã?
452 * (åˆæœŸå€¤:HybsSystem#TBL_MDL_KEY[={@og.value org.opengion.hayabusa.common.HybsSystem#TBL_MDL_KEY}])ã€?
453 *
454 * @param id sessionã«ç™»éŒ²ã™ã‚‹æ™‚ã? ID
455 */
456 public void setTableId( final String id ) {
457 this.tableId = nval( getRequestParameter( id ),tableId );
458 }
459
460 /**
461 * ã€TAGã€‘æ¤œç´¢çµæžœã‚’ç”»é¢ä¸Šã«è¡¨ç¤ºã™ã‚‹ãƒ¡ãƒ?‚»ãƒ¼ã‚¸ãƒªã‚½ãƒ¼ã‚¹IDを指定ã—ã¾ã?åˆæœŸå€¤:MSG0033[ã€?»¶æ¤œç´¢ã—ã¾ã—ãŸ])ã€?
462 *
463 * @og.tag
464 * ã“ã“ã§ã¯ã€æ¤œç´¢çµæžœã®ä»¶æ•°ã‚?™»éŒ²ã•れãŸä»¶æ•°ã‚’ã¾ãšå?力ã—ã€?
465 * ãã?次ã«ã€ã“ã“ã§æŒ?®šã—ãŸãƒ¡ãƒ?‚»ãƒ¼ã‚¸ã‚’リソースã‹ã‚‰å–å¾—ã—ã¦
466 * 表示ã—ã¾ã™ã?
467 * 表示ã•ã›ãŸããªã??åˆã?, displayMsg = "" ã‚’ã‚»ãƒ?ƒˆã—ã¦ãã ã•ã„ã€?
468 * åˆæœŸå€¤ã¯ã€æ¤œç´¢ä»¶æ•°ã‚’表示ã—ã¾ã™ã?
469 *
470 * @param id ãƒ?‚£ã‚¹ãƒ—レイã«è¡¨ç¤ºã•ã›ã‚‹ãƒ¡ãƒ?‚»ãƒ¼ã‚¸ ID
471 */
472 public void setDisplayMsg( final String id ) {
473 String ids = getRequestParameter( id );
474 if( ids != null ) { displayMsg = ids; }
475 }
476
477 /**
478 * ã€TAGã€‘æ¤œç´¢çµæžœãŒã‚¼ãƒä»¶ã®å ´åˆã«è¡¨ç¤ºã™ã‚‹ãƒ¡ãƒ?‚»ãƒ¼ã‚¸ãƒªã‚½ãƒ¼ã‚¹IDを指定ã—ã¾ã?åˆæœŸå€¤:MSG0077[対象ãƒ??ã‚¿ã¯ã‚りã¾ã›ã‚“ã§ã—ãŸ])ã€?
479 *
480 * @og.tag
481 * ã“ã“ã§ã¯ã€æ¤œç´¢çµæžœãŒã‚¼ãƒä»¶ã®å ´åˆã?ã¿ã€ç‰¹åˆ¥ãªãƒ¡ãƒ?‚»ãƒ¼ã‚¸ã‚’表示ã•ã›ã¾ã™ã?
482 * 従æ¥ã¯ã€displayMsg ã¨å…¼ç”¨ã§ã€ã?0ã€?»¶æ¤œç´¢ã—ã¾ã—ãŸã€ã¨ã?†è¡¨ç¤ºã§ã—ãŸãŒã?
483 * displayMsg ã®åˆæœŸè¡¨ç¤ºã¯ã€OFF ã«ãªã‚Šã¾ã—ãŸã®ã§ã€ã‚¼ãƒä»¶ã®å ´åˆã?ã¿åˆ¥ã«è¡¨ç¤ºã•ã›ã¾ã™ã?
484 * 表示ã•ã›ãŸããªã??åˆã?, notfoundMsg = "" ã‚’ã‚»ãƒ?ƒˆã—ã¦ãã ã•ã„ã€?
485 * åˆæœŸå€¤ã¯ã€MSG0077[対象ãƒ??ã‚¿ã¯ã‚りã¾ã›ã‚“ã§ã—ãŸ]ã§ã™ã?
486 *
487 * @param id ãƒ?‚£ã‚¹ãƒ—レイã«è¡¨ç¤ºã•ã›ã‚‹ãƒ¡ãƒ?‚»ãƒ¼ã‚¸ ID
488 */
489 public void setNotfoundMsg( final String id ) {
490 String ids = getRequestParameter( id );
491 if( ids != null ) { notfoundMsg = ids; }
492 }
493
494 /**
495 * ã‚¿ã‚°ã®åç§°ã‚’ã?è¿”ã—ã¾ã™ã?
496 * 自åˆ??身ã®ã‚¯ãƒ©ã‚¹åよりã?自動的ã«å–り出ã›ãªã?Ÿã‚ã?ã“ã?メソãƒ?ƒ‰ã‚’オーãƒã?ライドã—ã¾ã™ã?
497 *
498 * @og.rev 4.0.0.0 (2005/01/31) æ–°è¦è¿½åŠ?
499 *
500 * @return ã‚¿ã‚°ã®åç§°
501 */
502 @Override
503 protected String getTagName() {
504 return "dbMetaDataQuery" ;
505 }
506
507 /**
508 * ã€TAGã€?通常使ã?¾ã›ã‚“)ã‚¿ã‚°ã§å‡¦ç?•れる処ç?Œãƒ¡ã‚¤ãƒ³ã¨ãªã‚‹ãƒˆãƒ©ãƒ³ã‚¶ã‚¯ã‚·ãƒ§ãƒ³å‡¦ç?‹ã©ã?‹ã‚’指定ã—ã¾ã?åˆæœŸå€¤:false)ã€?
509 *
510 * @og.tag
511 * ã“ã?値ã¯ã€ãƒ•ァイルãƒ?‚¦ãƒ³ãƒãƒ¼ãƒ‰å?ç?«å½±éŸ¿ã—ã¾ã™ã?ã“ã?値ãŒtrueã«æŒ?®šã•ã‚ŒãŸæ™‚ã«commitã•れãŸDBTableModelã?
512 * ファイルãƒ?‚¦ãƒ³ãƒãƒ¼ãƒ‰ã?対象ã®è¡¨ã«ãªã‚Šã¾ã™ã?
513 *
514 * ã“ã?パラメーターã¯ã€??常ã€å„ã‚¿ã‚°ã«ã‚ˆã‚Šå®Ÿè£?•れã?ãƒ¦ãƒ¼ã‚¶ãƒ¼ãŒæŒ‡å®šã™ã‚‹å¿?¦ã?ã‚りã¾ã›ã‚“ã€?
515 * ä½?—ã€?ã¤ã®JSPå†?§DBTableModelãŒè¤?•°ç”Ÿæ?ã•れるå?åˆã«ã€å‰ã«å‡¦ç?—ãŸDBTableModelã«ã¤ã?¦ãƒ•ァイルãƒ?‚¦ãƒ³ãƒãƒ¼ãƒ‰ã‚’ã•ã›ãŸã„
516 * å ´åˆã?ã€å¾Œã‚ã§DBTableModelを生æˆã™ã‚‹ã‚¿ã‚°ã§ã€æ?示çš?«ã“ã?値をfalseã«æŒ?®šã™ã‚‹ã“ã¨ã§ã€ãƒ•ァイルãƒ?‚¦ãƒ³ãƒãƒ¼ãƒ‰å?ç??対象ã‹ã‚‰
517 * 除外ã™ã‚‹ã“ã¨ãŒã§ãã¾ã™ã?
518 *
519 * @og.rev 5.1.6.0 (2010/05/01) æ–°è¦ä½œæ?
520 *
521 * @param flag メイントランザクションã‹ã©ã?‹
522 */
523 public void setMainTrans( final String flag ) {
524 isMainTrans = nval( getRequestParameter( flag ),isMainTrans );
525 }
526
527 /**
528 * ã“ã?オブジェクトã?æ–?—å?表ç¾ã‚’è¿”ã—ã¾ã™ã?
529 * 基本çš?«ãƒ?ƒãƒ?‚°ç›®çš?«ä½¿ç”¨ã—ã¾ã™ã?
530 *
531 * @return ã“ã?ã‚¯ãƒ©ã‚¹ã®æ–?—å?表ç¾
532 */
533 @Override
534 public String toString() {
535 return org.opengion.fukurou.util.ToString.title( this.getClass().getName() )
536 .println( "VERSION" ,VERSION )
537 .println( "tableId" ,tableId )
538 .println( "command" ,command )
539 .println( "action" ,action )
540 .println( "dyStart" ,dyStart )
541 .println( "displayMsg" ,displayMsg )
542 .println( "dbid" ,dbid )
543 .println( "catalog" ,catalog )
544 .println( "schema" ,schema )
545 .println( "tableName" ,tableName )
546 .println( "procName" ,procName )
547 .println( "columnName" ,columnName )
548 .println( "unique" ,unique )
549 .println( "approximate" ,approximate)
550 .println( "Other..." ,getAttributes().getAttribute() )
551 .fixForm().toString() ;
552 }
553 }