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 * 表示カラãƒ?CSVå½¢å¼?ã‚’ãƒ�ã‚§ãƒ?‚¯ã�—ã?変更ã�Œã�‚れã?ã€�å��æ˜?�—ã�Ÿã‚«ãƒ©ãƒ?‚’作æ?ã�—ã�¾ã�™ã?
269 *
270 * 表示カラãƒ??ã€�並ã�³é ?‚„é�žè¡¨ç¤ºãƒžã?カー(!)ã�ªã�©ã�ŒåР味ã�•れã€�ユーザーã€�ç”»é�¢ã�”ã�¨ã�«
271 * ãƒ??タベã?スã�«è¨˜éŒ²ã�•れã�¦ã�?�¾ã�™ã?JSPソースを修æ£ã�—ã�Ÿå ´å�ˆã?ãƒ??タベã?スã�«
272 * 書ã��è¾¼ã�¾ã‚Œã�Ÿè¡¨ç¤ºã‚«ãƒ©ãƒ??ã€�å��æ˜?�•れã�ªã�?�Ÿã‚�ã?カラãƒ?�¸æŠžç”»é�¢ç‰ã�«è¡¨ç¤ºã�•れã�¾ã�›ã‚“ã€?
273 * ã��ã�“ã�§ã€�オリジナルã�®ã‚«ãƒ©ãƒ?�«è¿½åŠ?�•れã�Ÿå ´å�ˆã?ã€�カラãƒ?‚’比è¼?�™ã‚‹ã�“ã�¨ã�§ã€?
274 * 追åŠ??ã�®ã‚«ãƒ©ãƒ?‚’ã€?�žè¡¨ç¤ºã‚«ãƒ©ãƒ?�¨ã�—ã�¦ã€�後ã‚�ã�«è¿½è¨˜ã�—ã�¾ã�™ã?
275 * 削除ã�•れã�Ÿå?å�ˆã?ã€�ViewForm ã�§è¦å‘Šè¡¨ç¤ºã�™ã‚‹ã�“ã�¨ã�§ã€�ユーザーã�«å¤‰æ›´ã‚’ä¿?�—ã�¾ã�™ã?
276 *
277 * @og.rev 5.8.2.0 (2014/12/05) JSPä¿®æ£æ™‚ã?追åŠ?‚«ãƒ©ãƒ?¯¾å¿?
278 *
279 * @param orgClms オリジナル�カラ�CSV形�
280 *
281 * @return 変更後ã?表示カラãƒ?CSVå½¢å¼?
282 */
283 public String getViewClms( final String orgClms ) {
284 String viewClms = editVals[EDIT_KEY_VIEW];
285
286 if( orgClms == null || orgClms.isEmpty() ) { return viewClms; } // orgClms ���れ��viewClms を返��
287 // 基本çš?�«ã�¯ã€�両è€??カラãƒ??ã€�ä¸??ã�™ã‚‹ã�¯ã�šã?
288 String[] vclms = viewClms.split( "," ); // 表示é ??é�žè¡¨ç¤ºå‡¦ç�?‚’行ã�£ã�Ÿã‚«ãƒ©ãƒ?
289 String[] fclms = orgClms.split( "," ); // å…??ã�®è¡¨ç¤ºå�¯èƒ½ã‚«ãƒ©ãƒ?�™ã�¹ã�¦(fullClms)
290
291 // 表示å�¯èƒ½ã‚«ãƒ©ãƒ?�™ã�¹ã�¦ã�® Set を作æ?ã�—ã�¾ã�™ã?
292 Set<String> fset = new HashSet<String>();
293 for( int i=0; i<fclms.length; i++ ) { // orgClms ã‚’Set ã�«è¿½åŠ?�—ã�¾ã�™ã?
294 fset.add( fclms[i] );
295 }
296
297 // é�žè¡¨ç¤ºã‚«ãƒ©ãƒ??å†??表示å�¯èƒ½ã‚«ãƒ©ãƒ?�«å˜åœ¨ã�—ã�ªã�??ã�?�‘ã�® Set を作æ?ã�—ã�¾ã�™ã?
298 // ã�¾ã�Ÿã?表示å�¯èƒ½ã‚«ãƒ©ãƒ?�‹ã‚‰ã?é ?•ªã�«ã€�viewClms ã�®å€¤ã‚’削除ã�—ã�¦ã�?��ã�¾ã�™ã?
299 Set<String> vset = new HashSet<String>();
300 StringBuilder vbuf = new StringBuilder(); // æ–°ã�—ã�„ viewClms 作æ?用
301 for( int i=0; i<vclms.length; i++ ) { // viewClms ã‚’Set ã�«è¿½åŠ?�—ã�¾ã�™ã?
302 String clm = vclms[i];
303 if( clm == null || clm.isEmpty() ) { continue; } // 6.0.2.5 (2014/10/31) 潜在ãƒ�ã‚°??å…ˆé?ã�«"," ã�Œæ�¥ã‚‹ã�¨ã‚¢ãƒ™ãƒ³ãƒ‰ã�™ã‚‹ã?
304 clm = clm.charAt(0) == '!' ? clm.substring(1) : clm ; // é�žè¡¨ç¤ºã�® (!) ã�¯å‰Šé™¤ã�—ã�¾ã�™ã?
305 if( fset.remove( clm ) ) { // fullSet ã�«ã�‚れã�°ã€�削除ã�™ã‚‹ã�¨ã�¨ã‚‚ã�«ã€�æ–°viewClmsを作æ?ã�™ã‚‹ã€?
306 if( vbuf.length() > 0 ) { vbuf.append(','); } // æœ??以é™�ã?ã€�カンマã�§é€£çµ�ã�™ã‚‹ã? // 6.0.2.5 (2014/10/31) char ã‚?append ã�™ã‚‹ã€?
307 vbuf.append( vclms[i] ); // append ã�™ã‚‹ã�®ã�¯ã€?!) 付ã?カラãƒ?
308 }
309 else {
310 vset.add( clm ); // fullSet ���れ��viewSet �追�
311 }
312 }
313
314 // ã�“ã?段階ã�§ã€�fsetã€�vset ã�¨ã‚‚ã�«ã€�ã��れã�žã‚Œç‹¬è‡ªã�®ã‚«ãƒ©ãƒ?�Œæ®‹ã�£ã�¦ã�?‚‹ã€?
315 // ã�©ã�¡ã‚‰ã‚‚ã€�残ã�£ã�¦ã�?�ªã�‘れã�°ã€�æ£å¸¸ã�ªã�®ã�§ã€�viewClms ã‚’è¿”ã�™ã€?
316 if( vset.isEmpty() && fset.isEmpty() ) { return viewClms; }
317
318 // fullSet ã�«ã‚«ãƒ©ãƒ?�Œæ®‹ã�£ã�¦ã�?‚Œã�°ã€?�žè¡¨ç¤ºã�§ã€�æ–°viewClmsã�«ã€�追åŠ?�™ã‚‹ã?
319 if( !fset.isEmpty() ) {
320 String[] defClms = fset.toArray( new String[fset.size()] );
321 for( int i=0; i<defClms.length; i++ ) {
322 if( vbuf.length() > 0 ) { vbuf.append(','); } // 6.0.2.5 (2014/10/31) æœ??以é™�ã?ã€�カンマã�§é€£çµ�ã�™ã‚‹ã?
323 vbuf.append('!').append( defClms[i] ); // é�žè¡¨ç¤ºã‚«ãƒ©ãƒ?�¨ã�—ã�¦ã€�後ã‚�ã�«è¿½åŠ?�™ã‚‹ã?
324 }
325 }
326 viewClms = vbuf.toString();
327
328 editVals[EDIT_KEY_VIEW] = viewClms;
329 return viewClms;
330 }
331
332 /**
333 * é›?¨ˆã‚«ãƒ©ãƒ??ä¸?¦§ã‚’カンマ区åˆ?‚Šã�§è¿”ã�—ã�¾ã�™ã?
334 *
335 * @return é›?¨ˆã‚«ãƒ©ãƒ??ä¸?¦§(カンマ区åˆ?
336 */
337 public String getSumClms() {
338 return editVals[EDIT_KEY_SUM];
339 }
340
341 /**
342 * é›?¨ˆå?ç�?‚’行ã�†ã�‹ã�©ã�?�‹ã‚’è¿”ã�—ã�¾ã�™ã?
343 * ã�“れã�¯ã€?›†è¨ˆã‚«ãƒ©ãƒ?�ŒæŒ?®šã�•れã�¦ã�?‚‹ã�‹ã?ã�¨å�Œã�˜æ„�味ã�§ã�™ã?
344 *
345 * @return true:対象 false:�対象
346 */
347 public boolean useSum() {
348 return ( editVals[EDIT_KEY_SUM] != null && editVals[EDIT_KEY_SUM].length() > 0 );
349 }
350
351 /**
352 * æŒ?®šã�•れã�Ÿã‚«ãƒ©ãƒ?�Œé›?¨ˆå¯¾è±¡ã�®ã‚«ãƒ©ãƒ?�‹ã�©ã�?�‹ã‚’è¿”ã�—ã�¾ã�™ã?
353 *
354 * @param clm カラ�
355 *
356 * @return true:対象 false:�対象
357 */
358 public boolean isSumClm( final String clm ) {
359 if( clm == null || editVals[EDIT_KEY_SUM] == null ) { return false; }
360 return ( ( ","+editVals[EDIT_KEY_SUM]+"," ).indexOf( ","+clm+"," ) >= 0 );
361 }
362
363 /**
364 * é›?¨ˆã‚«ãƒ©ãƒ??カラãƒ?•°ã‚’è¿”ã�—ã�¾ã�™ã?
365 *
366 * @return é›?¨ˆã‚«ãƒ©ãƒ??カラãƒ?•°
367 */
368 public int getSumClmCount() {
369 return sumClmCount;
370 }
371
372 /**
373 * グループカラãƒ??ä¸?¦§ã‚’カンマ区åˆ?‚Šã�§è¿”ã�—ã�¾ã�™ã?
374 *
375 * @return グループカラãƒ??ä¸?¦§(カンマ区åˆ?
376 */
377 public String getGroupClms() {
378 return editVals[EDIT_KEY_GROUP];
379 }
380
381 /**
382 * グループå?ç�?‚’行ã�†ã�‹ã�©ã�?�‹ã‚’è¿”ã�—ã�¾ã�™ã?
383 * ã�“れã�¯ã€�グループカラãƒ?�ŒæŒ?®šã�•れã�¦ã�?‚‹ã�‹ã?ã�¨å�Œã�˜æ„�味ã�§ã�™ã?
384 *
385 * @return true:対象 false:�対象
386 */
387 public boolean useGroup() {
388 return ( editVals[EDIT_KEY_GROUP] != null && editVals[EDIT_KEY_GROUP].length() > 0 );
389 }
390
391 /**
392 * æŒ?®šã�•れã�Ÿã‚«ãƒ©ãƒ?�Œã‚°ãƒ«ãƒ¼ãƒ—対象ã�®ã‚«ãƒ©ãƒ?�‹ã�©ã�?�‹ã‚’è¿”ã�—ã�¾ã�™ã?
393 *
394 * @param clm カラ�
395 *
396 * @return true:対象 false:�対象
397 */
398 public boolean isGroupClm( final String clm ) {
399 if( clm == null || editVals[EDIT_KEY_GROUP] == null ) { return false; }
400 return ( ( ","+editVals[EDIT_KEY_GROUP]+"," ).indexOf( ","+clm+"," ) >= 0 );
401 }
402
403 /**
404 * グループカラãƒ??カラãƒ?•°ã‚’è¿”ã�—ã�¾ã�™ã?
405 *
406 * @return グループカラãƒ??カラãƒ?•°
407 */
408 public int getGroupClmCount() {
409 return groupClmCount;
410 }
411
412 /**
413 * å°�計カラãƒ??ä¸?¦§ã‚’カンマ区åˆ?‚Šã�§è¿”ã�—ã�¾ã�™ã?
414 *
415 * @return å°�計カラãƒ??ä¸?¦§(カンマ区åˆ?
416 */
417 public String getSubTotalClms() {
418 return editVals[EDIT_KEY_SUBTOTAL];
419 }
420
421 /**
422 * å°�計å?ç�?‚’行ã�†ã�‹ã�©ã�?�‹ã‚’è¿”ã�—ã�¾ã�™ã?
423 * ã�“れã�¯ã€�å°�計カラãƒ?�ŒæŒ?®šã�•れã�¦ã�?‚‹ã�‹ã?ã�¨å�Œã�˜æ„�味ã�§ã�™ã?
424 *
425 * @return true:対象 false:�対象
426 */
427 public boolean useSubTotal() {
428 return ( editVals[EDIT_KEY_SUBTOTAL] != null && editVals[EDIT_KEY_SUBTOTAL].length() > 0 );
429 }
430
431 /**
432 * æŒ?®šã�•れã�Ÿã‚«ãƒ©ãƒ?�Œå°�計対象ã�®ã‚«ãƒ©ãƒ?�‹ã�©ã�?�‹ã‚’è¿”ã�—ã�¾ã�™ã?
433 *
434 * @param clm カラ�
435 *
436 * @return true:対象 false:�対象
437 */
438 public boolean isSubTotalClm( final String clm ) {
439 if( clm == null || editVals[EDIT_KEY_SUBTOTAL] == null ) { return false; }
440 return ( ( ","+editVals[EDIT_KEY_SUBTOTAL]+"," ).indexOf( ","+clm+"," ) >= 0 );
441 }
442
443 /**
444 * å°�計カラãƒ??カラãƒ?•°ã‚’è¿”ã�—ã�¾ã�™ã?
445 *
446 * @return グループカラãƒ??カラãƒ?•°
447 */
448 public int getSubTotalClmCount() {
449 return subTotalClmCount;
450 }
451
452 /**
453 * å�ˆè¨ˆã‚«ãƒ©ãƒ??ä¸?¦§ã‚’カンマ区åˆ?‚Šã�§è¿”ã�—ã�¾ã�™ã?
454 *
455 * @return å�ˆè¨ˆã‚«ãƒ©ãƒ??ä¸?¦§(カンマ区åˆ?
456 */
457 public String getTotalClms() {
458 return editVals[EDIT_KEY_TOTAL];
459 }
460
461 /**
462 * å�ˆè¨ˆå?ç�?‚’行ã�†ã�‹ã�©ã�?�‹ã‚’è¿”ã�—ã�¾ã�™ã?
463 * ã�“れã�¯ã€�å�ˆè¨ˆã‚«ãƒ©ãƒ?�ŒæŒ?®šã�•れã�¦ã�?‚‹ã�‹ã?ã�¨å�Œã�˜æ„�味ã�§ã�™ã?
464 *
465 * @return true:対象 false:�対象
466 */
467 public boolean useTotal() {
468 return ( editVals[EDIT_KEY_TOTAL] != null && editVals[EDIT_KEY_TOTAL].length() > 0 );
469 }
470
471 /**
472 * æŒ?®šã�•れã�Ÿã‚«ãƒ©ãƒ?�Œå�ˆè¨ˆå¯¾è±¡ã�®ã‚«ãƒ©ãƒ?�‹ã�©ã�?�‹ã‚’è¿”ã�—ã�¾ã�™ã?
473 *
474 * @param clm カラ�
475 *
476 * @return true:対象 false:�対象
477 */
478 public boolean isTotalClm( final String clm ) {
479 if( clm == null || editVals[EDIT_KEY_TOTAL] == null ) { return false; }
480 return ( ( ","+editVals[EDIT_KEY_TOTAL]+"," ).indexOf( ","+clm+"," ) >= 0 );
481 }
482
483 /**
484 * å�ˆè¨ˆã‚«ãƒ©ãƒ??カラãƒ?•°ã‚’è¿”ã�—ã�¾ã�™ã?
485 *
486 * @return グループカラãƒ??カラãƒ?•°
487 */
488 public int getTotalClmCount() {
489 return totalClmCount;
490 }
491
492 /**
493 * ç·�å�ˆè¨ˆè¡Œã‚’ä»˜åŠ ã�™ã‚‹ã�‹ã�©ã�?�‹ã‚’è¿”ã�—ã�¾ã�™ã?
494 *
495 * @return true:対象 false:�対象
496 */
497 public boolean useGrandTotal() {
498 return StringUtil.nval( editVals[EDIT_KEY_GRANDTOTAL], false );
499 }
500
501 /**
502 * 表示é ?‚«ãƒ©ãƒ?‚’カンマ区åˆ?‚Šã�§è¿”ã�—ã�¾ã�™ã?
503 * カラãƒ??並ã�³é ?�Œè¡¨ç¤ºé ?�¨ã�—ã�¦ã�®å„ªå…ˆé?ã�«ã�ªã‚Šã�¾ã�™ã?
504 * ã�¾ã�Ÿã?é™�é?ã�§è¡¨ç¤ºã�™ã‚‹ã‚«ãƒ©ãƒ?�«ã�¤ã�?�¦ã�¯ã€�カラãƒ?��ã�®å…ˆé?ã�«"!"ã�Œä»˜åŠ ã�•れã�¾ã�™ã?
505 *
506 * @return 標準é?カラãƒ??ä¸?¦§(カンマ区åˆ?
507 */
508 public String getOrderByClms() {
509 return editVals[EDIT_KEY_ORDERBY];
510 }
511
512 /**
513 * æŒ?®šã�•れã�Ÿã‚«ãƒ©ãƒ??表示é ??優先番å�·ã‚’è¿”ã�—ã�¾ã�™ã?
514 * æŒ?®šã‚«ãƒ©ãƒ?�Œæ¨™æº–ã�¨ã�—ã�¦æŒ?®šã�•れã�¦ã�?�ªã�??å�ˆã?ã€?"(ゼãƒã‚¹ãƒˆãƒªãƒ³ã‚°)ã‚’è¿”ã�—ã�¾ã�™ã?
515 *
516 * @param clm カラ�
517 *
518 * @return 表示é ??優先番å�·
519 */
520 public String getOrder( final String clm ) {
521 if( clm == null || editVals[EDIT_KEY_ORDERBY] == null ) { return ""; }
522
523 String rtn = orderMap.get( clm );
524 return ( rtn == null ? "" : rtn );
525 }
526
527 /**
528 * æŒ?®šã�•れã�Ÿã‚«ãƒ©ãƒ??表示é ?Œ‡å®šã�Œé™�é?ã�§ã�‚ã‚‹ã�‹ã�©ã�?�‹ã‚’è¿”ã�—ã�¾ã�™ã?
529 * 標準ã�¨æŒ?®šã�•れã�¦ã�?�ªã�??å�ˆã?ã€�falseã‚’è¿”ã�—ã�¾ã�™ã?
530 *
531 * @param clm カラ�
532 *
533 * @return true:é™�é? false:æ˜??
534 */
535 public boolean isOrderByDesc( final String clm ) {
536 if( clm == null || orderByDescClms == null ) { return false; }
537 return ( ( ","+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 }