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 java.util.HashMap;
019    import java.util.HashSet;
020    import java.util.Map;
021    import java.util.Set;
022    
023    import org.opengion.fukurou.util.StringUtil;
024    
025    /**
026     * エãƒ?‚£ãƒ?ƒˆè¨­å®šæƒ…報を管ç?™ã‚‹ãŸã‚ã?ãƒ??タ管ç?‚¯ãƒ©ã‚¹ã§ã™ã?
027     * ã“ã“ã§ç®¡ç?•れるå?ƒ‘ãƒ©ãƒ¡ãƒ¼ã‚¿ãƒ¼ã®æ„味ã¯ä»¥ä¸‹ã?通りã§ã™ã?
028     * (å?‚¤ãƒ³ãƒ?ƒƒã‚¯ã‚¹ç•ªå·ã¯ã€å?部çš?«ç®¡ç?•れã¦ã?‚‹ã‚¤ãƒ³ãƒ?ƒƒã‚¯ã‚¹ç•ªå·ã‚’æ„味ã—ã¾ã?
029     *
030     * ・0:エãƒ?‚£ãƒ?ƒˆå?
031     *       ã“ã?エãƒ?‚£ãƒ?ƒˆè¨­å®šã‚ªãƒ–ジェクトã?åç§°ã§ã™ã?
032     * ・1:表示カラ�
033     *       表示対象ã¨ãªã‚‹ã‚«ãƒ©ãƒ?¸?¦§ã§ã™ã?カンマ区åˆ?‚Šã§æŒ?®šã—ã¾ã™ã?
034     *       ã“ã?ä¸?¦§ã«ã¯ã€?žè¡¨ç¤ºã®ã‚«ãƒ©ãƒ?‚‚åˆã‚ã›ã¦ç®¡ç?•れã?éžè¡¨ç¤ºã‚«ãƒ©ãƒ?«ã¤ã?¦ã¯ã€?
035     *       カラãƒ?ã®å…ˆé?ã«"!"ã‚’ã¤ã‘ã¾ã™ã?
036     *       ä¾? AAA,!BBB,CCC -> AAA,CCCã®é ?«è¡¨ç¤º(BBBã¯éžè¡¨ç¤º)
037     * ・2:é›?¨ˆã‚«ãƒ©ãƒ?
038     *       å??ã‚’SUMã™ã‚‹å¯¾è±¡ã¨ãªã‚‹ã‚«ãƒ©ãƒ?§ã™ã?(カンマ区åˆ?‚Šã§è¤?•°æŒ?®šãŒå¯èƒ½)
039     *       ã“ã“ã§æŒ?®šã•れãŸã‚«ãƒ©ãƒ??数値型ã§ã‚ã‚‹å¿?¦ãŒã‚りã¾ã™ã?
040     *       SQLæ§‹æ–‡ã«ãŠã‘ã‚‹ã?SUM関数ã®å¼•æ•°ã¨ã—ã¦æŒ?®šã™ã‚‹ã‚«ãƒ©ãƒ?«ç›¸å½“ã—ã¾ã™ã?
041     * ・3:グループカラ�
042     *       é›?¨ˆã‚«ãƒ©ãƒ??å??をグルーピングã™ã‚‹ãŸã‚ã®ã‚«ãƒ©ãƒ?§ã™ã?(カンマ区åˆ?‚Šã§è¤?•°æŒ?®šãŒå¯èƒ½)
043     *       SQLæ§‹æ–‡ã«ãŠã‘ã‚‹ã?GROUP BYã«æŒ?®šã™ã‚‹ã‚«ãƒ©ãƒ?«ç›¸å½“ã—ã¾ã™ã?
044     * ・4:å°è¨ˆã‚«ãƒ©ãƒ?
045     *       é›?¨ˆã‚«ãƒ©ãƒ??å??ã«å¯¾ã—ã?å°è¨ˆè¡Œã‚’付加ã™ã‚‹ãŸã‚ã®ãƒ–レイクキーを指定ã—ã¾ã™ã?(カンマ区åˆ?‚Šã§è¤?•°æŒ?®šãŒå¯èƒ½)
046     * ・5:åˆè¨ˆã‚«ãƒ©ãƒ?
047     *       é›?¨ˆã‚«ãƒ©ãƒ??å??ã«å¯¾ã—ã?åˆè¨ˆè¡Œã‚’付加ã™ã‚‹ãŸã‚ã®ãƒ–レイクキーを指定ã—ã¾ã™ã?(カンマ区åˆ?‚Šã§è¤?•°æŒ?®šãŒå¯èƒ½)
048     * ・6:ç·åˆè¨ˆãƒ•ラグ
049     *       é›?¨ˆã‚«ãƒ©ãƒ??å??ã«å¯¾ã—ã?ç·åˆè¨ˆè¡Œã‚’付加ã™ã‚‹ã‹ã©ã?‹ã‚’指定ã—ã¾ã™ã?(0以å¤?追åŠ?™ã‚?0:追åŠ?—ãªã?
050     * ・7:表示é ?‚«ãƒ©ãƒ?
051     *       ãƒ??ã‚¿ã®è¡¨ç¤ºé ?‚’ãã?é ?•ªã«ã‚«ãƒ³ãƒžåŒºåˆ?‚Šã§æŒ?®šã—ã¾ã™ã?
052     *       カラãƒ?ã®å…ˆé?ã«"!"ã‚’ã¤ã‘ãŸå ´åˆã?ã€ãã®ã‚«ãƒ©ãƒ??é™é?ã§è¡¨ç¤ºã•れã¾ã™ã?
053     *       SQLæ§‹æ–‡ã«ãŠã‘ã‚‹ã?orderbyå¥ã«ç›¸å½“ã—ã¾ã™ã?
054     * ・8:共通フラグ
055     *       ã“ã?エãƒ?‚£ãƒ?ƒˆè¨­å®šã‚ªãƒ–ジェクトãŒã€å?é€?全ユーザー公é–?エãƒ?‚£ãƒ?ƒˆã‹ã©ã?‹ã‚?
056     *       æŒ?®šã—ã¾ã™ã?(0以å¤?å…±é€?0:個人ã®ã¿)
057     *
058     * @og.rev 5.3.6.0 (2011/06/01) æ–°è¦è¿½åŠ?
059     *
060     * @version  5.0
061     * @author   Hiroki Nakamura
062     * @since    JDK6.0,
063     */
064    public class DBEditConfig {
065    
066            private static final int EDIT_KEY_NAME          = 0;
067            private static final int EDIT_KEY_VIEW          = 1;
068            private static final int EDIT_KEY_SUM           = 2;
069            private static final int EDIT_KEY_GROUP         = 3;
070            private static final int EDIT_KEY_SUBTOTAL      = 4;
071            private static final int EDIT_KEY_TOTAL         = 5;
072            private static final int EDIT_KEY_GRANDTOTAL= 6;
073            private static final int EDIT_KEY_ORDERBY       = 7;
074            private static final int EDIT_KEY_COMMON        = 8;
075    
076            private static final String[] EDIT_KEYS
077                    = { "NAME", "VIEW", "SUM", "GROUP", "SUBTOTAL", "TOTAL", "GRANDTOTAL", "ORDERBY", "COMMON" };
078    
079            private static final int EDIT_KEYS_LENGTH       = EDIT_KEYS.length;
080    
081            private final String[] editVals = new String[EDIT_KEYS_LENGTH];
082    
083            private int sumClmCount;
084            private int groupClmCount;
085            private int subTotalClmCount;
086            private int totalClmCount;
087            private final Map<String,String> orderMap = new HashMap<String,String>();
088            private String orderByDescClms;
089    
090            /**
091             * コンストラクタ
092             *
093             * 空ã®ã‚¨ãƒ?‚£ãƒ?ƒˆè¨­å®šã‚ªãƒ–ジェクトを構築ã—ã¾ã™ã?
094             */
095            public DBEditConfig() {
096            }
097    
098            /**
099             * コンストラクタ
100             *
101             * å?¨®ãƒ‘ラメーターを指定ã—ã¦ã‚¨ãƒ?‚£ãƒ?ƒˆè¨­å®šã‚ªãƒ–ジェクトを構築ã—ã¾ã™ã?
102             *
103             * @param editName エãƒ?‚£ãƒ?ƒˆåç§°
104             * @param viewClms ç”»é¢è¡¨ç¤ºã‚«ãƒ©ãƒ?
105             * @param sumClms é›?¨ˆã‚«ãƒ©ãƒ?
106             * @param groupClms グループカラ�
107             * @param subTotalClms å°è¨ˆã‚«ãƒ©ãƒ?
108             * @param totalClms åˆè¨ˆã‚«ãƒ©ãƒ?
109             * @param useGrandTotal ç·åˆè¨ˆè¡Œã‚’追åŠ?™ã‚‹ã‹(1:追åŠ?™ã‚?1以å¤?追åŠ?—ãªã?
110             * @param orderByClms 表示�
111             * @param isCommon 共通エãƒ?‚£ãƒ?ƒˆã‹ã©ã?‹(1:å…±é€?1以å¤?個人ã®ã¿)
112             */
113            public DBEditConfig( final String editName, final String viewClms
114                                                    , final String sumClms, final String groupClms
115                                                    , final String subTotalClms, final String totalClms
116                                                    , final String useGrandTotal, final String orderByClms
117                                                    , final String isCommon ) {
118    
119                    editVals[EDIT_KEY_NAME]                 = editName;
120                    editVals[EDIT_KEY_VIEW]                 = viewClms;
121                    editVals[EDIT_KEY_SUM]                  = sumClms;
122                    editVals[EDIT_KEY_GROUP]                = groupClms;
123                    editVals[EDIT_KEY_SUBTOTAL]             = subTotalClms;
124                    editVals[EDIT_KEY_TOTAL]                = totalClms;
125                    editVals[EDIT_KEY_GRANDTOTAL]   = useGrandTotal;
126                    editVals[EDIT_KEY_ORDERBY]              = orderByClms;
127                    editVals[EDIT_KEY_COMMON]               = isCommon;
128    
129                    init();
130            }
131    
132            /**
133             * コンストラクタ
134             *
135             * å?¨®ãƒ‘ラメーターをé?åˆ—ã§æŒ?®šã—ã¦ã‚¨ãƒ?‚£ãƒ?ƒˆè¨­å®šã‚ªãƒ–ジェクトを構築ã—ã¾ã™ã?
136             * å?ƒ‘ラメータã®é…å?インãƒ?ƒƒã‚¯ã‚¹ã¯ã€{@link #getEditKeys(String,String)}ã§è¿”ã•れる
137             * キーä¸?¦§ã®é…å?インãƒ?ƒƒã‚¯ã‚¹ã¨ä¸??ã—ã¾ã™ã?
138             * å?ƒ‘ãƒ©ãƒ¡ãƒ¼ã‚¿ãƒ¼ã®æ„味ã«ã¤ã?¦ã¯ã€ã‚¯ãƒ©ã‚¹ã®Javadoc{@link DBEditConfig}ã‚’å‚ç…§ã—ã¦ä¸‹ã•ã??
139             *
140             * @param editVals 設定å?(é…å?)
141             * @see DBEditConfig
142             * @see #getEditKeys(String,String)
143             **/
144            public DBEditConfig( final String[] editVals ) {
145                    System.arraycopy( editVals, 0, this.editVals, 0, editVals.length );
146                    init();
147            }
148    
149            /**
150             * エãƒ?‚£ãƒ?ƒˆè¨­å®šã‚ªãƒ–ジェクト作æ?時ã?åˆæœŸåŒ–å?ç?§ã™ã?
151             * コンストラクタã®å¼•æ•°ã«åŸºã¥ãå?部変数ã®åˆæœŸè¨­å®šã‚’行ã„ã¾ã™ã?
152             */
153            private void init() {
154                    sumClmCount = StringUtil.csv2Array( editVals[EDIT_KEY_SUM] ).length;
155                    groupClmCount = StringUtil.csv2Array( editVals[EDIT_KEY_GROUP] ).length;
156                    subTotalClmCount = StringUtil.csv2Array( editVals[EDIT_KEY_SUBTOTAL] ).length;
157                    totalClmCount = StringUtil.csv2Array( editVals[EDIT_KEY_TOTAL] ).length;
158    
159                    if( editVals[EDIT_KEY_ORDERBY] != null ) {
160                            StringBuilder buf = new StringBuilder();
161                            String[] ary = StringUtil.csv2Array( editVals[EDIT_KEY_ORDERBY] );
162                            for( int i=0; i<ary.length ;i++ ) {
163                                    String str = ary[i];
164                                    if( str.startsWith( "!" ) ) {
165                                            str = str.substring( 1 );
166                                            if( buf.length() > 0 ) { buf.append( "," ); }
167                                            buf.append( str );
168                                    }
169                                    orderMap.put( str, String.valueOf( i+1 ) );
170                            }
171                            orderByDescClms = buf.toString();
172                    }
173                    else {
174                            orderByDescClms = null;
175                    }
176            }
177    
178            /**
179             * キーé…å?ã‹ã‚‰ç”»é¢IDã¨ã‚¨ãƒ?‚£ãƒ?ƒˆåç§°ã®ãƒšã‚¢ã®ä¸?¦§ã‚’å–りå?ã—ã¾ã™ã?
180             *
181             * キーé…å?ã‹ã‚‰"EDIT_NAME_"ã§å§‹ã¾ã‚‹ã‚­ãƒ¼ã‚’検索ã—ã?"EDIT_NAME_(ç”»é¢ID)_(エãƒ?‚£ãƒ?ƒˆå?"
182             * ã¨è¨?†å½¢å¼ã«åŸºã¥ãã?ç”»é¢IDã¨ã‚¨ãƒ?‚£ãƒ?ƒˆåç§°ã®ãƒšã‚¢ã‚’å–りå?ã—ã¾ã™ã?
183             *
184             * ç”»é¢IDã¨ã‚¨ãƒ?‚£ãƒ?ƒˆåç§°ã¯é…å?ã¨ã—ã¦ä¿å­˜ã•ã‚?インãƒ?ƒƒã‚¯ã‚¹ç•ªå·ã¯ 0:ç”»é¢IDã€?:エãƒ?‚£ãƒ?ƒˆå?
185             * ãã?ä¸?¦§ãŒã•れらã«é…å?ã«æ ¼ç´ã•れã¦è¿”ã•れã¾ã™ã?
186             *
187             * @param keys キーé…å?
188             *
189             * @return ç”»é¢IDã¨ã‚¨ãƒ?‚£ãƒ?ƒˆåç§°ã®ãƒšã‚¢ã®ä¸?¦§
190             */
191            public static String[][] getKeySet( final String[] keys ) {
192                    if( keys == null || keys.length == 0 ) { return null; }
193    
194                    Set<String[]> keySet = new HashSet<String[]>();
195                    for( String key : keys ) {
196                            if ( key != null && key.startsWith( "EDIT_NAME_" ) ) {
197                                    String guikeyEditName = key.substring( ( "EDIT_NAME_" ).length() );
198                                    if( guikeyEditName.indexOf( '_' ) >= 0 ) {
199                                            String guikey = guikeyEditName.substring( 0, guikeyEditName.indexOf( '_' ) );
200                                            String editName = guikeyEditName.substring( ( guikey + "_" ).length() );
201                                            if( guikey != null && guikey.length() > 0 && editName != null && editName.length() > 0 ) {
202                                                    String[] set = { guikey, editName };
203                                                    keySet.add( set );
204                                            }
205                                    }
206                            }
207                    }
208    //              return keySet.toArray( new String[0][] );
209                    return keySet.toArray( new String[keySet.size()][] );
210            }
211    
212            /**
213             * ç”»é¢IDã€ã‚¨ãƒ?‚£ãƒ?ƒˆåをキーã«ã€ã‚¨ãƒ?‚£ãƒ?ƒˆè¨­å®šã‚ªãƒ–ジェクトã?å?¨­å®šå?ã®
214             * 管ç?‚­ãƒ¼ã‚’指定ã—ã¾ã™ã?
215             *
216             * エãƒ?‚£ãƒ?ƒˆè¨­å®šã‚ªãƒ–ジェクトã§ç®¡ç?•れるå?‚­ãƒ¼ã«å¯¾ã—ã¦ã€?
217             * "EDIT_[KEY]_(ç”»é¢ID)_(エãƒ?‚£ãƒ?ƒˆå?"ã¨ã?†ã‚­ãƒ¼ã‚’生æˆã—ã€ã“れをé…å?ã«ã—ã¦è¿”ã—ã¾ã™ã?
218             *
219             * @param guikey ç”»é¢ID
220             * @param editName エãƒ?‚£ãƒ?ƒˆå?
221             *
222             * @return エãƒ?‚£ãƒ?ƒˆè¨­å®šã‚’管ç?™ã‚‹ãŸã‚ã?キーä¸?¦§
223             */
224            public static String[] getEditKeys( final String guikey, final String editName ) {
225                    String[] rtn = new String[EDIT_KEYS_LENGTH];
226                    for( int i=0; i<EDIT_KEYS_LENGTH; i++ ) {
227                            rtn[i] = "EDIT_" + EDIT_KEYS[i] + "_" + guikey + "_" + editName;
228                    }
229                    return rtn;
230            }
231    
232            /**
233             * エãƒ?‚£ãƒ?ƒˆè¨­å®šã‚ªãƒ–ジェクトã?å?¨­å®šå?ã‚’é?列ã«ã—ã¦è¿”ã—ã¾ã™ã?
234             *
235             * é…å?ã®ã‚¤ãƒ³ãƒ?ƒƒã‚¯ã‚¹ç•ªå·ã¯ã€{@link #getEditKeys(String,String)}ã§ç”Ÿæ?ã•れるキーã®
236             * インãƒ?ƒƒã‚¯ã‚¹ç•ªå·ã¨ä¸??ã—ã¾ã™ã?
237             *
238             * @return エãƒ?‚£ãƒ?ƒˆè¨­å®šã‚ªãƒ–ジェクトã?設定å?ä¸?¦§(é…å?)
239             * @see #getEditKeys(String,String)
240             */
241            public String[] getEditVals() {
242                    String[] rtn = new String[editVals.length];
243                    System.arraycopy( editVals, 0, rtn, 0, editVals.length );
244                    return rtn;
245            }
246    
247            /**
248             * エãƒ?‚£ãƒ?ƒˆåã‚’è¿”ã—ã¾ã™ã?
249             *
250             * @return エãƒ?‚£ãƒ?ƒˆå?
251             */
252            public String getEditName() {
253                    return editVals[EDIT_KEY_NAME];
254            }
255    
256            /**
257             * 表示カラãƒ?ã®ä¸?¦§ã‚’カンマ区åˆ?‚Šã§è¿”ã—ã¾ã™ã?
258             * éžè¡¨ç¤ºã‚«ãƒ©ãƒ?«ã¤ã?¦ã¯ã€ã‚«ãƒ©ãƒ?ã®å…ˆé?ã«"!"ã‚’ã¤ã‘ã¦è¿”ã•れã¾ã™ã?
259             * ä¾? AAA,!BBB,CCC -> AAA,CCCã®é ?«è¡¨ç¤º(BBBã¯éžè¡¨ç¤º)
260             *
261             * @return 表示カラãƒ?ä¸?¦§(カンマ区åˆ?‚Š)
262             */
263            public String getViewClms() {
264                    return editVals[EDIT_KEY_VIEW];
265            }
266    
267            /**
268             * é›?¨ˆã‚«ãƒ©ãƒ??ä¸?¦§ã‚’カンマ区åˆ?‚Šã§è¿”ã—ã¾ã™ã?
269             *
270             * @return é›?¨ˆã‚«ãƒ©ãƒ??ä¸?¦§(カンマ区åˆ?
271             */
272            public String getSumClms() {
273                    return editVals[EDIT_KEY_SUM];
274            }
275    
276            /**
277             * é›?¨ˆå?ç?‚’行ã†ã‹ã©ã?‹ã‚’è¿”ã—ã¾ã™ã?
278             * ã“れã¯ã€?›†è¨ˆã‚«ãƒ©ãƒ?ŒæŒ?®šã•れã¦ã?‚‹ã‹ã?ã¨åŒã˜æ„味ã§ã™ã?
279             *
280             * @return true:対象 false:éžå¯¾è±¡
281             */
282            public boolean useSum() {
283                    return ( editVals[EDIT_KEY_SUM] != null && editVals[EDIT_KEY_SUM].length() > 0 );
284            }
285    
286            /**
287             * æŒ?®šã•れãŸã‚«ãƒ©ãƒ?Œé›?¨ˆå¯¾è±¡ã®ã‚«ãƒ©ãƒ?‹ã©ã?‹ã‚’è¿”ã—ã¾ã™ã?
288             *
289             * @param clm カラ�
290             *
291             * @return true:対象 false:éžå¯¾è±¡
292             */
293            public boolean isSumClm( final String clm ) {
294                    if( clm == null || editVals[EDIT_KEY_SUM] == null ) { return false; }
295                    return ( ( ","+editVals[EDIT_KEY_SUM]+"," ).indexOf( ","+clm+"," ) >= 0 );
296            }
297    
298            /**
299             * é›?¨ˆã‚«ãƒ©ãƒ??カラãƒ?•°ã‚’è¿”ã—ã¾ã™ã?
300             *
301             * @return é›?¨ˆã‚«ãƒ©ãƒ??カラãƒ?•°
302             */
303            public int getSumClmCount() {
304                    return sumClmCount;
305            }
306    
307            /**
308             * グループカラãƒ??ä¸?¦§ã‚’カンマ区åˆ?‚Šã§è¿”ã—ã¾ã™ã?
309             *
310             * @return グループカラãƒ??ä¸?¦§(カンマ区åˆ?
311             */
312            public String getGroupClms() {
313                    return editVals[EDIT_KEY_GROUP];
314            }
315    
316            /**
317             * グループå?ç?‚’行ã†ã‹ã©ã?‹ã‚’è¿”ã—ã¾ã™ã?
318             * ã“れã¯ã€ã‚°ãƒ«ãƒ¼ãƒ—カラãƒ?ŒæŒ?®šã•れã¦ã?‚‹ã‹ã?ã¨åŒã˜æ„味ã§ã™ã?
319             *
320             * @return true:対象 false:éžå¯¾è±¡
321             */
322            public boolean useGroup() {
323                    return ( editVals[EDIT_KEY_GROUP] != null && editVals[EDIT_KEY_GROUP].length() > 0 );
324            }
325    
326            /**
327             * æŒ?®šã•れãŸã‚«ãƒ©ãƒ?Œã‚°ãƒ«ãƒ¼ãƒ—対象ã®ã‚«ãƒ©ãƒ?‹ã©ã?‹ã‚’è¿”ã—ã¾ã™ã?
328             *
329             * @param clm カラ�
330             *
331             * @return true:対象 false:éžå¯¾è±¡
332             */
333            public boolean isGroupClm( final String clm ) {
334                    if( clm == null || editVals[EDIT_KEY_GROUP] == null ) { return false; }
335                    return ( ( ","+editVals[EDIT_KEY_GROUP]+"," ).indexOf( ","+clm+"," ) >= 0 );
336            }
337    
338            /**
339             * グループカラãƒ??カラãƒ?•°ã‚’è¿”ã—ã¾ã™ã?
340             *
341             * @return グループカラãƒ??カラãƒ?•°
342             */
343            public int getGroupClmCount() {
344                    return groupClmCount;
345            }
346    
347            /**
348             * å°è¨ˆã‚«ãƒ©ãƒ??ä¸?¦§ã‚’カンマ区åˆ?‚Šã§è¿”ã—ã¾ã™ã?
349             *
350             * @return å°è¨ˆã‚«ãƒ©ãƒ??ä¸?¦§(カンマ区åˆ?
351             */
352            public String getSubTotalClms() {
353                    return editVals[EDIT_KEY_SUBTOTAL];
354            }
355    
356            /**
357             * å°è¨ˆå?ç?‚’行ã†ã‹ã©ã?‹ã‚’è¿”ã—ã¾ã™ã?
358             * ã“れã¯ã€å°è¨ˆã‚«ãƒ©ãƒ?ŒæŒ?®šã•れã¦ã?‚‹ã‹ã?ã¨åŒã˜æ„味ã§ã™ã?
359             *
360             * @return true:対象 false:éžå¯¾è±¡
361             */
362            public boolean useSubTotal() {
363                    return ( editVals[EDIT_KEY_SUBTOTAL] != null && editVals[EDIT_KEY_SUBTOTAL].length() > 0 );
364            }
365    
366            /**
367             * æŒ?®šã•れãŸã‚«ãƒ©ãƒ?Œå°è¨ˆå¯¾è±¡ã®ã‚«ãƒ©ãƒ?‹ã©ã?‹ã‚’è¿”ã—ã¾ã™ã?
368             *
369             * @param clm カラ�
370             *
371             * @return true:対象 false:éžå¯¾è±¡
372             */
373            public boolean isSubTotalClm( final String clm ) {
374                    if( clm == null || editVals[EDIT_KEY_SUBTOTAL] == null ) { return false; }
375                    return ( ( ","+editVals[EDIT_KEY_SUBTOTAL]+"," ).indexOf( ","+clm+"," ) >= 0 );
376            }
377    
378            /**
379             * å°è¨ˆã‚«ãƒ©ãƒ??カラãƒ?•°ã‚’è¿”ã—ã¾ã™ã?
380             *
381             * @return グループカラãƒ??カラãƒ?•°
382             */
383            public int getSubTotalClmCount() {
384                    return subTotalClmCount;
385            }
386    
387            /**
388             * åˆè¨ˆã‚«ãƒ©ãƒ??ä¸?¦§ã‚’カンマ区åˆ?‚Šã§è¿”ã—ã¾ã™ã?
389             *
390             * @return åˆè¨ˆã‚«ãƒ©ãƒ??ä¸?¦§(カンマ区åˆ?
391             */
392            public String getTotalClms() {
393                    return editVals[EDIT_KEY_TOTAL];
394            }
395    
396            /**
397             * åˆè¨ˆå?ç?‚’行ã†ã‹ã©ã?‹ã‚’è¿”ã—ã¾ã™ã?
398             * ã“れã¯ã€åˆè¨ˆã‚«ãƒ©ãƒ?ŒæŒ?®šã•れã¦ã?‚‹ã‹ã?ã¨åŒã˜æ„味ã§ã™ã?
399             *
400             * @return true:対象 false:éžå¯¾è±¡
401             */
402            public boolean useTotal() {
403                    return ( editVals[EDIT_KEY_TOTAL] != null && editVals[EDIT_KEY_TOTAL].length() > 0 );
404            }
405    
406            /**
407             * æŒ?®šã•れãŸã‚«ãƒ©ãƒ?Œåˆè¨ˆå¯¾è±¡ã®ã‚«ãƒ©ãƒ?‹ã©ã?‹ã‚’è¿”ã—ã¾ã™ã?
408             *
409             * @param clm カラ�
410             *
411             * @return true:対象 false:éžå¯¾è±¡
412             */
413            public boolean isTotalClm( final String clm ) {
414                    if( clm == null || editVals[EDIT_KEY_TOTAL] == null ) { return false; }
415                    return ( ( ","+editVals[EDIT_KEY_TOTAL]+"," ).indexOf( ","+clm+"," ) >= 0 );
416            }
417    
418            /**
419             * åˆè¨ˆã‚«ãƒ©ãƒ??カラãƒ?•°ã‚’è¿”ã—ã¾ã™ã?
420             *
421             * @return グループカラãƒ??カラãƒ?•°
422             */
423            public int getTotalClmCount() {
424                    return totalClmCount;
425            }
426    
427            /**
428             * ç·åˆè¨ˆè¡Œã‚’付加ã™ã‚‹ã‹ã©ã?‹ã‚’è¿”ã—ã¾ã™ã?
429             *
430             * @return true:対象 false:éžå¯¾è±¡
431             */
432            public boolean useGrandTotal() {
433                    return StringUtil.nval( editVals[EDIT_KEY_GRANDTOTAL], false );
434            }
435    
436            /**
437             * 表示é ?‚«ãƒ©ãƒ?‚’カンマ区åˆ?‚Šã§è¿”ã—ã¾ã™ã?
438             * カラãƒ??並ã³é ?Œè¡¨ç¤ºé ?¨ã—ã¦ã®å„ªå…ˆé?ã«ãªã‚Šã¾ã™ã?
439             * ã¾ãŸã?é™é?ã§è¡¨ç¤ºã™ã‚‹ã‚«ãƒ©ãƒ?«ã¤ã?¦ã¯ã€ã‚«ãƒ©ãƒ?ã®å…ˆé?ã«"!"ãŒä»˜åŠ ã•れã¾ã™ã?
440             *
441             * @return 標準é?カラãƒ??ä¸?¦§(カンマ区åˆ?
442             */
443            public String getOrderByClms() {
444                    return editVals[EDIT_KEY_ORDERBY];
445            }
446    
447            /**
448             * æŒ?®šã•れãŸã‚«ãƒ©ãƒ??表示é ??優先番å·ã‚’è¿”ã—ã¾ã™ã?
449             * æŒ?®šã‚«ãƒ©ãƒ?Œæ¨™æº–ã¨ã—ã¦æŒ?®šã•れã¦ã?ªã??åˆã?ã€?"(ゼロストリング)ã‚’è¿”ã—ã¾ã™ã?
450             *
451             * @param clm カラ�
452             *
453             * @return 表示é ??優先番å·
454             */
455            public String getOrder( final String clm ) {
456                    if( clm == null || editVals[EDIT_KEY_ORDERBY] == null ) { return ""; }
457    
458                    String rtn = orderMap.get( clm );
459                    return ( rtn == null ? "" : rtn );
460            }
461    
462            /**
463             * æŒ?®šã•れãŸã‚«ãƒ©ãƒ??表示é ?Œ‡å®šãŒé™é?ã§ã‚ã‚‹ã‹ã©ã?‹ã‚’è¿”ã—ã¾ã™ã?
464             * æ¨™æº–ã¨æŒ?®šã•れã¦ã?ªã??åˆã?ã€falseã‚’è¿”ã—ã¾ã™ã?
465             *
466             * @param clm カラ�
467             *
468             * @return true:é™é? false:æ˜??
469             */
470            public boolean isOrderByDesc( final String clm ) {
471                    if( clm == null || orderByDescClms == null ) { return false; }
472                    return ( ( ","+orderByDescClms+"," ).indexOf( ","+clm+"," ) >= 0 );
473            }
474    
475            /**
476             * ä¸¦ã³æ›¿ãˆå?ç?‚’行ã†ã‹ã©ã?‹ã‚’è¿”ã—ã¾ã™ã?
477             * ã“れã¯ã€è¡¨ç¤ºé ?‚«ãƒ©ãƒ?ŒæŒ?®šã•れã¦ã?‚‹ã‹ã?ã¨åŒã˜æ„味ã§ã™ã?
478             *
479             * @return true:対象 false:éžå¯¾è±¡
480             */
481            public boolean useOrderBy() {
482                    return ( editVals[EDIT_KEY_ORDERBY] != null && editVals[EDIT_KEY_ORDERBY].length() > 0 );
483            }
484    
485            /**
486             * ã“ã?エãƒ?‚£ãƒ?ƒˆè¨­å®šã‚ªãƒ–ジェクトãŒã€å?é€?全ユーザー公é–?エãƒ?‚£ãƒ?ƒˆã?
487             * ã©ã?‹ã‚’è¿”ã—ã¾ã™ã?
488             *
489             * @return 0以å¤?å…±é€?0:個人ã®ã¿
490             */
491            public boolean isCommon() {
492                    return StringUtil.nval( editVals[EDIT_KEY_COMMON], false );
493            }
494    }