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 集計カラムの一覧(カンマ区切)
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         *
349         * @return 集計カラムのカラム数
350         */
351        public int getSumClmCount() {
352                return sumClmCount;
353        }
354
355        /**
356         * グループカラムの一覧をCSV形式で返します。
357         *
358         * @return グループカラムの一覧(カンマ区切)
359         */
360        public String getGroupClms() {
361                return editVals[EDIT_KEY_GROUP];
362        }
363
364        /**
365         * グループ処理を行うかどうかを返します。
366         * これは、グループカラムが指定されているか、と同じ意味です。
367         *
368         * @return true:対象 false:非対象
369         */
370        public boolean useGroup() {
371                return editVals[EDIT_KEY_GROUP] != null && editVals[EDIT_KEY_GROUP].length() > 0 ;
372        }
373
374        /**
375         * 指定されたカラムがグループ対象のカラムかどうかを返します。
376         *
377         * @param clm カラム
378         *
379         * @return true:対象 false:非対象
380         */
381        public boolean isGroupClm( final String clm ) {
382                // 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
383                // 条件反転注意
384                return clm != null && editVals[EDIT_KEY_GROUP] != null && ( ","+editVals[EDIT_KEY_GROUP]+"," ).indexOf( ","+clm+"," ) >= 0 ;
385
386        }
387
388        /**
389         * グループカラムのカラム数を返します。
390         *
391         * @return グループカラムのカラム数
392         */
393        public int getGroupClmCount() {
394                return groupClmCount;
395        }
396
397        /**
398         * 小計カラムの一覧をCSV形式で返します。
399         *
400         * @return 小計カラムの一覧(カンマ区切)
401         */
402        public String getSubTotalClms() {
403                return editVals[EDIT_KEY_SUBTOTAL];
404        }
405
406        /**
407         * 小計処理を行うかどうかを返します。
408         * これは、小計カラムが指定されているか、と同じ意味です。
409         *
410         * @return true:対象 false:非対象
411         */
412        public boolean useSubTotal() {
413                return editVals[EDIT_KEY_SUBTOTAL] != null && editVals[EDIT_KEY_SUBTOTAL].length() > 0 ;
414        }
415
416        /**
417         * 指定されたカラムが小計対象のカラムかどうかを返します。
418         *
419         * @param clm カラム
420         *
421         * @return true:対象 false:非対象
422         */
423        public boolean isSubTotalClm( final String clm ) {
424                // 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
425                // 条件反転注意
426                return clm != null && editVals[EDIT_KEY_SUBTOTAL] != null && ( ","+editVals[EDIT_KEY_SUBTOTAL]+"," ).indexOf( ","+clm+"," ) >= 0 ;
427
428        }
429
430        /**
431         * 小計カラムのカラム数を返します。
432         *
433         * @return グループカラムのカラム数
434         */
435        public int getSubTotalClmCount() {
436                return subTotalClmCount;
437        }
438
439        /**
440         * 合計カラムの一覧をCSV形式で返します。
441         *
442         * @return 合計カラムの一覧(カンマ区切)
443         */
444        public String getTotalClms() {
445                return editVals[EDIT_KEY_TOTAL];
446        }
447
448        /**
449         * 合計処理を行うかどうかを返します。
450         * これは、合計カラムが指定されているか、と同じ意味です。
451         *
452         * @return true:対象 false:非対象
453         */
454        public boolean useTotal() {
455                return editVals[EDIT_KEY_TOTAL] != null && editVals[EDIT_KEY_TOTAL].length() > 0 ;
456        }
457
458        /**
459         * 指定されたカラムが合計対象のカラムかどうかを返します。
460         *
461         * @param clm カラム
462         *
463         * @return true:対象 false:非対象
464         */
465        public boolean isTotalClm( final String clm ) {
466                // 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
467                // 条件反転注意
468                return clm != null && editVals[EDIT_KEY_TOTAL] != null && ( ","+editVals[EDIT_KEY_TOTAL]+"," ).indexOf( ","+clm+"," ) >= 0 ;
469
470        }
471
472        /**
473         * 合計カラムのカラム数を返します。
474         *
475         * @return グループカラムのカラム数
476         */
477        public int getTotalClmCount() {
478                return totalClmCount;
479        }
480
481        /**
482         * 総合計行を付加するかどうかを返します。
483         *
484         * @return true:対象 false:非対象
485         */
486        public boolean useGrandTotal() {
487                return StringUtil.nval( editVals[EDIT_KEY_GRANDTOTAL], false );
488        }
489
490        /**
491         * 総合計を最初の行に追加するかどうかを返します。
492         *
493         * @og.rev 6.1.1.0 (2015/01/17) 総合計を最初の行に追加するかどうか(FirstTotal)の属性を追加
494         *
495         * @return true:対象 false:非対象
496         */
497        public boolean useFirstTotal() {
498                return StringUtil.nval( editVals[EDIT_KEY_FIRSTTOTAL], false );
499        }
500
501        /**
502         * 表示順カラムをCSV形式で返します。
503         * カラムの並び順が表示順としての優先順になります。
504         * また、降順で表示するカラムについては、カラム名の先頭に"!"が付加されます。
505         *
506         * @return 標準順カラムの一覧(カンマ区切)
507         */
508        public String getOrderByClms() {
509                return editVals[EDIT_KEY_ORDERBY];
510        }
511
512        /**
513         * 指定されたカラムの表示順の優先番号を返します。
514         * 指定カラムが標準として指定されていない場合は、""(ゼロストリング)を返します。
515         *
516         * @og.rev 6.4.3.1 (2016/02/12) PMD refactoring. HashMap → ConcurrentHashMap に置き換え。
517         *
518         * @param clm カラム
519         *
520         * @return 表示順の優先番号
521         * @og.rtnNotNull
522         */
523        public String getOrder( final String clm ) {
524                // ConcurrentMap#getOrDefault(Object,V) を使用して、Map の値が null のときの初期値を返します。
525                return clm == null || editVals[EDIT_KEY_ORDERBY] == null
526                                        ? ""
527                                        : orderMap.getOrDefault( clm , "" );
528
529        }
530
531        /**
532         * 指定されたカラムの表示順指定が降順であるかどうかを返します。
533         * 標準と指定されていない場合は、falseを返します。
534         *
535         * @param clm カラム
536         *
537         * @return true:降順 false:昇順
538         */
539        public boolean isOrderByDesc( final String clm ) {
540                // 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
541                // 条件反転注意
542                return clm != null && orderByDescClms != null && ( ","+orderByDescClms+"," ).indexOf( ","+clm+"," ) >= 0 ;
543
544        }
545
546        /**
547         * 並び替え処理を行うかどうかを返します。
548         * これは、表示順カラムが指定されているか、と同じ意味です。
549         *
550         * @return true:対象 false:非対象
551         */
552        public boolean useOrderBy() {
553                return editVals[EDIT_KEY_ORDERBY] != null && editVals[EDIT_KEY_ORDERBY].length() > 0 ;
554        }
555
556        /**
557         * この編集設定オブジェクトが、共通(全ユーザー公開)編集か
558         * どうかを返します。
559         *
560         * @return 0以外:共通 0:個人のみ
561         */
562        public boolean isCommon() {
563                return StringUtil.nval( editVals[EDIT_KEY_COMMON], false );
564        }
565
566        /**
567         * 画面IDに対応した、内部のキーと値の各要素に対して指定されたアクションを実行します。
568         *
569         * getEditKeys(String,String) で得られるキーの文字列配列と、getEditVals()で得られる値の文字列配列
570         * を、順次、action メソッドに渡していきます。
571         * キーの文字列配列の作成時の編集名は、このオブジェクトの編集名を使用します。
572         *
573         * @og.rev 6.4.5.0 (2016/04/08) UserInfo のEditConfig関連機能を、DBEditConfigManagerに移植します。新規追加
574         *
575         * @param guikey 画面ID
576         * @param action 各要素に対して実行される関数型インタフェース( editKey、editVal )
577         */
578        public void forEach( final String guikey, final BiConsumer<String ,String> action ) {
579                final String keyNm = "_" + guikey + "_" + editVals[EDIT_KEY_NAME];
580
581                for( int i=0; i<EDIT_KEYS.length; i++ ) {
582                        action.accept( EDIT_KEYS[i] + keyNm , editVals[i] );
583                }
584        }
585}