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.db;
017
018import java.util.concurrent.ConcurrentMap;                                                      // 6.4.3.3 (2016/03/04)
019import java.util.concurrent.ConcurrentHashMap;                                          // 6.4.3.1 (2016/02/12) refactoring
020import java.util.Set;                                                                                           // 6.0.2.4 (2014/10/17)
021import java.util.HashSet;                                                                                       // 6.0.2.4 (2014/10/17)
022import java.util.function.BiConsumer;                                                           // 6.4.5.0 (2016/04/08)
023import java.util.regex.Pattern;
024
025import org.opengion.fukurou.util.StringUtil;
026import static org.opengion.fukurou.system.HybsConst.BUFFER_MIDDLE;      // 6.1.0.0 (2014/12/26) refactoring
027
028/**
029 * 編集設定情報を管理するためのデータ管理クラスです。
030 * ここで管理される各パラメーターの意味は以下の通りです。
031 * (各インデックス番号は、内部的に管理されているインデックス番号を意味します)
032 *
033 * ・0:編集名
034 *       この編集設定オブジェクトの名称です。
035 * ・1:表示カラム
036 *       表示対象となるカラム一覧です。CSV形式で指定します。
037 *       この一覧には、非表示のカラムも合わせて管理され、非表示カラムについては、
038 *       カラム名の先頭に"!"をつけます。
039 *       例) AAA,!BBB,CCC ⇒ AAA,CCCの順に表示(BBBは非表示)
040 * ・2:集計カラム
041 *       各値をSUMする対象となるカラムです。(CSV形式で複数指定が可能)
042 *       ここで指定されたカラムは数値型である必要があります。
043 *       SQL構文における、SUM関数の引数として指定するカラムに相当します。
044 * ・3:グループカラム
045 *       集計カラムの各値をグルーピングするためのカラムです。(CSV形式で複数指定が可能)
046 *       SQL構文における、GROUP BYに指定するカラムに相当します。
047 * ・4:小計カラム
048 *       集計カラムの各値に対し、小計行を付加するためのブレイクキーを指定します。(CSV形式で複数指定が可能)
049 * ・5:合計カラム
050 *       集計カラムの各値に対し、合計行を付加するためのブレイクキーを指定します。(CSV形式で複数指定が可能)
051 * ・6:総合計フラグ
052 *       集計カラムの各値に対し、総合計行を付加するかどうかを指定します。(0以外:追加する 0:追加しない)
053 * ・7:表示順カラム
054 *       データの表示順をその順番にCSV形式で指定します。
055 *       カラム名の先頭に"!"をつけた場合は、そのカラムは降順で表示されます。
056 *       SQL構文における、orderby句に相当します。
057 * ・8:共通フラグ
058 *       この編集設定オブジェクトが、共通(全ユーザー公開)編集かどうかを
059 *       指定します。(0以外:共通 0:個人のみ)
060 *
061 * @og.rev 5.3.6.0 (2011/06/01) 新規追加
062 *
063 * @version  5.0
064 * @author   Hiroki Nakamura
065 * @since    JDK6.0,
066 */
067public class DBEditConfig {
068
069        private static final int EDIT_KEY_NAME          = 0;
070        private static final int EDIT_KEY_VIEW          = 1;
071        private static final int EDIT_KEY_SUM           = 2;
072        private static final int EDIT_KEY_GROUP         = 3;
073        private static final int EDIT_KEY_SUBTOTAL      = 4;
074        private static final int EDIT_KEY_TOTAL         = 5;
075        private static final int EDIT_KEY_GRANDTOTAL= 6;
076        private static final int EDIT_KEY_FIRSTTOTAL= 7;                // 6.1.1.0 (2015/01/17) FIRSTTOTAL 追加
077        private static final int EDIT_KEY_ORDERBY       = 8;
078        private static final int EDIT_KEY_COMMON        = 9;
079
080        private static final String[] EDIT_KEYS                 // 6.3.9.1 (2015/11/27) 修飾子を、なし → private に変更。キーに、"EDIT_" を最初から付けておきます。
081                = { "EDIT_NAME", "EDIT_VIEW", "EDIT_SUM", "EDIT_GROUP", "EDIT_SUBTOTAL", "EDIT_TOTAL", "EDIT_GRANDTOTAL", "EDIT_FIRSTTOTAL", "EDIT_ORDERBY", "EDIT_COMMON" };
082
083        private final String[] editVals = new String[EDIT_KEYS.length];         // 6.3.9.1 (2015/11/27) 再利用率が低いのと、コンパイラが何とかしてくれるでしょう。
084
085        private int sumClmCount;
086        private int groupClmCount;
087        private int subTotalClmCount;
088        private int totalClmCount;
089        /** 6.4.3.1 (2016/02/12) PMD refactoring. HashMap → ConcurrentHashMap に置き換え。  */
090        private final ConcurrentMap<String,String> orderMap = new ConcurrentHashMap<>();
091        private String orderByDescClms;
092
093        /**
094         * コンストラクタ
095         *
096         * 空の編集設定オブジェクトを構築します。
097         */
098        public DBEditConfig() { super(); }              // これも、自動的に呼ばれるが、空のメソッドを作成すると警告されるので、明示的にしておきます。
099
100        /**
101         * コンストラクタ
102         *
103         * 各種パラメーターを指定して編集設定オブジェクトを構築します。
104         *
105         * @og.rev 6.1.1.0 (2015/01/17) 総合計を最初の行に追加するかどうか(FirstTotal)の属性を追加
106         *
107         * @param editName 編集名称
108         * @param viewClms 画面表示カラム
109         * @param sumClms 集計カラム
110         * @param groupClms グループカラム
111         * @param subTotalClms 小計カラム
112         * @param totalClms 合計カラム
113         * @param useGrandTotal 総合計行を追加するか(1:追加する 1以外:追加しない)
114         * @param useFirstTotal 総合計行を追加するか(1:追加する 1以外:追加しない)
115         * @param orderByClms 表示順
116         * @param isCommon 共通編集かどうか(1:共通 1以外:個人のみ)
117         */
118        public DBEditConfig( final String editName, final String viewClms
119                                                , final String sumClms, final String groupClms
120                                                , final String subTotalClms, final String totalClms
121                                                , final String useGrandTotal, final String useFirstTotal
122                                                , final String orderByClms, final String isCommon ) {
123
124                editVals[EDIT_KEY_NAME]                 = editName;
125                editVals[EDIT_KEY_VIEW]                 = viewClms;
126                editVals[EDIT_KEY_SUM]                  = sumClms;
127                editVals[EDIT_KEY_GROUP]                = groupClms;
128                editVals[EDIT_KEY_SUBTOTAL]             = subTotalClms;
129                editVals[EDIT_KEY_TOTAL]                = totalClms;
130                editVals[EDIT_KEY_GRANDTOTAL]   = useGrandTotal;
131                editVals[EDIT_KEY_FIRSTTOTAL]   = useFirstTotal;        // 6.1.1.0 (2015/01/17)
132                editVals[EDIT_KEY_ORDERBY]              = orderByClms;
133                editVals[EDIT_KEY_COMMON]               = isCommon;
134
135                init();
136        }
137
138        /**
139         * コンストラクタ
140         *
141         * 各種パラメーターを配列で指定して編集設定オブジェクトを構築します。
142         * 各パラメータの配列インデックスは、{@link #getEditKeys(String,String)}で返される
143         * キー一覧の配列インデックスと一致します。
144         * 各パラメーターの意味については、クラスのJavadoc{@link DBEditConfig}を参照して下さい。
145         *
146         * @param editVals 設定値(配列)
147         */
148        public DBEditConfig( final String[] editVals ) {
149                System.arraycopy( editVals, 0, this.editVals, 0, editVals.length );
150                init();
151        }
152
153        /**
154         * 編集設定オブジェクト作成時の初期化処理です。
155         * コンストラクタの引数に基づき内部変数の初期設定を行います。
156         */
157        private void init() {
158                sumClmCount             = StringUtil.csv2Array( editVals[EDIT_KEY_SUM]          ).length;
159                groupClmCount   = StringUtil.csv2Array( editVals[EDIT_KEY_GROUP]        ).length;
160                subTotalClmCount= StringUtil.csv2Array( editVals[EDIT_KEY_SUBTOTAL]     ).length;
161                totalClmCount   = StringUtil.csv2Array( editVals[EDIT_KEY_TOTAL]        ).length;
162
163                // 6.4.1.1 (2016/01/16) PMD refactoring. Avoid if (x != y) ..; else ..;
164                if( editVals[EDIT_KEY_ORDERBY] == null ) {
165                        orderByDescClms = null;
166                }
167                else {
168                        final StringBuilder buf = new StringBuilder( BUFFER_MIDDLE );
169                        final String[] ary = StringUtil.csv2Array( editVals[EDIT_KEY_ORDERBY] );
170                        for( int i=0; i<ary.length ;i++ ) {
171                                String str = ary[i];
172                                if( StringUtil.startsChar( str , '!' ) ) {                              // 6.2.0.0 (2015/02/27) 1文字 String.startsWith
173                                        str = str.substring( 1 );
174                                        if( buf.length() > 0 ) { buf.append( ',' ); }           // 6.0.2.5 (2014/10/31) char を append する。
175                                        buf.append( str );
176                                }
177                                orderMap.put( str, String.valueOf( i+1 ) );
178                        }
179                        orderByDescClms = buf.toString();
180                }
181        }
182
183        /**
184         * 画面ID、編集名をキーに、編集設定オブジェクトの各設定値の管理キーを指定します。
185         *
186         * 編集設定オブジェクトで管理される各キーに対して、
187         * "EDIT_[KEY]_(画面ID)_(編集名)"というキーを生成し、これを配列にして返します。
188         *
189         * @og.rev 6.0.2.2 (2014/10/03) 新規追加。DBEditConfig から、移動
190         * @og.rev 6.3.9.1 (2015/11/27) DBEditConfigManager から、移動。
191         *
192         * @param guikey 画面ID
193         * @param editName 編集名
194         *
195         * @return 編集設定を管理するためのキー一覧
196         */
197        public static String[] getEditKeys( final String guikey, final String editName ) {
198                final String[] rtn = new String[EDIT_KEYS.length];
199                final String keyNm = "_" + guikey + "_" + editName;
200
201                for( int i=0; i<EDIT_KEYS.length; i++ ) {
202                        rtn[i] = EDIT_KEYS[i] + keyNm;
203                }
204                return rtn;
205        }
206
207        /**
208         * 編集設定オブジェクトの各設定値を配列にして返します。
209         *
210         * 配列のインデックス番号は、{@link #getEditKeys(String,String)}で生成されるキーの
211         * インデックス番号と一致します。
212         *
213         * @return 編集設定オブジェクトの設定値一覧(配列)
214         */
215        public String[] getEditVals() {
216                final String[] rtn = new String[editVals.length];
217                System.arraycopy( editVals, 0, rtn, 0, editVals.length );
218                return rtn;
219        }
220
221        /**
222         * 編集名を返します。
223         *
224         * @return 編集名
225         */
226        public String getEditName() {
227                return editVals[EDIT_KEY_NAME];
228        }
229
230        /**
231         * 表示カラム名の一覧をCSV形式で返します。
232         * 非表示カラムについては、カラム名の先頭に"!"をつけて返されます。
233         * 例) AAA,!BBB,CCC ⇒ AAA,CCCの順に表示(BBBは非表示)
234         *
235         * @return 表示カラム名一覧(CSV形式)
236         */
237        public String getViewClms() {
238                return editVals[EDIT_KEY_VIEW];
239        }
240
241        /**
242         * 表示カラム(CSV形式)をチェックし、変更があれば、反映したカラムを作成します。
243         *
244         * 表示カラムは、並び順や非表示マーカー(!)などが加味され、ユーザー、画面ごとに
245         * データベースに記録されています。JSPソースを修正した場合、データベースに
246         * 書き込まれた表示カラムは、反映されないため、カラム選択画面等に表示されません。
247         * そこで、オリジナルのカラムに追加された場合は、カラムを比較することで、
248         * 追加分のカラムを、非表示カラムとして、後ろに追記します。
249         * 削除された場合は、ViewForm で警告表示することで、ユーザーに変更を促します。
250         *
251         * @og.rev 6.0.2.4 (2014/10/17) JSP修正時の追加カラム対応
252         * @og.rev 5.9.32.0 (2018/05/02) spritView使用時の対応
253         *
254         * @param       orgClms         オリジナルのカラム(CSV形式)
255         *
256         * @return      変更後の表示カラム(CSV形式)
257         */
258        public String getViewClms( final String orgClms ) {
259                String viewClms = editVals[EDIT_KEY_VIEW];
260
261                if( orgClms == null || orgClms.isEmpty() ) { return viewClms; }         // orgClms がなければ、viewClms を返す。
262                // 基本的には、両者のカラムは、一致するはず。
263//              final String[] vclms = viewClms.split( "," );           // 表示順、非表示処理を行ったカラム
264                final Pattern pattern1 = Pattern.compile("[,|]");       // spritView使用を考慮して、「 , or | 」で分割します。 5.9.32.0 ADD
265                final String[] vclms = pattern1.split(viewClms);
266//              final String[] fclms = orgClms.split( "," );            // 元々の表示可能カラムすべて(fullClms)
267                final String[] fclms = vclms.clone();                                           // spritView使用時は未固定の列情報のみ渡されるため、vclmsの値から取得するように変更。5.9.32.0 ADD
268                for(int i=0; i<fclms.length; i++) {
269                        fclms[i] = fclms[i].charAt(0) == '!' ? fclms[i].substring(1) : fclms[i]; // 非表示の(!)は削除します。
270                }
271
272                // 表示可能カラムすべての Set を作成します。
273                final Set<String> fset = new HashSet<>();
274                for( int i=0; i<fclms.length; i++ ) {           // orgClms をSet に追加します。
275                        fset.add( fclms[i] );
276                }
277
278                // 非表示カラムの内、表示可能カラムに存在しない分だけの Set を作成します。       
279                // また、表示可能カラムから、順番に、viewClms の値を削除していきます。
280                final Set<String>   vset = new HashSet<>();
281                final StringBuilder vbuf = new StringBuilder( BUFFER_MIDDLE );  // 新しい viewClms 作成用
282                for( int i=0; i<vclms.length; i++ ) {           // viewClms をSet に追加します。
283                        String clm = vclms[i];
284                        if( clm == null || clm.isEmpty() ) { continue; }                        // 6.0.2.5 (2014/10/31) 潜在バグ? 先頭に"," が来るとアベンドする。
285                        clm = clm.charAt(0) == '!' ? clm.substring(1) : clm ;           // 非表示の (!) は削除します。
286                        if( fset.remove( clm ) ) {                              // fullSet にあれば、削除するとともに、新viewClmsを作成する。
287                                if( vbuf.length() > 0 ) { vbuf.append(','); }                   // 最初以降は、カンマで連結する。              // 6.0.2.5 (2014/10/31) char を append する。
288                                vbuf.append( vclms[i] );                        // append するのは、(!) 付のカラム
289                        }
290                        else {
291                                vset.add( clm );                                        // fullSet になければ、viewSet に追加
292                        }
293                }
294
295                // この段階で、fset、vset ともに、それぞれ独自のカラムが残っている。
296                // どちらも、残っていなければ、正常なので、viewClms を返す。
297                if( vset.isEmpty() && fset.isEmpty() ) { return viewClms; }
298
299                // fullSet にカラムが残っていれば、非表示で、新viewClmsに、追加する。
300                if( !fset.isEmpty() ) {
301                        final String[] defClms = fset.toArray( new String[fset.size()] );
302                        for( int i=0; i<defClms.length; i++ ) {
303                                if( vbuf.length() > 0 ) { vbuf.append(','); }   // 6.0.2.5 (2014/10/31) 最初以降は、カンマで連結する。
304                                vbuf.append('!').append( defClms[i] );                                          // 非表示カラムとして、後ろに追加する。
305                        }
306                }
307                viewClms = vbuf.toString();
308
309                editVals[EDIT_KEY_VIEW] = viewClms;
310                return viewClms;
311        }
312
313        /**
314         * 集計カラムの一覧をCSV形式で返します。
315         *
316         * @return 集計カラムの一覧(CSV形式)
317         */
318        public String getSumClms() {
319                return editVals[EDIT_KEY_SUM];
320        }
321
322        /**
323         * 集計処理を行うかどうかを返します。
324         * これは、集計カラムが指定されているか、と同じ意味です。
325         *
326         * @return true:対象 false:非対象
327         */
328        public boolean useSum() {
329                return editVals[EDIT_KEY_SUM] != null && editVals[EDIT_KEY_SUM].length() > 0 ;
330        }
331
332        /**
333         * 指定されたカラムが集計対象のカラムかどうかを返します。
334         *
335         * @param clm カラム
336         *
337         * @return true:対象 false:非対象
338         */
339        public boolean isSumClm( final String clm ) {
340                // 6.4.1.1 (2016/01/16) PMD refactoring. A method should have only one exit point, and that should be the last statement in the method
341                // 条件反転注意
342                return clm != null && editVals[EDIT_KEY_SUM] != null && ( ","+editVals[EDIT_KEY_SUM]+"," ).indexOf( ","+clm+"," ) >= 0 ;
343        }
344
345        /**
346         * 集計カラムのカラム数を返します。
347         *
348         * @return 集計カラムのカラム数
349         */
350        public int getSumClmCount() {
351                return sumClmCount;
352        }
353
354        /**
355         * グループカラムの一覧をCSV形式で返します。
356         *
357         * @return グループカラムの一覧(CSV形式)
358         */
359        public String getGroupClms() {
360                return editVals[EDIT_KEY_GROUP];
361        }
362
363        /**
364         * グループ処理を行うかどうかを返します。
365         * これは、グループカラムが指定されているか、と同じ意味です。
366         *
367         * @return true:対象 false:非対象
368         */
369        public boolean useGroup() {
370                return editVals[EDIT_KEY_GROUP] != null && editVals[EDIT_KEY_GROUP].length() > 0 ;
371        }
372
373        /**
374         * 指定されたカラムがグループ対象のカラムかどうかを返します。
375         *
376         * @param clm カラム
377         *
378         * @return true:対象 false:非対象
379         */
380        public boolean isGroupClm( final String clm ) {
381                // 6.4.1.1 (2016/01/16) PMD refactoring. A method should have only one exit point, and that should be the last statement in the method
382                // 条件反転注意
383                return clm != null && editVals[EDIT_KEY_GROUP] != null && ( ","+editVals[EDIT_KEY_GROUP]+"," ).indexOf( ","+clm+"," ) >= 0 ;
384        }
385
386        /**
387         * グループカラムのカラム数を返します。
388         *
389         * @return グループカラムのカラム数
390         */
391        public int getGroupClmCount() {
392                return groupClmCount;
393        }
394
395        /**
396         * 小計カラムの一覧をCSV形式で返します。
397         *
398         * @return 小計カラムの一覧(CSV形式)
399         */
400        public String getSubTotalClms() {
401                return editVals[EDIT_KEY_SUBTOTAL];
402        }
403
404        /**
405         * 小計処理を行うかどうかを返します。
406         * これは、小計カラムが指定されているか、と同じ意味です。
407         *
408         * @return true:対象 false:非対象
409         */
410        public boolean useSubTotal() {
411                return editVals[EDIT_KEY_SUBTOTAL] != null && editVals[EDIT_KEY_SUBTOTAL].length() > 0 ;
412        }
413
414        /**
415         * 指定されたカラムが小計対象のカラムかどうかを返します。
416         *
417         * @param clm カラム
418         *
419         * @return true:対象 false:非対象
420         */
421        public boolean isSubTotalClm( final String clm ) {
422                // 6.4.1.1 (2016/01/16) PMD refactoring. A method should have only one exit point, and that should be the last statement in the method
423                // 条件反転注意
424                return clm != null && editVals[EDIT_KEY_SUBTOTAL] != null && ( ","+editVals[EDIT_KEY_SUBTOTAL]+"," ).indexOf( ","+clm+"," ) >= 0 ;
425        }
426
427        /**
428         * 小計カラムのカラム数を返します。
429         *
430         * @return グループカラムのカラム数
431         */
432        public int getSubTotalClmCount() {
433                return subTotalClmCount;
434        }
435
436        /**
437         * 合計カラムの一覧をCSV形式で返します。
438         *
439         * @return 合計カラムの一覧(CSV形式)
440         */
441        public String getTotalClms() {
442                return editVals[EDIT_KEY_TOTAL];
443        }
444
445        /**
446         * 合計処理を行うかどうかを返します。
447         * これは、合計カラムが指定されているか、と同じ意味です。
448         *
449         * @return true:対象 false:非対象
450         */
451        public boolean useTotal() {
452                return editVals[EDIT_KEY_TOTAL] != null && editVals[EDIT_KEY_TOTAL].length() > 0 ;
453        }
454
455        /**
456         * 指定されたカラムが合計対象のカラムかどうかを返します。
457         *
458         * @param clm カラム
459         *
460         * @return true:対象 false:非対象
461         */
462        public boolean isTotalClm( final String clm ) {
463                // 6.4.1.1 (2016/01/16) PMD refactoring. A method should have only one exit point, and that should be the last statement in the method
464                // 条件反転注意
465                return clm != null && editVals[EDIT_KEY_TOTAL] != null && ( ","+editVals[EDIT_KEY_TOTAL]+"," ).indexOf( ","+clm+"," ) >= 0 ;
466        }
467
468        /**
469         * 合計カラムのカラム数を返します。
470         *
471         * @return グループカラムのカラム数
472         */
473        public int getTotalClmCount() {
474                return totalClmCount;
475        }
476
477        /**
478         * 総合計行を付加するかどうかを返します。
479         *
480         * @return true:対象 false:非対象
481         */
482        public boolean useGrandTotal() {
483                return StringUtil.nval( editVals[EDIT_KEY_GRANDTOTAL], false );
484        }
485
486        /**
487         * 総合計を最初の行に追加するかどうかを返します。
488         *
489         * @og.rev 6.1.1.0 (2015/01/17) 総合計を最初の行に追加するかどうか(FirstTotal)の属性を追加
490         *
491         * @return true:対象 false:非対象
492         */
493        public boolean useFirstTotal() {
494                return StringUtil.nval( editVals[EDIT_KEY_FIRSTTOTAL], false );
495        }
496
497        /**
498         * 表示順カラムをCSV形式で返します。
499         * カラムの並び順が表示順としての優先順になります。
500         * また、降順で表示するカラムについては、カラム名の先頭に"!"が付加されます。
501         *
502         * @return 標準順カラムの一覧(CSV形式)
503         */
504        public String getOrderByClms() {
505                return editVals[EDIT_KEY_ORDERBY];
506        }
507
508        /**
509         * 指定されたカラムの表示順の優先番号を返します。
510         * 指定カラムが標準として指定されていない場合は、""(ゼロストリング)を返します。
511         *
512         * @og.rev 6.4.3.1 (2016/02/12) PMD refactoring. HashMap → ConcurrentHashMap に置き換え。
513         *
514         * @param clm カラム
515         *
516         * @return 表示順の優先番号
517         * @og.rtnNotNull
518         */
519        public String getOrder( final String clm ) {
520                // ConcurrentMap#getOrDefault(Object,V) を使用して、Map の値が null のときの初期値を返します。
521                return clm == null || editVals[EDIT_KEY_ORDERBY] == null
522                                        ? ""
523                                        : orderMap.getOrDefault( clm , "" );
524        }
525
526        /**
527         * 指定されたカラムの表示順指定が降順であるかどうかを返します。
528         * 標準と指定されていない場合は、falseを返します。
529         *
530         * @param clm カラム
531         *
532         * @return true:降順 false:昇順
533         */
534        public boolean isOrderByDesc( final String clm ) {
535                // 6.4.1.1 (2016/01/16) PMD refactoring. A method should have only one exit point, and that should be the last statement in the method
536                // 条件反転注意
537                return clm != null && orderByDescClms != null && ( ","+orderByDescClms+"," ).indexOf( ","+clm+"," ) >= 0 ;
538        }
539
540        /**
541         * 並び替え処理を行うかどうかを返します。
542         * これは、表示順カラムが指定されているか、と同じ意味です。
543         *
544         * @return true:対象 false:非対象
545         */
546        public boolean useOrderBy() {
547                return editVals[EDIT_KEY_ORDERBY] != null && editVals[EDIT_KEY_ORDERBY].length() > 0 ;
548        }
549
550        /**
551         * この編集設定オブジェクトが、共通(全ユーザー公開)編集か
552         * どうかを返します。
553         *
554         * @return 0以外:共通 0:個人のみ
555         */
556        public boolean isCommon() {
557                return StringUtil.nval( editVals[EDIT_KEY_COMMON], false );
558        }
559
560        /**
561         * 画面IDに対応した、内部のキーと値の各要素に対して指定されたアクションを実行します。
562         *
563         * getEditKeys(String,String) で得られるキーの文字列配列と、getEditVals()で得られる値の文字列配列
564         * を、順次、action メソッドに渡していきます。
565         * キーの文字列配列の作成時の編集名は、このオブジェクトの編集名を使用します。
566         *
567         * @og.rev 6.4.5.0 (2016/04/08) UserInfo のEditConfig関連機能を、DBEditConfigManagerに移植します。新規追加
568         *
569         * @param guikey 画面ID
570         * @param action 各要素に対して実行される関数型インタフェース( editKey、editVal )
571         */
572        public void forEach( final String guikey, final BiConsumer<String ,String> action ) {
573                final String keyNm = "_" + guikey + "_" + editVals[EDIT_KEY_NAME];
574
575                for( int i=0; i<EDIT_KEYS.length; i++ ) {
576                        action.accept( EDIT_KEYS[i] + keyNm , editVals[i] );
577                }
578        }
579}