001/*
002 * Copyright (c) 2009 The openGion Project.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013 * either express or implied. See the License for the specific language
014 * governing permissions and limitations under the License.
015 */
016package org.opengion.hayabusa.resource;
017
018import org.opengion.fukurou.util.StringUtil ;
019import org.opengion.hayabusa.common.HybsSystemException;                        // 6.4.7.0 (2016/06/03)
020
021import static org.opengion.fukurou.system.HybsConst.BUFFER_MIDDLE;      // 6.1.0.0 (2014/12/26) refactoring
022import static org.opengion.fukurou.system.HybsConst.CR ;                        // 6.1.0.0 (2014/12/26)
023
024import java.text.MessageFormat;
025import java.util.Arrays;                                                                                        // 6.4.7.0 (2016/06/03)
026
027/**
028 * systemId , lang に対応したラベルデータを作成します。
029 *
030 * ラベルデータは、項目(CLM)に対して、各種ラベル情報を持っています。
031 * 従来のラベルは、表示名称として、一種類しか持っていませんでしたが、
032 * ラベルデータは、3種類の名称と、1種類の概要を持っています。
033 *
034 *   label       : 名称(長)      従来のラベルと同じで定義された文字そのものです。
035 *   shortLabel  : 名称(HTML短)  概要説明をバルーン表示する短い名称です。
036 *   longLabel   : 名称(HTML長)  概要説明をバルーン表示する長い名称です。
037 *   description : 概要説明      カラムの説明やバルーンに使用します。
038 *
039 * 名称(HTML長)は、従来の表示名称にあたります。これは、一般的なラベルとして
040 * 使用されます。名称(HTML短)は、テーブル一覧のヘッダーの様に、特殊なケースで、
041 * 簡略化された名称を使用するときに利用されます。この切り替えは、自動で判断されます。
042 * 名称(HTML短)に、なにも設定されていない場合は、名称(HTML長)が自動的に使用されますので
043 * 初期データ移行時には、そのまま、通常時もテーブルヘッダー時も同じ文字列が
044 * 使用されます。
045 * ただし、一覧表示のうち、EXCEL出力などのデータには、名称(長)が使用されます。
046 * これは、名称(HTML短)や名称(HTML長)は、Tips表示を行う為のHTML構文を採用している為
047 * テキスト等に出力するには不適切だからです。また、EXCEL等のツールでは、ラベル名が
048 * 長くてもセル幅等で調整できる為、簡略化された名称よりも正式名称で出力します。
049 *
050 * ラベルデータを作成する場合は、同一ラベルで、作成区分(KBSAKU)違いの場合は、
051 * 最も大きな作成区分を持つコードを使用します。
052 * 作成区分(KBSAKU)は、0:システム予約、1:アプリ設定、2:ユーザー設定 という具合に
053 * カスタマイズの度合いに応じて大きな数字を割り当てることで、キー情報を上書き修正
054 * することが可能になります。(削除することは出来ません。)
055 *
056 * @og.rev 4.0.0.0 (2004/12/31) 新規作成
057 * @og.group リソース管理
058 *
059 * @version  4.0
060 * @author   Kazuhiko Hasegawa
061 * @since    JDK5.0,
062 */
063public final class LabelData implements LabelInterface {
064
065        /** 内部データのカラム番号 {@value}        */
066        public static final int CLM                     = 0 ;
067        /** 内部データのカラム番号 {@value}        */
068        public static final int SNAME           = 1 ;
069        /** 内部データのカラム番号 {@value}        */
070        public static final int LNAME           = 2 ;
071        /** 内部データのカラム番号 {@value}        */
072        public static final int DESCRIPTION     = 3 ;
073//      /** 内部データのカラム数 {@value} */
074//      public static final int DATA_SIZE       = 4 ;           // 7.2.6.0 (2020/06/30) 未使用なので削除
075
076        /** リソース読み込みのために一時利用 4.3.5.7 (2009/03/22) */
077        /* default */ static final int FG_LOAD          = 4 ;
078        /** FGLOAD の読み込み済み設定用のUNIQ 6.3.1.1 (2015/07/10) */
079        /* default */ static final int UNIQ                     = 5 ;
080        /** FGLOAD の読み込み済み設定用のSYSTEM_ID 6.3.1.1 (2015/07/10) */
081        /* default */ static final int SYSTEM_ID        = 6 ;
082
083        /** 内部データのカラム番号 {@value}        */
084        public static final int KBSAKU          = 7 ;   // 7.4.2.0 (2021/05/18) 内部的に使ってないが定義しておく
085        public static final int SNO                     = 8 ;   // 7.2.6.1 (2020/07/17) 内部的に使ってないが定義しておく
086
087        private final String    key                     ;               // 項目
088        private final String    label           ;               // 名称(長)
089        private final String    shortLabel      ;               // 名称(HTML短)
090        private final String    longLabel       ;               // 名称(HTML長)
091        private final String    description     ;               // 概要説明
092        private final boolean   official        ;               // リソースDBから作成されたかどうか
093//      private final boolean   isFormat        ;               // メッセージフォーマット対象かどうか 4.0.0.0 (2007/10/17) 7.1.0.1 (2020/02/07) 長,短,概要などあるため、直前にチェック
094        private final String    rawShortLabel;          // 名称(未変換短) 4.3.8.0 (2009/08/01)
095//      private final boolean   isFormatDesc;           // 概要がフォーマット対象か 4.3.7.6 (2009/07/15) 7.1.0.1 (2020/02/07) 未使用
096        private final String    rawLongLabel;           // 名称(未変換長) 5.6.8.2 (2013/09/20)
097
098        /**
099         * null LabelData オブジェクトを作成します。
100         * このオブジェクトは、DBリソース上に存在しない場合に使用される
101         * null 情報を表す、LabelData オブジェクトです。
102         *
103         * @og.rev 5.6.8.2 (2013/09/20) rawLongLabel対応
104         * @og.rev 5.7.3.0 (2014/02/07) public に格上げします。
105         * @og.rev 7.0.1.5 (2018/12/10) 名前とラベルだけ異なるLabelDataオブジェクトを作成します。
106         *
107         * @param       inkey   キー情報
108         */
109        public LabelData( final String inkey ) {
110                this( inkey,inkey );
111//              key                     = inkey.intern() ;
112//              label           = key ;         // 名称(長)
113//              shortLabel      = key ;         // 名称(HTML短)
114//              longLabel       = key ;         // 名称(HTML長)
115//              description     = ""  ;         // 概要説明
116//              official        = false;        // 非正式
117//              isFormat        = false;        // 非フォーマット 4.0.0.0 (2007/10/17)
118//              rawShortLabel = key;    // 名称(未変換短) 4.3.8.0 (2009/08/01)
119//              isFormatDesc = false;   // 概要フォーマット 4.3.7.6 (2009/07/15)
120//              rawLongLabel = key;             // 名称(未変換長)5.6.8.2 (2013/09/20)
121        }
122
123        /**
124         * 名前とラベルだけ異なるLabelDataオブジェクトを作成します。
125         *
126         * これは、ラベルを簡易的に利用する場合に使用する、LabelData オブジェクトです。
127         *
128         * @og.rev 7.0.1.5 (2018/12/10) 名前とラベルだけ異なるLabelDataオブジェクトを作成します。
129         * @og.rev 7.1.0.1 (2020/02/07) isFormat、isFormatDescは、長,短,概要などあるため、直前にチェックするので廃止。
130         *
131         * @param       inkey   キー情報
132         * @param       inLbl   ラベル
133         */
134        public LabelData( final String inkey,final String inLbl ) {
135                key                     = inkey.intern() ;
136                label           = inLbl ;       // 名称(長)                …(not null)
137                shortLabel      = inLbl ;       // 名称(HTML短)
138                longLabel       = inLbl ;       // 名称(HTML長)
139                description     = ""  ;         // 概要説明
140                official        = false;        // 非正式
141//              isFormat        = false;        // 非フォーマット 4.0.0.0 (2007/10/17) 7.1.0.1 (2020/02/07) 廃止
142                rawShortLabel = inLbl;  // 名称(未変換短) 4.3.8.0 (2009/08/01)
143//              isFormatDesc = false;   // 概要フォーマット 4.3.7.6 (2009/07/15) 7.1.0.1 (2020/02/07) 廃止
144                rawLongLabel = inLbl;   // 名称(未変換長)5.6.8.2 (2013/09/20)
145        }
146
147        /**
148         * 配列文字列のデータを元に、LabelDataオブジェクトを構築します。
149         * このコンストラクタは、他のパッケージから呼び出せないように、
150         * パッケージプライベートにしておきます。
151         * このコンストラクタは、DBリソースファイルを想定しています。
152         *
153         * @og.rev 5.4.0.1 (2011/11/01) SNAME、概要説明、rawShortLabel 関係の処理を修正
154         * @og.rev 5.6.8.2 (2013/09/20) rawLongLabel対応
155         * @og.rev 6.2.2.0 (2015/03/27) BRと\nを相互に変換する処理を追加
156         * @og.rev 6.2.2.3 (2015/04/10) htmlフィルターに、BR→改行処理機能を追加。
157         * @og.rev 6.3.9.0 (2015/11/06) StringUtil.yenN2br は、null を返しません。
158         * @og.rev 7.1.0.1 (2020/02/07) isFormat、isFormatDescは、長,短,概要などあるため、直前にチェックするので廃止。
159         * @og.rev 7.2.9.0 (2020/10/12) rawShortLabelは、DB検索未設定の場合は、nullなので、初期値指定を行う。
160         *
161         * @param       data    CLM,SNAME,LNAME,DESCRIPTION
162         */
163        LabelData( final String[] data ) {
164                key                     = data[CLM].intern() ;                                                          // 項目
165                label           = StringUtil.yenN2br( data[LNAME] ) ;                           // 6.2.2.3 (2015/04/10) 名称(HTML長)
166                description     = StringUtil.yenN2br( data[DESCRIPTION] ) ;                     // 6.2.2.3 (2015/04/10) 概要説明
167                official        = true;                                                                                         // 正式
168//              isFormat        = label.indexOf( '{' ) >= 0 ;                                           // 4.0.0.0 (2007/10/17)
169                String title = null;
170
171                rawLongLabel = label;                                                                                   // 名称(未変換長)5.6.8.2 (2013/09/20)
172                if( description.isEmpty() ) {                                                                   // 6.3.9.0 (2015/11/06) StringUtil.yenN2br は、null を返しません。
173//                      isFormatDesc = false;
174                        // 5.4.0.1 (2011/11/01) title と label が間違っている。(SNAME が存在する場合)
175                        title     = StringUtil.htmlFilter( label,true ) ;                       // 6.2.2.0 (2015/03/27)
176
177                        // 概要説明がない場合は、そのままラベルを使用する。
178                        longLabel = label;
179                }
180                else {
181//                      isFormatDesc = description.indexOf( '{' ) >= 0 ;                        // 5.1.8.0 (2010/07/01) nullポインタの参照外し対策
182                        title        = StringUtil.htmlFilter( description,true ) ;      // 6.2.2.0 (2015/03/27)
183
184                        // 概要説明がある場合は、ツールチップにDESCRIPTIONを表示する。
185                        longLabel = "<span title=\""
186                                                        + title
187                                                        + "\">"
188                                                        + label
189                                                        + "</span>" ;
190                }
191
192                final String sname = data[SNAME];               // 名称(HTML短)
193                if( sname == null || sname.isEmpty() ) {
194                        // SNAME がない場合は、longLabel を使用する。
195                        shortLabel    = longLabel;
196//                      rawShortLabel = label;          // 5.4.0.1 (2011/11/01) longLabel を使うと、ツールチップが加味されるため。
197                        rawShortLabel = null;           // 7.2.9.0 (2020/10/12)
198                }
199                else {
200                        // SNAME が存在する場合、ツールチップにdescriptionかlabelを使用する。
201                        shortLabel = "<span title=\""
202                                                        + title
203                                                        + "\">"
204                                                        + sname
205                                                        + "</span>" ;
206                        rawShortLabel = sname; // 4.3.8.0 (2009/08/01)
207                }
208        }
209
210        /**
211         * ラベルオブジェクトのキーを返します。
212         *
213         * @return      ラベルオブジェクトのキー
214         */
215        public String getKey() { return key; }
216
217        /**
218         * ラベルオブジェクトの名称を返します。
219         * これは、DB上の LNAME(名称(長))に該当します。
220         *
221         * @return      ラベルオブジェクトの名称(短)
222         */
223        public String getLabel() { return label; }
224
225        /**
226         * ラベルオブジェクトの名称(短)を返します。
227         * 概要説明がない場合でかつDB上のSNAMEが未設定の場合は、
228         * LNAME が返されます。SNAMEが設定されている場合は、
229         * ツールチップにLNAME が表示されます。
230         * 概要説明が存在する場合は、ツールチップに概要説明が
231         * 表示されます。
232         *
233         * @return      ラベルオブジェクトの名称(短)
234         */
235        public String getShortLabel() { return shortLabel; }
236
237        /**
238         * ラベルオブジェクトの名称(長)を返します。
239         * 概要説明が存在する場合は、ツールチップに概要説明が
240         * 表示されます。
241         *
242         * @return      ラベルオブジェクトの名称(長)
243         * @see #getLongLabel( String )
244         */
245        public String getLongLabel() { return longLabel; }
246
247        /**
248         * ラベルインターフェースの名称(長)を返します。
249         * ツールチップに表示するタイトル属性(概要説明)を置き換えます。
250         * null の場合は、既存のgetLongLabel()を返します。
251         *
252         * @og.rev 6.2.2.0 (2015/03/27) BRと\nを相互に変換する処理を追加
253         * @og.rev 6.2.2.3 (2015/04/10) htmlフィルターに、BR→改行処理機能を追加。
254         *
255         * @param       title   ツールチップに表示するタイトル属性
256         *
257         * @return      ラベルインターフェースの名称(長)
258         * @see #getLongLabel()
259         */
260        public String getLongLabel( final String title ) {
261                final String tipsLabel ;
262                if( title == null ) {
263                        tipsLabel = longLabel;
264                }
265                else {
266                        tipsLabel = "<span title=\""
267                                                        + StringUtil.htmlFilter( title,true )   // 6.2.2.3 (2015/04/10)
268                                                        + "\">"
269                                                        + label
270                                                        + "</span>" ;
271                }
272                return tipsLabel ;
273        }
274
275        /**
276         * ラベルインターフェースの引数付きメッセージを返します。
277         * メッセージの引数部分に、文字列配列を適用して、MessageFormat
278         * で変換した結果を返します。(MessageData でのみ有効です。)
279         *
280         * @og.rev 4.0.0.0 (2007/10/17) メッセージリソース統合に伴い、MessageDataより移行
281         * @og.rev 4.3.8.0 (2009/08/01) 引数にHTMLサニタイジング処理
282         * @og.rev 5.0.0.2 (2009/09/15) サニタイジング処理をやめる
283         * @og.rev 6.4.3.4 (2016/03/11) ラベル {n} が存在しない場合は、引数を連結せず、元のラベルを返す。
284         * @og.rev 6.4.5.0 (2016/04/08) リソースから作成された場合は、引数を連結せず、そうでない場合は連結します。
285         * @og.rev 6.4.7.0 (2016/06/03) IllegalArgumentException が発生した場合に、見えるようにする。
286         * @og.rev 7.0.7.0 (2019/12/13) #getMessage(String...) , #getDescription(String...) , #getShortMessage(String...) を統合します。
287         * @og.rev 7.1.0.1 (2020/02/07) isFormat、isFormatDescは、長,短,概要などあるため、直前にチェックするので廃止。
288         *
289         * @param       lbl             メッセージを作成する元となるラベル文字列
290         * @param       vals    メッセージ引数の文字列配列(可変長引数)
291         *
292         * @return      ラベルインターフェースの引数付きメッセージ
293         */
294//      public String getMessage( final String... vals ) {                      // 6.1.1.0 (2015/01/17) 可変長引数でもnullは来る。
295        private String getMessage( final String lbl , final String[] vals ) {
296                final String rtn ;
297
298                final String[] args             = ( vals == null ) ? new String[0] : vals ;
299                final boolean isFormat  = lbl != null && lbl.indexOf( '{' ) >= 0 ;              // 7.1.0.1 (2020/02/07)
300                if( isFormat ) {
301                        // 6.4.7.0 (2016/06/03) IllegalArgumentException が発生した場合に、見えるようにする。
302                        try {
303//                              rtn = MessageFormat.format( label,(Object[])args );
304                                rtn = MessageFormat.format( lbl,(Object[])args );
305                        }
306                        catch( final IllegalArgumentException ex ) {
307                                final String errMsg = "MessageFormatエラー:"
308                                                        + " Key [" + key + "]"
309//                                                      + " Pattern [" + label + "]"
310                                                        + " Pattern [" + lbl + "]"
311                                                        + " Arguments [" + Arrays.toString( (Object[])args ) + "]" ;
312                                throw new HybsSystemException( errMsg,ex );
313                        }
314                }
315                else {
316                        // 6.4.5.0 (2016/04/08) リソースから作成された場合は、引数を連結せず、そうでない場合は連結します。
317                        if( official ) {
318//                              rtn = label ;                   // 6.4.3.4 (2016/03/11)
319                                rtn = lbl ;                             // 6.4.3.4 (2016/03/11)
320                        }
321                        else {
322                                final StringBuilder buf = new StringBuilder( BUFFER_MIDDLE )
323//                                      .append( label );
324                                        .append( lbl );
325                                for( final String val : args ) {
326//                                      if( val != null && ! val.equals( label ) ) {
327                                        if( val != null && ! val.equals( lbl ) ) {
328                                                buf.append( ' ' ).append( val );                                        // 6.0.2.5 (2014/10/31) char を append する。
329                                        }
330                                }
331                                rtn = buf.toString();
332                        }
333                }
334                return rtn ;
335        }
336
337        /**
338         * ラベルインターフェースの引数付きメッセージを返します。
339         * メッセージの引数部分に、文字列配列を適用して、MessageFormat
340         * で変換した結果を返します。(MessageData でのみ有効です。)
341         *
342         * @og.rev 4.0.0.0 (2007/10/17) メッセージリソース統合に伴い、MessageDataより移行
343         * @og.rev 4.3.8.0 (2009/08/01) 引数にHTMLサニタイジング処理
344         * @og.rev 5.0.0.2 (2009/09/15) サニタイジング処理をやめる
345         * @og.rev 6.4.3.4 (2016/03/11) ラベル {n} が存在しない場合は、引数を連結せず、元のラベルを返す。
346         * @og.rev 6.4.5.0 (2016/04/08) リソースから作成された場合は、引数を連結せず、そうでない場合は連結します。
347         * @og.rev 6.4.7.0 (2016/06/03) IllegalArgumentException が発生した場合に、見えるようにする。
348         * @og.rev 7.0.7.0 (2019/12/13) #getMessage(String...) , #getDescription(String...) , #getShortMessage(String...) を統合します。
349         *
350         * @param       vals    メッセージ引数の文字列配列(可変長引数)
351         *
352         * @return      ラベルインターフェースの引数付きメッセージ
353         */
354        public String getMessage( final String... vals ) {              // 6.1.1.0 (2015/01/17) 可変長引数でもnullは来る。
355                return getMessage( label,vals );
356
357//              final String rtn ;
358//
359//              final String[] args = ( vals == null ) ? new String[0] : vals ;
360//              if( isFormat ) {
361//                      // 6.4.7.0 (2016/06/03) IllegalArgumentException が発生した場合に、見えるようにする。
362//                      try {
363//                              rtn = MessageFormat.format( label,(Object[])args );
364//                      }
365//                      catch( final IllegalArgumentException ex ) {
366//                              final String errMsg = "MessageFormatエラー:"
367//                                                      + " Key [" + key + "]"
368//                                                      + " Pattern [" + label + "]"
369//                                                      + " Arguments [" + Arrays.toString( (Object[])args ) + "]" ;
370//                              throw new HybsSystemException( errMsg,ex );
371//                      }
372//              }
373//              else {
374//                      // 6.4.5.0 (2016/04/08) リソースから作成された場合は、引数を連結せず、そうでない場合は連結します。
375//                      if( official ) {
376//                              rtn = label ;                   // 6.4.3.4 (2016/03/11)
377//                      }
378//                      else {
379//                              final StringBuilder buf = new StringBuilder( BUFFER_MIDDLE )
380//                                      .append( label );
381//                              for( final String val : args ) {
382//                                      if( val != null && ! val.equals( label ) ) {
383//                                              buf.append( ' ' ).append( val );                                        // 6.0.2.5 (2014/10/31) char を append する。
384//                                      }
385//                              }
386//                              rtn = buf.toString();
387//                      }
388//              }
389//              return rtn ;
390        }
391
392        /**
393         * ラベルオブジェクトの概要説明を返します。
394         * 概要説明が存在する場合は、ラベルのツールチップに
395         * 概要説明が表示されます。
396         *
397         * @return      ラベルオブジェクトの概要説明
398         */
399        public String getDescription() { return description; }
400
401        /**
402         * ラベルオブジェクトの概要説明を返します。
403         * このメソッドでは{0},{1}...をパラメータで置換します。
404         *
405         * @og.rev 4.3.7.6 (2009/07/15) 新規作成
406         * @og.rev 4.3.8.0 (2009/08/01) 引数にHTMLサニタイジング処理
407         * @og.rev 5.0.0.2 (2009/09/15) サニタイジング処理をやめる
408         * @og.rev 5.4.0.1 (2011/11/01) {}が存在しない場合は単に概要を出力
409         * @og.rev 6.4.7.0 (2016/06/03) IllegalArgumentException が発生した場合に、見えるようにする。
410         * @og.rev 7.0.7.0 (2019/12/13) #getMessage(String...) , #getDescription(String...) , #getShortMessage(String...) を統合します。
411         *
412         * @param       vals    メッセージ引数の文字列配列(可変長引数)
413         *
414         * @return      ラベルオブジェクトの概要説明
415         */
416        public String getDescription( final String... vals ) {          // 6.1.1.0 (2015/01/17) 可変長引数でもnullは来る。
417                return getMessage( description,vals );
418
419//              final String rtn ;
420//
421//              // 6.1.1.0 (2015/01/17) 可変長引数でもnullは来る。
422//              final String[] args = ( vals == null ) ? new String[0] : vals ;
423//              if( isFormatDesc ) {
424//                      // 6.4.7.0 (2016/06/03) IllegalArgumentException が発生した場合に、見えるようにする。
425//                      try {
426//                              rtn = MessageFormat.format( description,(Object[])args );
427//                      }
428//                      catch( final IllegalArgumentException ex ) {
429//                              final String errMsg = "MessageFormatエラー:"
430//                                                      + " Key [" + key + "]"
431//                                                      + " Pattern [" + description + "]"
432//                                                      + " Arguments [" + Arrays.toString( (Object[])args ) + "]" ;
433//                              throw new HybsSystemException( errMsg,ex );
434//                      }
435//              }
436//              else {
437//                      // 5.4.0.1 (2011/11/01) {}が存在しない場合は単に概要を出力 ・・・ なら、直接セットに変更
438//                      rtn = description;
439//              }
440//              return rtn ;
441        }
442
443        /**
444         * ラベルオブジェクトの名称(未変換短)を返します。
445         * このメソッドでは{0},{1}...をパラメータで置換します。
446         *
447         * @og.rev 7.0.7.0 (2019/12/13) #getMessage(String...) , #getDescription(String...) , #getShortMessage(String...) を統合します。
448         * @og.rev 7.2.9.0 (2020/10/12) rawShortLabelは、DB検索未設定の場合は、nullなので、初期値指定を行う。
449         *
450         * @param       vals    メッセージ引数の文字列配列(可変長引数)
451         *
452         * @return ラベルインターフェースの名前(短)
453         */
454        public String getShortMessage( final String... vals ) {
455                final String slbl = rawShortLabel == null ? label : rawShortLabel ;             // 7.2.9.0 (2020/10/12)
456//              return getMessage( rawShortLabel,vals );
457                return getMessage( slbl,vals );
458        }
459
460        /**
461         * リソースDBから作成されたかどうかを返します。
462         * 正式な場合は、true / リソースになく、独自に作成された場合は、false になります。
463         *
464         * @return      リソースDBから作成されたかどうか
465         */
466        public boolean isOfficial() { return official; }
467
468        /**
469         * ラベルオブジェクトの名称(長)をそのままの形で返します。
470         * (discription等を付けない)
471         *
472         * @og.rev 5.6.8.2 (2009/08/01) 追加
473         *
474         * @return      ラベルオブジェクトの名称(長)そのままの状態
475         * @og.rtnNotNull
476         */
477        public String getRawLongLabel() { return rawLongLabel; }
478
479        /**
480         * ラベルオブジェクトの名称(短)をspanタグを付けない状態で返します。
481         * SNAMEが未設定の場合は、LNAME が返されます。
482         *
483         * @og.rev 4.3.8.0 (2009/08/01) 追加
484         * @og.rev 7.2.9.0 (2020/10/12) rawShortLabelは、DB検索未設定の場合は、nullなので、初期値指定を行う。
485         *
486         * @return      ラベルオブジェクトの名称(短)にspanタグを付けない状態
487         * @og.rtnNotNull
488         */
489        public String getRawShortLabel() {
490//              return rawShortLabel;
491                return getRawShortLabel( label );               // 7.2.9.0 (2020/10/12)
492        }
493
494        /**
495         * ラベルオブジェクトの名称(短)をspanタグを付けない状態で返します。
496         * SNAMEが未設定の場合は、LNAME が返されます。
497         *
498         * @og.rev 7.2.9.0 (2020/10/12) rawShortLabelは、DB検索未設定の場合は、nullなので、初期値指定を行う。
499         *
500         * @param       defVal  名称(短)がnullの場合の初期値
501         *
502         * @return      ラベルオブジェクトの名称(短)にspanタグを付けない状態
503         */
504        public String getRawShortLabel( final String defVal ) {
505                return rawShortLabel == null ? defVal : rawShortLabel ;
506        }
507
508        /**
509         * オブジェクトの識別子として,詳細なユーザー情報を返します。
510         *
511         * @return  詳細なユーザー情報
512         * @og.rtnNotNull
513         */
514        @Override
515        public String toString() {
516                final StringBuilder rtn = new StringBuilder( BUFFER_MIDDLE )
517                        .append( "CLM :" ).append( key )
518                        .append( " SNAME :" ).append( shortLabel )
519                        .append( " LNAME :" ).append( longLabel )
520                        .append( " DESCRIPTION :" ).append( description ).append( CR );
521                return rtn.toString();
522        }
523}