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.db;
017    
018    import org.opengion.fukurou.model.NativeType;
019    import org.opengion.fukurou.util.Attributes;
020    import org.opengion.fukurou.util.ErrorMessage;
021    import org.opengion.fukurou.util.TagBuffer;
022    import org.opengion.hayabusa.common.HybsSystem;
023    import org.opengion.hayabusa.common.HybsSystemException;
024    import org.opengion.hayabusa.resource.CodeData;
025    import org.opengion.hayabusa.resource.ColumnData;
026    import org.opengion.hayabusa.resource.LabelData;
027    import org.opengion.hayabusa.resource.RoleMode;
028    
029    /**
030     * DBType インターフェースを継承した Abstractクラスです?
031     * getRendererValue( String value ) 、getEditorValue( String value ) ?
032     * isValueChack( String ) メソ?を?サブクラスで実?る?があります?
033     *
034     * @og.rev 3.4.0.0 (2003/09/01) 表示パラメータ、編?ラメータ、文字パラメータの追??
035     * @og.group ??ブル管?
036     *
037     * @version  4.0
038     * @author   Kazuhiko Hasegawa
039     * @since    JDK5.0,
040     */
041    public final class DBColumn {
042    
043            // 3.5.4.2 (2003/12/15) COLUMNS_MAXSIZE を定義しておきます?
044            private final int COLUMNS_MAXSIZE = HybsSystem.sysInt( "HTML_COLUMNS_MAXSIZE" ) ;   // 表示フィールド?大きさ
045    
046            private final ColumnData columnData ;
047            private final LabelData  labelData ;
048            private final CodeData   codeData ;
049    
050            private final CellRenderer      cellRenderer    ;               // 表示用レン?ー
051            private final CellEditor        cellEditor              ;               // 編?エ?ター
052            private final DBType            dbType                  ;               // ??タのタイ?
053    
054            private final String            lang                    ;               // ??
055            private final boolean           writable                ;               // カラ?書き込み可能かど?
056            private final String            defValue                ;               // ??タの?ォルト?
057            private final Attributes        rendAttri               ;               // 表示用レン?ー追?属?
058            private final Attributes        editAttri               ;               // 編?エ?ター追?属?
059            private final boolean           addNoValue              ;               // メニューに空の選択リストを追?るかど? // 3.5.5.7 (2004/05/10)
060            private final String            dbid                    ;               // ??タベ?ス接続?ID
061            private final boolean           official                ;               // カラ?ソースから作?されたかど?               // 3.6.0.7 (2004/11/06)
062    
063            private final int                       checkLevel              ;               // DBColumn の 整合?チェ?を行うレベルを規定します?
064    
065            private final Selection         selection               ;               // 4.0.0.0 (2007/11/07)
066    
067            private final String            eventColumn             ;       // 4.3.6.0 (2009/04/01) イベントカラ?
068            private final String            rawEditParameter;       // 4.3.6.0 (2009/04/01) {@XXXX}の変換がされて??パラメータ
069            private final String            rawRendParameter;       // 5.1.7.0  (2009/04/01) {@XXXX}の変換がされて??パラメータ
070            private final String            eventURL                ;       // 4.3.6.0 (2009/04/01) イベントカラ?利用するURL
071    
072            private final String            useSLabel               ;       // 5.5.1.0 (2012/04/03) MENUのベ?ス表示の?替?
073            private final String            noDisplayVal    ;       // 5.6.2.3 (2013/03/22) 非表示??設?
074    
075            private final boolean           stringOutput    ;       // 5.7.6.3 (2013/05/23) ファイルレン?出力時のフラグ
076    
077            /**
078             * DBColumnConfig オブジェクトより作?されるコンストラクター
079             * すべての??は、インスタンス作?時に設定します?
080             * こ?オブジェクト??度作?されると変更されることはありません?
081             *
082             * @og.rev 4.0.0.0 (2005/01/31) 新規追?
083             * @og.rev 4.0.0.0 (2007/11/07) Selectionオブジェクトをキャ?ュする
084             * @og.rev 4.3.6.0 (2009/04/01) eventColumnの対?
085             * @og.rev 5.1.7.0 (2010/06/01) 動的プル?ン実?直?
086             * @og.rev 5.5.1.0 (2012/04/03) useSLabel対?
087             * @og.rev 5.6.2.3 (2013/03/22) 非表示??設定?noDisplayVal追?
088             * @og.rev 5.7.3.0 (2014/02/07) SelectionFactory 対?
089             * @og.rev 5.7.6.3 (2014/05/23) stringOutput対?
090             *
091             * @param   lang    ??
092             * @param   clmData カラ?ータオブジェク?
093             * @param   lblData ラベル??タオブジェク?
094             * @param   cdData  コードデータオブジェク?
095             */
096            public DBColumn( final String     lang,
097                                             final ColumnData clmData ,
098                                             final LabelData  lblData ,
099                                             final CodeData   cdData ) {
100                    this.lang       = lang ;
101                    this.columnData = clmData ;
102                    this.labelData  = lblData ;
103                    this.codeData   = cdData  ;
104    
105                    writable  = true ;
106    
107                    try {
108                            dbType = DBTypeFactory.newInstance( columnData.getDbType() );
109                    }
110                    catch( RuntimeException ex ) {
111                            String errMsg = "dbType の作?に失敗しました?
112                                                    + " name=[" + columnData.getName() + "]"
113                                                    + " dbType=[" + columnData.getDbType() + "] "
114                                                    + ex.getMessage();
115                            throw new HybsSystemException( errMsg,ex );
116                    }
117    
118                    rendAttri       = null  ;
119                    editAttri       = null  ;
120                    addNoValue      = false ;
121                    official        = true  ;               // 3.6.0.7 (2004/11/06)
122                    checkLevel      = -1;
123                    dbid            = null  ;               // 標準から作?されるカラ?ブジェクト?、DEFAULT 接続?を設定する?
124    
125                    eventColumn  = null;            // 4.3.6.0 (2009/04/01)
126                    rawEditParameter = clmData.getEditorParam(); // 4.3.6.0 (2009/04/01)
127                    rawRendParameter = clmData.getRendererParam(); // 5.1.7.0 (2010/06/01)
128                    eventURL         = null;                // 4.3.6.0 (2009/04/01)
129    
130                    useSLabel       = "auto";               // 5.5.1.0
131                    noDisplayVal= null;                     // 5.6.2.3 (2013/03/22) 非表示??設?
132    
133                    stringOutput = HybsSystem.sysBool( "USE_STRING_EXCEL_OUTPUT" );         // 5.7.6.3 (2014/05/23)
134    
135                    String def = columnData.getDefault();
136                    if( def != null ) { defValue = def; }
137                    else {              defValue = dbType.getDefault() ; }
138    
139                    // 5.7.3.0 (2014/02/07) SelectionFactory 対?
140                    selection = ( codeData == null ? null : SelectionFactory.newSelection( "MENU",codeData ) );
141    
142                    try {
143                            cellRenderer = DBCellFactory.newRenderer( columnData.getRenderer(),this );
144                            cellEditor   = DBCellFactory.newEditor(   columnData.getEditor(),  this );
145                    }
146                    catch( RuntimeException ex ) {
147                            String errMsg = "Renderer,Editor の作?に失敗しました?
148                                                    + " name=[" + columnData.getName() + "]"
149                                                    + " Renderer=[" + columnData.getRenderer() + "] "
150                                                    + " Editor=[" + columnData.getEditor() + "] "
151                                                    + ex.getMessage();
152                            throw new HybsSystemException( errMsg,ex );
153                    }
154            }
155    
156            /**
157             * DBColumnConfig オブジェクトより作?されるコンストラクター
158             * すべての??は、インスタンス作?時に設定します?
159             * こ?オブジェクト??度作?されると変更されることはありません?
160             *
161             * @og.rev 4.0.0.0 (2007/11/07) Selectionオブジェクトをキャ?ュする
162             * @og.rev 5.1.7.0 (2010/06/01) 動的プル?ン実?直?
163             * @og.rev 5.1.8.0 (2010/07/01) メソ?名変更(getDefValue ?getDefault)
164             * @og.rev 5.5.1.0 (2012/04/03) useSLabel対?
165             * @og.rev 5.6.2.3 (2013/03/22) 非表示??設定?noDisplayVal追?
166             * @og.rev 5.6.6.0 (2013/07/05) codeKeyVal 属?を使用した、Selection_KEYVAL オブジェクト?作?
167             * @og.rev 5.7.3.0 (2014/02/07) SelectionFactory 対?
168             * @og.rev 5.7.6.3 (2014/05/23) stringOutput対?
169             *
170             * @param   config DBColumnConfigオブジェク?
171             */
172            public DBColumn( final DBColumnConfig config ) {
173                    lang      = config.getLang()            ;
174    
175                    columnData      = config.getColumnData();
176                    labelData       = config.getLabelData();
177                    codeData        = config.getCodeData();
178    
179                    writable        = config.isWritable();
180                    dbType          = DBTypeFactory.newInstance( columnData.getDbType() );
181                    rendAttri       = config.getRendererAttributes();
182                    editAttri       = config.getEditorAttributes();
183                    addNoValue      = config.isAddNoValue();
184                    official        = config.isOfficial();          // 3.6.0.7 (2004/11/06)
185                    dbid            = config.getDbid();
186    
187                    eventColumn      = config.getEventColumn();      // 4.3.6.0 (2009/04/01)
188                    rawEditParameter = config.getRawEditParameter(); // 4.3.6.0 (2009/04/01)
189                    rawRendParameter = config.getRawRendParameter(); // 5.1.7.0 (2010/06/01) 動的プル?ン実?直?
190                    eventURL                 = config.getEventURL();                 // 4.3.6.0 (2009/04/01)
191    
192                    useSLabel                = config.getUseSLabel();               // 5.5.1.0 (2012/04/03)
193                    noDisplayVal     = config.getNoDisplayVal();    // 5.6.2.3 (2013/03/22) 非表示??設?
194    
195                    stringOutput     = config.isStringOutput();             // 5.7.6.3 (2014/05/23)
196    
197                    // DBColumn の 整合?チェ?を行うレベルを規定します?
198                    String CHECK_LEVEL = HybsSystem.sys( "DB_OFFICIAL_COLUMN_CHECK_LEVEL" );
199                    if( !official && CHECK_LEVEL != null && CHECK_LEVEL.length() > 0 ) {
200                            checkLevel = Integer.parseInt( CHECK_LEVEL );
201                    }
202                    else {
203                            checkLevel = -1;
204                    }
205    
206                    String def = config.getDefault();
207                    if( def != null ) { defValue = def; }
208                    else {              defValue = dbType.getDefault() ; }
209    
210                    // 5.6.6.0 (2013/07/05) codeKeyVal 属?を使用した、Selection_KEYVAL オブジェクト?作?
211                    // 優先?位?、codeData オブジェクトで、codeKeyVal を利用したSelectionは、DBColumnConfig からのみ作?可能
212                    if( codeData != null ) {
213                            // 5.7.3.0 (2014/02/07) SelectionFactory 対?
214                            selection = SelectionFactory.newSelection( "MENU",codeData );
215                    }
216                    else {
217                            String codeKeyVal = config.getCodeKeyVal();
218                            if( codeKeyVal != null ) {
219                                    // 5.7.3.0 (2014/02/07) SelectionFactory 対?
220                                    selection = SelectionFactory.newSelection( "KEYVAL", codeKeyVal );
221                            }
222                            else {
223                                    selection = null;
224                            }
225                    }
226    
227                    cellRenderer = DBCellFactory.newRenderer( columnData.getRenderer(),this );
228                    cellEditor   = DBCellFactory.newEditor( columnData.getEditor(),this );
229            }
230    
231            /**
232             * ?を返します?
233             *
234             * @return  ??
235             */
236            public String getLang() {
237                    return lang;
238            }
239    
240            /**
241             * カラ?を返します?
242             *
243             * @return  カラ?
244             */
245            public String getName() {
246                    return columnData.getName();
247            }
248    
249            /**
250             * カラ??ラベル名を返します?
251             *
252             * @return  カラ??ラベル?
253             */
254            public String getLabel() {
255                    return labelData.getLabel();
256            }
257    
258            /**
259             * カラ??ラベル名を返します?
260             *
261             * @return  カラ??ラベル?名前(短))
262             */
263            public String getShortLabel() {
264                    return labelData.getShortLabel();
265            }
266    
267            /**
268             * カラ??ラベル名を返します?
269             *
270             * @return  カラ??ラベル?名前(長))
271             */
272            public String getLongLabel() {
273                    return labelData.getLongLabel();
274            }
275    
276            /**
277             * カラ??クラスを文字?にした名称を返します?
278             * これは?HTML上??タグに?データベ?ス定義に応じたクラス名を
279             * 表します?(VARCHAR2、NUMBER など)
280             *
281             * これは、カラ????タタイ?X,S9など)と機??重?ますが?
282             * そ?カラ?、大まかな?で、文字?であるか?数字であるかを示します?
283             *
284             * 画面表示上?右?、左???IMEのON/OFFなどの CSSファイルの???
285             * カラ????タタイ?X,S9など)ですが、テーブルソート時のソート条件
286             * は、この クラス??(VARCHAR2、NUMBER)を参照します?
287             *
288             * @return  カラ??クラスを文字?にした名称(VARCHAR2、NUMBER など)
289             */
290            public String getClassName() {
291                    return columnData.getClassName();
292            }
293    
294            /**
295             * フィールド???タ長を返します?
296             * 通常は、整数型???と??タ長は同じですが,小数点を表すデータ長は
297             * x,y 形式?場合?x + 2 桁で表されます?(マイナス記号と小数点記号)
298             * 7,3 は?xxxx,yyy のフォーマットで、データ長は? になります?
299             *
300             * @og.rev 2.1.1.2 (2002/11/21) ?桁数入力時の桁数チェ?の間違?訂正?
301             * @og.rev 4.0.0.0 (2005/01/31) メソ?名変更 getMaxlength() ?getTotalSize()
302             *
303             * @return  ??タ長定義??
304             */
305            public int getTotalSize() {
306                    return columnData.getTotalSize();
307            }
308    
309            /**
310             * フィールド?使用桁数を返します?
311             * 少数??場合??7,3" のようなカンマで整数部、小数部を区?た書式になります?
312             * 7,3 は?xxxx,yyy のフォーマットで、整数部?桁?小数部?桁を意味します?
313             *
314             * @return  使用桁数
315             */
316            public String getMaxlength() {
317                    return columnData.getMaxlength();
318            }
319    
320            /**
321             * フィールド?整数部の??タ長を返します?
322             * 通常は、整数型???と??タ長は同じですが,小数点を表すデータ長は
323             * x,y 形式?場合?x - y 桁で表されます?(マイナス記号含ま?
324             * 7,3 は?xxxx,yyy のフォーマットで、データ長は? になります?
325             *
326             * @return  ??タ長定義??
327             */
328            public int getSizeX() {
329                    return columnData.getSizeX() ;
330            }
331    
332            /**
333             * フィールド?小数部の??タ長を返します?
334             * 通常は、整数型???では? になりますが,小数点を表すデータ長は
335             * x,y 形式?場合?y 桁で表されます?
336             * 7,3 は?xxxx,yyy のフォーマットで、データ長は? になります?
337             *
338             * @return  ??タ長定義??
339             */
340            public int getSizeY() {
341                    return columnData.getSizeY() ;
342            }
343    
344            /**
345             * カラ??表示桁数を返します?
346             * viewLength は、設定した?合?み、使用できます?通常は、null が返ります?
347             *
348             * @og.rev 3.5.5.5 (2004/04/23) 新規追?
349             * @og.rev 4.0.0.0 (2005/01/31) メソ?名変更 getSize() ?getViewLength()
350             *
351             * @return      カラ???桁数
352             */
353            public String getViewLength() {
354                    return columnData.getViewLength();
355            }
356    
357            /**
358             * カラ?書き込み可能かど?を返します?
359             *
360             * @return  カラ?書き込み可能かど?
361             */
362            public boolean isWritable() {
363                    return writable;
364            }
365    
366            /**
367             * ??タの値そ?も?ではなく?そ?値のラベル?を返します?
368             *
369             * @og.rev 3.5.5.4 (2004/04/15) value ?null の場合??"(ゼロストリング)にする?
370             *
371             * @param   value       入力?
372             *
373             * @return  ??タ表示用の??
374             */
375            public String getRendererValue( final String value ) {
376                    return cellRenderer.getValue( (value != null ) ? value : "" );
377            }
378    
379            /**
380             * ??タ表示用のHTML??を作?します?
381             * 行番号毎に異なる?を返すことの出来?DBCellRenderer を使用することが?来ます?
382             *
383             * @og.rev 3.5.5.7 (2004/05/10) 行番号に無関係に、?を返すように変更します?
384             * @og.rev 4.0.0.0 (2005/11/30) 行番号に対応した?を返すように変更します?
385             *
386             * @param   row         行番号
387             * @param   value       入力?
388             *
389             * @return  ??タ編?の??
390             */
391            public String getRendererValue( final int row,final String value ) {
392                    return cellRenderer.getValue( row,(value != null ) ? value : "" );
393            }
394    
395            /**
396             * ??タ編?のHTML??を作?します?
397             *
398             * @og.rev 3.5.5.4 (2004/04/15) value ?null の場合??"(ゼロストリング)にする?
399             *
400             * @param   value       入力?
401             *
402             * @return  ??タ編?の??
403             */
404            public String getEditorValue( final String value ) {
405                    return cellEditor.getValue( (value != null ) ? value : "" );
406            }
407    
408            /**
409             * ??タ編?のHTML??を作?します?
410             * 行番号付?編?ータを作?します?名前_行番号 で登録する為?
411             * リクエスト情報を1つ毎?フィールドで処?きます?
412             *
413             * @param   row         行番号
414             * @param   value       入力?
415             *
416             * @return  ??タ編?の??
417             */
418            public String getEditorValue( final int row,final String value ) {
419                    return cellEditor.getValue( row,(value != null ) ? value : "" );
420            }
421    
422            /**
423             * ??タ出力用の固定長??を作?します?
424             * HOST送信用桁数がセ?されて?ば、そちらを優先します?
425             *
426             * @og.rev 3.5.4.5 (2004/01/23) エンコード指定に変更します?
427             *
428             * @param   value       対象の値
429             * @param   encode      固定長で変換する?エンコー?
430             *
431             * @return  ??タ編?の??
432             */
433            public String getWriterValue( final String value,final String encode ) {
434                    return dbType.valueFill( value ,columnData.getSizeX(), columnData.getSizeY(), encode );
435            }
436    
437            /**
438             * ??タの表示用レン?ーを返します?
439             *
440             * @og.rev 3.8.0.2 (2005/07/11) 新規追?
441             *
442             * @return      ??タの表示用レン?ー
443             */
444            public String getRenderer() {
445                    return columnData.getRenderer() ;
446            }
447    
448            /**
449             * ??タの編?エ?ターを返します?
450             *
451             * @og.rev 3.8.0.2 (2005/07/11) 新規追?
452             *
453             * @return      ??タの編?エ?ター
454             */
455            public String getEditor() {
456                    return columnData.getEditor() ;
457            }
458    
459            /**
460             * ?種別名を返します?
461             * カラ???種別名名称を返します?
462             * これは?HTML上??タグに?データベ?ス定義に応じたクラス?
463             * セ??CSS(Cascading Style Sheet)の class="xxxxx" とする事により
464             * ?スタイルを表現するのに使用します?
465             *
466             * ここでは, カラ?ソースの DBTYPE 属?で????(X,S9,KXなど)を返します?
467             *
468             * @return  ??タの?種別(X,KX,S9 など)
469             */
470            public String getDbType() {
471                    return columnData.getDbType() ;
472            }
473    
474            /**
475             * ??タのNATIVEの型?識別コードを返します?
476             *
477             * @og.rev 4.1.1.2 (2008/02/28) Enum?fukurou.model.NativeType)に変更
478             *
479             * @return  NATIVEの型?識別コー?DBType で規?
480             * @see org.opengion.fukurou.model.NativeType
481             */
482            public NativeType getNativeType() {
483                    return dbType.getNativeType();
484            }
485    
486            /**
487             * そ?カラ??,?ォルト?の値を返します?
488             *
489             * カラ?ソースに ?ォルト情報が登録されて?場合?,そ?値を返します?
490             * ?ォルト?が設定されて???合?, null を返します?
491             *
492             * @return  ?ォルト?(無ければ null)
493             */
494            public String getDefault() {
495                    return defValue;
496            }
497    
498            /**
499             * 表示用レン?ーのパラメータを取得します?
500             *
501             * @og.rev 3.4.0.0 (2003/09/01) 新規追?
502             *
503             * @return      表示用レン?ーのパラメータ
504             */
505            public String getRendererParam() {
506                    return columnData.getRendererParam();
507            }
508    
509            /**
510             * 編?エ?ターのパラメータを取得します?
511             *
512             * @og.rev 3.4.0.0 (2003/09/01) 新規追?
513             *
514             * @return      編?エ?ターのパラメータ
515             */
516            public String getEditorParam() {
517                    return columnData.getEditorParam();
518            }
519    
520            /**
521             * ??タタイプ?パラメータを取得します?
522             *
523             * @og.rev 3.4.0.0 (2003/09/01) 新規追?
524             *
525             * @return      ??タタイプ?パラメータ
526             */
527            public String getDbTypeParam() {
528                    return columnData.getDbTypeParam();
529            }
530    
531            /**
532             * カラ?ールを取得します?
533             *
534             * @og.rev 4.0.0.0 (2005/11/30) 新規追?
535             *
536             * @return      カラ?ール
537             */
538            public String getRoles() {
539                    return columnData.getRoles();
540            }
541    
542            /**
543             * カラ?ブジェクト?ロールモードを返します?
544             *
545             * @og.rev 4.3.0.0 (2008/07/04) ロールモード?ルチ対?
546             *
547             * @return カラ?ブジェクト?ロールモー?
548             */
549            public RoleMode getRoleMode() {
550                    return columnData.getRoleMode();
551            }
552    
553            /**
554             * 接続?IDを返します?
555             *
556             * @return  接続?ID
557             */
558            public String getDbid() {
559                    return dbid;
560            }
561    
562            /**
563             * String引数の??を+1した文字?を返します?
564             * これは、英字?場?A,B,C など)は、B,C,D のように,?桁??コードを
565             * ??します?
566             * ??が数字タイプ?場合?, 数字に変換して?1 します?(桁上がりもあり)
567             * 混在タイプ?場合?,??桁だけを確認して ?1します?
568             * 引数?null の場合と、ゼロ??("")の場合?,引数?そ?まま返します?
569             *
570             * ※ 機?拡張?第?引数に????(数字?日付?を指定する事で?
571             *    引数の??に、任意?値を加算できるようにします?
572             *    ただし?すべての DBTypeではなく?ある程度特定します?
573             *    対象外? DBTypeで、第?引数?null 出な??合?、Exception ?Throwsします?
574             *    第?引数が?null の場合?、従来と同じ?1します?
575             *
576             * @og.rev 5.6.0.3 (2012/01/24) ADD に、引数の値を加算する機?を追?ます?
577             *
578             * @param   value  引数の??
579             * @param   add    ?する文字?(null の場合?、従来と同じ?1 します?)
580             *
581             * @return  引数の??を+1した文字?。また?、任意?値を加算した文字??
582             */
583            public String valueAdd( final String value,final String add ) {
584                    // DBType の実??関係で、旧メソ?は残しておきます?
585                    if( add == null || add.isEmpty()  ) {
586                            return dbType.valueAdd( value );
587                    }
588                    else {
589                            return dbType.valueAdd( value , add );
590                    }
591            }
592    
593            /**
594             * ??タが登録可能かど?をチェ?します?
595             * ??タがエラーの場合?、そのエラー?を返します?
596             *
597             * @og.rev 3.6.0.0 (2004/09/22) dbType パラメータを引数に追?
598             * @og.rev 3.6.0.7 (2004/11/06) official属?がfalseの場合?チェ?レベルに対応したチェ?を行う?
599             * @og.rev 3.8.0.8 (2005/10/03) 企画改?61200-050921-02 ラベルからHTMLタグを削除する?
600             * @og.rev 5.2.2.0 (2010/11/01) ?処??valueCheck( value , true ) に委譲?
601             *
602             * @param   value       チェ?対象の値
603             *
604             * @return  エラー?  正常時? null
605             * @see         #valueCheck( String , boolean )
606             */
607            public ErrorMessage valueCheck( final String value ) {
608                    return valueCheck( value , true );
609            }
610    
611            /**
612             * ??タが登録可能かど?をチェ?します?
613             * ??タがエラーの場合?、そのエラー?を返します?
614             *
615             * @og.rev 3.6.0.0 (2004/09/22) dbType パラメータを引数に追?
616             * @og.rev 3.6.0.7 (2004/11/06) official属?がfalseの場合?チェ?レベルに対応したチェ?を行う?
617             * @og.rev 3.8.0.8 (2005/10/03) 企画改?61200-050921-02 ラベルからHTMLタグを削除する?
618             * @og.rev 5.2.2.0 (2010/11/01) 厳?チェ?(isStrict=true)するフラグを追?
619             *
620             * @param   value               チェ?対象の値
621             * @param   isStrict    厳?チェ?(isStrict=true)するかど?
622             *
623             * @return  エラー?  正常時? null
624             */
625            public ErrorMessage valueCheck( final String value , final boolean isStrict ) {
626    
627                    // 3.8.0.8 (2005/10/03) ラベルからHTMLタグを削除する?
628                    String lbl = labelData.getLabel() ;
629                    if( lbl.indexOf( '<' ) >= 0 ) {
630                            lbl = lbl.replaceAll( "<[^>]*>","" );
631                    }
632    
633                    // 5.2.2.0 (2010/11/01) 厳?チェ?(isStrict=true)するフラグを追?
634                    ErrorMessage errMsg = dbType.valueCheck( lbl,value,columnData.getSizeX(), columnData.getSizeY(),columnData.getDbTypeParam() , isStrict );
635                    if( checkLevel >= 0 ) {
636                            // ERR0034:??カラ?ブジェクトには、カラ?ソースが存在しません。name={0} label={1}
637                            errMsg.addMessage( 0,checkLevel,"ERR0034", columnData.getName(),labelData.getLabel() );
638                    }
639                    return errMsg ;
640            }
641    
642            /**
643             * エ?ターで編?れた??タを登録する場合に、データそ?も??
644             * 変換して、実登録??タを作?します?
645             * 例えば,大??みのフィールドなら?大?化します?
646             * 実登録??タの作?は、DBType オブジェクトを利用します?で,
647             * これと DBCellEditor とがアンマッチ?場合?、うまくデータ変換
648             * されな?能性があります?で、注意願います?
649             *
650             * @param   value ?に編?ータとして登録されたデータ
651             *
652             * @return  修正後???(?に??タベ?スに登録する??タ)
653             */
654            public String valueSet( final String value ) {
655                    return dbType.valueSet( value );
656            }
657    
658            /**
659             * action で?されたコマンドを実行して、?の変換を行います?
660             * oldValue(旧??タ)は、?のDBTableModelに設定されて?値です?通常は?
661             * こ?値を使用してカラ?に変換を行います?newValue(新??タ)は、引数で
662             * ?された新しい値です?こ?値には、パラメータを指定して変換方法を
663             * 制御することも可能です?
664             * ??アクションがカラ?処?きな??合?、エラーになります?
665             *
666             * @param   action アクションコマン?
667             * @param   oldValue 入力データ(旧??タ)
668             * @param   newValue 入力データ(新??タ)
669             *
670             * @return      実行後???タ
671             */
672            public String valueAction( final String action,final String oldValue,final String newValue ) {
673                    return dbType.valueAction( action,oldValue,newValue );
674            }
675    
676            /**
677             * ?の設定情報オブジェクトを返します?
678             * こ?オブジェクトを ローカルで書き換えて、DBColumn を作るようにします?
679             *
680             * @og.rev 3.1.0.0 (2003/03/20) DBColumnConfig 関係?見直し?
681             * @og.rev 3.4.0.0 (2003/09/01) 表示パラメータ、編?ラメータ、文字パラメータの追??
682             * @og.rev 3.5.5.5 (2004/04/23) size 属?の意味を変更、maxlength 属?を追??
683             * @og.rev 3.5.5.8 (2004/05/20) codeName 属?を追??
684             * @og.rev 3.6.0.7 (2004/11/06) カラ?ソースから作?されたかど?(official属?追?
685             * @og.rev 5.1.8.0 (2010/07/01) すべての属?を設定するよ?します?
686             * @og.rev 5.5.1.0 (2012/04/03) useSLabel対?
687             * @og.rev 5.6.2.3 (2013/03/22) 非表示??設定?noDisplayVal追?
688             * @og.rev 5.7.6.3 (2014/05/23) stringOutput対?
689             *
690             * @return      設定情報オブジェク?
691             */
692            public DBColumnConfig getConfig() {
693                    // 互換性確保?ため、DBColumnConfig の コンストラクタは修正して?せん?
694    
695                    DBColumnConfig config =
696                            new DBColumnConfig(
697                                                    lang                                                    ,
698                                                    columnData.getName()                    ,
699                                                    labelData                                               ,
700                                                    columnData.getClassName()               ,
701                                                    columnData.getMaxlength()               ,
702                                                    String.valueOf( writable )              ,
703                                                    columnData.getRenderer()                ,
704                                                    columnData.getEditor()                  ,
705                                                    codeData                                                ,
706                                                    columnData.getDbType()                  ,
707                                                    defValue                                                ,
708                                                    columnData.getRendererParam()   ,
709                                                    columnData.getEditorParam()             ,
710                                                    columnData.getDbTypeParam()             ,
711                                                    columnData.getRoles()                   ,               // 4.0.0 (2005/11/30)
712                                                    official                                                ,               // 3.6.0.7 (2004/11/06)
713                                                    dbid     ) ;
714                    config.setViewLength( columnData.getViewLength() );
715    
716                    // 5.1.8.0 (2010/07/01) すべての属?を設定するよ?します?
717                    // コンストラクタは修正して??め?セ?ーメソ?経由で渡します?
718                    config.setRendererAttributes( rendAttri );
719                    config.setEditorAttributes( editAttri );
720                    config.setAddNoValue( addNoValue );
721                    config.setEventColumn( eventColumn );
722                    config.setRawEditParameter( rawEditParameter );
723                    config.setRawRendParameter( rawRendParameter );
724                    config.setEventURL( eventURL );
725    
726                    config.setUseSLabel( useSLabel );                       // 5.5.1.0 (2012/04/03)
727                    config.setNoDisplayVal( noDisplayVal );         // 5.6.2.3 (2013/03/22) 非表示??設?
728    
729                    config.setStringOutput( stringOutput );         // 5.7.6.3 (2014/05/23) 
730    
731                    return config ;
732            }
733    
734            /**
735             * 表示用レン?ーの追??を返します?
736             *
737             * @og.rev 3.1.0.0 (2003/03/20) DBColumnConfig オブジェクト??キープを?
738             *
739             * @return   属?リス?
740             */
741            public Attributes getRendererAttributes() {
742                    return rendAttri ;
743            }
744    
745            /**
746             * 編?エ?ター用の追??を返します?
747             *
748             * @og.rev 3.1.0.0 (2003/03/20) DBColumnConfig オブジェクト??キープを?
749             *
750             * @return   属?リス?
751             */
752            public Attributes getEditorAttributes() {
753                    return editAttri ;
754            }
755    
756            /**
757             * メニューに空の選択リストを追?るかど?を取得します?
758             *
759             * @og.rev 3.5.5.7 (2004/05/10) 新規追?
760             *
761             * @return      空の選択リストを追?るかど?(true:追??false:追?な?
762             */
763            public boolean isAddNoValue() {
764                    return addNoValue ;
765            }
766    
767            /**
768             * こ?カラ?ブジェクトがカラ?ソースより正式に作られたかど?を取得します?
769             * カラ?ソースが無??合?、仮オブジェクトか??タベ?スメタ??タより作?されます?
770             * そ?場合?、チェ?機?が緩くなるため?正式なカラ?ブジェクトと区別する為に
771             * こ?属?を持ちます?
772             *
773             * @og.rev 3.6.0.7 (2004/11/06) 新規追?
774             *
775             * @return      正式に作られたかど?(true:正?false:暫?
776             */
777            public boolean isOfficial() {
778                    return official ;
779            }
780    
781            /**
782             * カラ??ラベル??タオブジェクトを返します?
783             *
784             * @return  カラ??ラベル??タオブジェク?
785             */
786            public LabelData getLabelData() {
787                    return labelData;
788            }
789    
790            /**
791             * カラ??コードデータオブジェクトを返します?
792             * コードデータが存在しな??合?、null を返します?
793             * 受け取り側で、null かど?判定してから使用してください?
794             *
795             * @og.rev 5.2.1.0 (2010/10/01) codeData ?null でも?そ?まま返します?
796             *
797             * @return  カラ??コードデータオブジェク?
798             */
799            public CodeData getCodeData() {
800                    return codeData;
801            }
802    
803            /**
804             * ?入力サイズ(maxlength)より、実際のフィールド?サイズを求めます?
805             *
806             * maxlength : colums_maxsize ?? ?size="maxlength"  変換しません?
807             *
808             * ただし?maxlength が?colums_maxsize を?る?合?、colums_maxsize とします?
809             *
810             * @og.rev 4.0.0.0 (2005/01/31) getFieldSize メソ??XHTMLTag から DBColumn へ移?
811             * @og.rev 4.0.0.0 (2007/02/05) ADJUSTMENT 処??します?(CSSにて対?
812             * @og.rev 5.8.7.2 (2015/05/29) クリアボタン対応で+1する
813             *
814             * @param maxlength       実際の?桁数
815             * @param colums_maxsize 表示上??桁数?
816             *
817             * @return 表示すべきサイズ
818             * @see #getFieldSize( int )
819             */
820            public int getFieldSize( final int maxlength,final int colums_maxsize ) {
821                    int size = maxlength;
822                    
823                    // 5.8.7.2 (2015/05/29)
824                    if( size > 8 ){
825                            size += 1; 
826                    }
827    
828                    if( size <= 0 || size > colums_maxsize ) {
829                            size = colums_maxsize;
830                    }
831    
832                    return size;
833            }
834    
835            /**
836             * ?入力サイズ(maxlength)より、実際のフィールド?サイズを求めます?
837             *
838             * maxlength : colums_maxsize ?? ?size="maxlength"  変換しません?
839             *
840             * ただし?maxlength が?COLUMNS_MAXSIZE を?る?合?、COLUMNS_MAXSIZE とします?
841             *
842             * @og.rev 4.0.0.0 (2005/01/31) getFieldSize メソ??XHTMLTag から DBColumn へ移?
843             * @og.rev 4.0.0.0 (2007/02/05) ADJUSTMENT 処??します?(CSSにて対?
844             *
845             * @param maxlength       実際の?桁数
846             *
847             * @return 表示すべきサイズ
848             * @see #getFieldSize( int ,int )
849             */
850            public int getFieldSize( final int maxlength ) {
851                    return getFieldSize( maxlength,COLUMNS_MAXSIZE );
852            }
853    
854            /**
855             * コードリソースSelectionオブジェクトを返します?
856             *
857             * @og.rev 4.0.0.0 (2007/11/02) 新規追?
858             * @og.rev 5.7.3.0 (2014/02/07) null 対?コードリソースの設定不良?
859             * @og.rev 5.7.7.1 (2014/06/13) XXXMENU の editor は、警告を出さな??
860             *
861             * @return コードSelectionオブジェク?
862             */
863            public Selection getSelection() {
864            // 5.6.1.1 (2013/02/08) 暫定?置。とりあえずエラーは発生させな??
865            //      if( selection == null ) {
866            //              String errMsg = "コードリソースが定義されて?せん? + HybsSystem.CR
867            //                                      + "name=[" + getName() + "],label=[" + getLabel() + "]" ;       // 5.1.8.0 (2010/07/01) errMsg 修正
868            //              throw new HybsSystemException( errMsg );
869            //      }
870    
871                    // 5.7.3.0 (2014/02/07) null 対?コードリソースの設定不良?
872                    if( selection == null ) {
873                            // 5.7.7.1 (2014/06/13) XXXMENU の editor は、警告を出さな??
874                            String editor = getEditor();
875                            if( editor != null && editor.contains( "MENU" ) ) {
876                                    return null;
877                            }
878                            else {
879                                    String errMsg = "clm=[" + getName() + "],label=[" + getLabel() + "]のコードリソースが定義されて?せん? ;
880                                    System.err.println( "警告? + errMsg );
881                                    return SelectionFactory.newSelection( "NULL",errMsg );
882                            }
883                    }
884    
885                    return selection ;
886            }
887    
888            /**
889             * イベントカラ?親カラ?
890             *
891             * @og.rev 4.3.6.0 (2009/04/01)
892             *
893             * @return イベントカラ?
894             */
895            public String getEventColumn() {
896                    return eventColumn ;
897            }
898    
899            /**
900             * {&#064;XXXX}を変換して??態?編?ラメータを返します?
901             *
902             * @og.rev 4.3.6.0 (2009/04/01)
903             *
904             * @return 生編?ラメータ
905             */
906            public String getRawEditParam() {
907                    return rawEditParameter ;
908            }
909    
910            /**
911             * {&#064;XXXX}を変換して??態?編?ラメータを返します?
912             *
913             * @og.rev 5.1.7.0 (2010/06/01) 動的プル?ン実?直?
914             *
915             * @return 生表示パラメータ
916             */
917            public String getRawRendParam() {
918                    return rawRendParameter ;
919            }
920    
921            /**
922             * eventColumn利用時にJSで利用するURL
923             *
924             * @og.rev 4.3.6.0 (2009/04/01)
925             *
926             * @return イベン?RL
927             */
928            public String getEventURL() {
929                    return eventURL ;
930            }
931    
932            /**
933             * 引数のタグ??に対して、イベントカラ??実行に?なspanタグを付加した
934             * ??を返します?
935             *
936             * @param tag タグ??
937             * @param initVal 子カラ??初期値
938             * @param writable タグの要?書き込み可能かど?
939             *
940             * @return spanタグを付加したタグ??
941             */
942            public String getEventColumnTag( final String tag, final String initVal, final boolean writable ) {
943                    return getEventColumnTag( tag, initVal, -1, writable );
944            }
945    
946            /**
947             * 引数のタグ??に対して、イベントカラ??実行に?なspanタグを付加した
948             * ??を返します?
949             *
950             * @param tag タグ??
951             * @param initVal 子カラ??初期値
952             * @param row 行番号
953             * @param writable タグの要?書き込み可能かど?
954             *
955             * @return spanタグを付加したタグ??
956             */
957            public String getEventColumnTag( final String tag, final String initVal, final int row, final boolean writable ) {
958                    TagBuffer span = new TagBuffer( "span" );
959                    span.add( "class", HybsSystem.EVENT_COLUMN_CLASS );
960                    span.add( HybsSystem.EVENT_COLUMN_ID,  columnData.getName() + ( row < 0 ? "" : HybsSystem.JOINT_STRING + row ) );
961                    span.add( HybsSystem.EVENT_COLUMN_INITVAL, initVal );
962                    span.add( HybsSystem.EVENT_COLUMN_WRITABLE, String.valueOf( writable ) );
963                    span.setBody( tag );
964                    return span.makeTag();
965            }
966    
967            /**
968             * セ?されて?表示パラメータ、編?ラメータに"{&#064;XXXX}"が含まれて??パラメーターのパ?スが?か)?
969             * 返します?
970             *
971             * @og.rev 6.0.0.1 (2014/04/25) ?処?更
972             *
973             * @return "{&#064;XXXX}"が含まれて??含まれて?場?rue)
974             */
975            public boolean isNeedsParamParse() {
976                    return  ( rawRendParameter != null && rawRendParameter.indexOf( "{@" ) >= 0 )
977                            ||      ( rawEditParameter != null && rawEditParameter.indexOf( "{@" ) >= 0 );
978            }
979    
980            /**
981             * ラベル短ベ?スのメニューにするかど?
982             *
983             * @og.rev 5.5.1.0 (2012/04/03)
984             *
985             * @return イベントカラ?
986             */
987            public String getUseSLabel() {
988                    return useSLabel ;
989            }
990    
991            /**
992             * 非表示??を返します?
993             *
994             * これは、例えば、数字型の場合?? がデフォルトなどの場合?
995             * あえて表示したくな?どのケースに使?す?
996             * そ?ような状況が設定されて???合?、null が返されます?
997             *
998             * @og.rev 5.6.2.3 (2013/03/22) 新規追?
999             *
1000             * @return 非表示??
1001             */
1002            public String getNoDisplayVal() {
1003                    return noDisplayVal ;
1004            }
1005    
1006            /**
1007             * レン?ー利用ファイル出力時に数値等も?タイプに固定するかど?(初期値:true)
1008             *
1009             * Excel出力時に利用されます?
1010             * 通常はtrue(?タイプ固定)です?
1011             * こ?フラグをfalseにする事でdbTypeに従った?力になります?
1012             *
1013             * @og.rev 5.7.6.3 (2014/05/23) 新規追?
1014             *
1015             * @return renderer利用ファイル出力時のString出力フラグ(true:String出?false:dbType次第??
1016             */
1017            public boolean isStringOutput() {
1018                    return stringOutput ;
1019            }
1020    }