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.math.BigDecimal;
019    import java.sql.ResultSet;
020    import java.sql.ResultSetMetaData;
021    import java.sql.SQLException;
022    import java.text.DecimalFormat;
023    import java.util.ArrayList;
024    import java.util.HashMap;
025    import java.util.LinkedHashMap;
026    import java.util.List;
027    import java.util.Locale;
028    import java.util.Map;
029    
030    import org.opengion.fukurou.db.DBUtil;
031    import org.opengion.fukurou.util.StringUtil;
032    import org.opengion.hayabusa.common.HybsSystem;
033    import org.opengion.hayabusa.common.HybsSystemException;
034    import org.opengion.hayabusa.resource.LabelData;
035    import org.opengion.hayabusa.resource.ResourceManager;
036    
037    /**
038     * DBTableModelを継承した TableModelの編?定による変換を行うための実?ラスです?
039     *
040     * こ?クラスでは、オブジェクト?期化後???常のDBTableModelと同じ振る??します?
041     * オブジェクト?期化?createメソ?呼び出し時)に、検索結果オブジェクトから直接、編?定に
042     * 応じて変換されたDBTableModelを生成します?
043     *
044     * こ?ような実?行う?は、メモリ使用量を??るためです?
045     * こ?編?定では?計機?を備えて?すが、?DBTableModel作?後に???行うと?
046     * メモリを大量に使用する恐れがあるため?検索結果オブジェクトから直接???行い、DBTableModel?
047     * 生?して?す?
048     *
049     * DBTableModel インターフェースは?データベ?スの検索結果(Resultset)をラ??する
050     * インターフェースとして使用して下さ??
051     *
052     * @og.rev 5.3.6.0 (2011/06/01) 新規作?
053     * @og.group ??ブル管?
054     *
055     * @version  5.0
056     * @author   Hiroki Nakamura
057     * @since    JDK6.0,
058     */
059    public class DBTableModelEditor extends DBTableModelImpl {
060            private static final String JS                          = HybsSystem.JOINT_STRING;
061            private static final DecimalFormat FORMAT       = new DecimalFormat( "0.#########" );
062    
063            private int rowCountColumn = -1;
064            private DBEditConfig config;
065    
066            /**
067             * DBTableModel を設定し、このオブジェクトを初期化します?
068             *
069             * @param       result                  検索結果オブジェク?
070             * @param       skipRowCount    読み飛?し件数
071             * @param       maxRowCount             ?検索件数
072             * @param       resource                ResourceManagerオブジェク?
073             * @param       config                  エ??設定オブジェク?
074             * @throws      SQLException
075             */
076            public void create( final ResultSet result, final int skipRowCount, final int maxRowCount, final ResourceManager resource, final DBEditConfig config ) throws SQLException {
077                    if( result == null || config == null || resource == null ) {
078                            String msg = "DBTableModelまた?、DBEditConfigが設定されて?せん?;
079                            throw new HybsSystemException( msg );
080                    }
081    
082                    this.config = config;
083    
084                    /**********************************************************************
085                     * ?ラメーターの初期化??
086                     **********************************************************************/
087                    ResultSetMetaData metaData      = result.getMetaData();
088                    int colCnt = metaData.getColumnCount();
089                    if( config.useGroup() || config.useSubTotal() || config.useTotal() || config.useGrandTotal() ) {
090                            rowCountColumn = colCnt;
091                            colCnt++;
092                    }
093                    init( colCnt );
094    
095                    DBColumn[] dbColumn = new DBColumn[numberOfColumns];
096                    int[] types  = new int[numberOfColumns];
097                    boolean[] sumFilter = new boolean[numberOfColumns];
098                    boolean[] groupFilter = new boolean[numberOfColumns];
099                    boolean[] subTotalFilter = new boolean[numberOfColumns];
100                    boolean[] totalFilter = new boolean[numberOfColumns];
101                    for( int column=0; column<numberOfColumns; column++ ) {
102                            String name = null;
103                            if( column != rowCountColumn ) {
104                                    name = (metaData.getColumnLabel(column+1)).toUpperCase(Locale.JAPAN);
105                                    types[column] = metaData.getColumnType(column+1);
106                                    dbColumn[column] = resource.getDBColumn( name );
107                                    if( dbColumn[column] == null ) {
108                                            LabelData labelData  = resource.getLabelData( name );
109                                            dbColumn[column] = DBTableModelUtil.makeDBColumn( name,labelData,metaData,column,resource.getLang() );
110                                    }
111                            }
112                            else {
113                                    name = "rowCount";
114                                    dbColumn[column] = resource.makeDBColumn( name );
115                            }
116    
117                            setDBColumn( column,dbColumn[column] );
118    
119                            sumFilter[column] = config.isSumClm( name );
120                            groupFilter[column] = config.isGroupClm( name );
121                            subTotalFilter[column] = config.isSubTotalClm( name );
122                            totalFilter[column] = config.isTotalClm( name );
123                    }
124    
125                    /**********************************************************************
126                     * ??ソート?合計??
127                     **********************************************************************/
128                    // ?キーに基づく集計??行い??タを追?ます?
129                    if( config.useGroup() ) {
130                            addGroupRows( result, types, skipRowCount, maxRowCount, sumFilter, groupFilter  );
131                    }
132                    // 通常と同じように結果カーソルから??タを読込み??タを追?ます?
133                    else {
134                            // 5.5.2.4 (2012/05/16) int[] types は使われて???で、削除します?
135    //                      addPlainRows( result, types, skipRowCount, maxRowCount );
136                            addPlainRows( result, skipRowCount, maxRowCount );
137                    }
138    
139                    // ソート??
140                    if( getRowCount() > 0 && config.useOrderBy() ) {
141                            sort();
142                    }
143    
144                    // 小計?合計行を追?ます?
145                    if( getRowCount() > 0 && !isOverflow()
146                            && ( config.useSubTotal() || config.useTotal() || config.useGrandTotal() ) ) {
147                            addTotalRows( maxRowCount, resource, sumFilter, groupFilter, subTotalFilter, totalFilter );
148                    }
149            }
150    
151            /**
152             * ?キーの設定に基づき?DBTableModelの行を追?ます?
153             * ??は、キーブレイクではなく??マップにより???行って?ため?
154             * ?キーが検索?より散在した場合で?まとまりで?されます?
155             *
156             * @og.rev 5.3.9.0 (2011/09/01) 値がNULLの場合にエラーになるバグを修正
157             * @og.rev 5.6.1.0 (2013/02/01) doubleをBigDecimalに
158             *
159             * @param result 検索結果オブジェク?
160             * @param types カラ?イプ?配?
161             * @param skipRowCount 読み飛?し件数
162             * @param maxRowCount ?検索件数
163             * @param sumFilter ??目フィルター
164             * @param groupFilter グループキーフィルター
165             * @throws SQLException
166             */
167            private void addGroupRows( final ResultSet result, final int[] types, final int skipRowCount, final int maxRowCount
168                                                                    , final boolean[] sumFilter, final boolean[] groupFilter ) throws SQLException {
169                    int numberOfRows = 0;
170                    while( numberOfRows < skipRowCount && result.next() ) {
171                            // 注?resultSet.next() を?に判定すると??件読み飛?してしま??
172                            numberOfRows ++ ;
173                    }
174                    numberOfRows = 0;
175    
176                    Map<String,String[]> groupLinkedMap = new LinkedHashMap<String,String[]>();
177                    Map<String,Integer> groupCountMap = new HashMap<String,Integer>();
178    //              Map<String,double[]> sumMap = new HashMap<String,double[]>();
179                    Map<String,BigDecimal[]> sumMap = new HashMap<String,BigDecimal[]>(); // 5.6.1.0 (2013/02/01)
180                    while( numberOfRows < maxRowCount && result.next() ) {
181                            StringBuilder groupKey = new StringBuilder();
182    //                      double[] sumVals = new double[config.getSumClmCount()];
183                            BigDecimal[] sumVals = new BigDecimal[config.getSumClmCount()]; // 5.6.1.0 (2013/02/01) 
184                            String[] groupVals = new String[config.getGroupClmCount()];
185                            int sc = 0;
186                            int gc = 0;
187                            for( int column=0; column<numberOfColumns; column++ ) {
188                                    if( column != rowCountColumn ) {
189                                            String val = DBUtil.getValue( result, column, types[column] );
190                                            if( sumFilter[column] ) {
191                                                    // 5.3.9.0 (2011/09/01) 値がNULLの場合?対応漏れ
192    //                                              sumVals[sc++] = Double.valueOf( val );
193                                                    // sumVals[sc++] = ( val != null && val.length() > 0 ? Double.valueOf( val ) : 0 );
194                                                    sumVals[sc++] = ( val != null && val.length() > 0 ? new BigDecimal( val ) : new BigDecimal(0) ); // 5.6.1.0 (2013/02/01)
195                                            }
196                                            if( groupFilter[column] ) {
197                                                    groupVals[gc++] = val;
198                                                    groupKey.append( val ).append( JS );
199                                            }
200                                    }
201                            }
202    
203                            String key = groupKey.toString();
204                            int groupCount = 0;
205                            if( groupLinkedMap.containsKey( key ) ) {
206    //                              double[] eSumVals = sumMap.get( key );
207                                    BigDecimal[] eSumVals = sumMap.get( key ); // 5.6.1.0 (2013/02/01)
208                                    for( int i=0; i<config.getSumClmCount(); i++ ) {
209    //                                      sumVals[i] += eSumVals[i];
210                                            sumVals[i] = sumVals[i] == null ? new BigDecimal(0) : sumVals[i].add( eSumVals[i] ); // 5.6.1.0 (2013/02/01)
211                                    }
212                                    sumMap.put( key, sumVals );
213                                    groupCount = groupCountMap.get( key ).intValue() + 1;
214                            }
215                            else {
216                                    groupLinkedMap.put( key, groupVals );
217                                    groupCount = 1;
218                                    numberOfRows++;
219                            }
220                            sumMap.put( key, sumVals );
221                            groupCountMap.put( key, Integer.valueOf( groupCount ) );
222                    }
223    
224                    for( Map.Entry<String, String[]> entry : groupLinkedMap.entrySet() ) {
225                            String key = entry.getKey();
226                            addRow( groupFilter, entry.getValue(), groupCountMap.get( key ), sumFilter, sumMap.get( key ) );
227                    }
228    
229                    // ?件数が??た?合でかつ次の??タがある?合?、オーバ?フロー
230                    if( numberOfRows >= maxRowCount && result.next() ) {
231                            setOverflow( true );
232                    }
233            }
234    
235            /**
236             * 検索結果オブジェクトを?読み取り、そのままDBTableModelの行を追?ます?
237             *
238             * @og.rev 5.5.2.4 (2012/05/16) int[] types は使われて???で、削除します?
239             *
240             * @param result 検索結果オブジェク?
241             * @param skipRowCount 読み飛?し件数
242             * @param maxRowCount ?検索件数
243             * @throws      SQLException
244             */
245    //      private void addPlainRows( final ResultSet result, final int[] types, final int skipRowCount, final int maxRowCount ) throws SQLException {
246            private void addPlainRows( final ResultSet result, final int skipRowCount, final int maxRowCount ) throws SQLException {
247                    int numberOfRows = 0;
248                    while( numberOfRows < skipRowCount && result.next() ) {
249                            // 注?resultSet.next() を?に判定すると??件読み飛?してしま??
250                            numberOfRows ++ ;
251                    }
252                    numberOfRows = 0;
253    
254                    while( numberOfRows < maxRowCount && result.next() ) {
255                            numberOfRows++ ;
256                            String[] columnValues = new String[numberOfColumns];
257                            for( int column=0; column<numberOfColumns; column++ ) {
258                                    if( column != rowCountColumn ) {
259                                            Object obj = result.getObject(column+1);
260                                            columnValues[column] = ( obj == null ? "" : String.valueOf( obj ) );
261                                    }
262                                    else {
263                                            columnValues[column] = "";
264                                    }
265                            }
266                            addColumnValues( columnValues );
267                    }
268    
269                    // ?件数が??た?合でかつ次の??タがある?合?、オーバ?フロー
270                    if( numberOfRows >= maxRowCount && result.next() ) {
271                            setOverflow( true );
272                    }
273            }
274    
275            /**
276             * DBTableModelのソート??行います?
277             *
278             */
279            private void sort() {
280                    // orderByClmsによる並び替?
281                    DBTableModelSorter temp = new DBTableModelSorter();
282                    temp.setModel( this );
283                    String[] oClms = StringUtil.csv2Array( config.getOrderByClms() );
284                    for( int i=oClms.length-1; i>=0; i-- ) {
285                            String oc = oClms[i];
286                            boolean ascending = true;
287                            if( oc.startsWith( "!" ) ) {
288                                    oc = oc.substring( 1 );
289                                    ascending = false;
290                            }
291                            int clmNo = getColumnNo( oc );
292                            temp.sortByColumn( clmNo, ascending );
293                    }
294                    this.data = temp.data;
295                    this.rowHeader = temp.rowHeader;
296            }
297    
298            /**
299             * DBTableModelから??タを読み取り、エ??設定情報を?に合計行?追???行います?
300             * 合計行?追??、キーブレイクにより行われます?で、同じキーが?回?現した場合??
301             * それぞれの行に対して、合計行が付加されます?
302             *
303             * @og.rev 5.3.7.0 (2011/07/01) 小計?合計行追???オーバ?フローフラグがセ?されな?グを修正
304             * @og.rev 5.6.1.0 (2013/02/01) 誤差回避のため、doubleではなくdecimalで計算す?
305             * @og.rev 5.6.8.1 (2013/09/13) 1行目が合計されて?かった?で修正
306             *
307             * @param       maxRowCount ?検索件数
308             * @param       resource リソースマネージャー
309             * @param       sumFilter ??目フィルター
310             * @param       groupFilter グループキーフィルター
311             * @param       subTotalFilter 小計キーフィルター
312             * @param       totalFilter 合計キーフィルター
313             *
314             * @return      オーバ?フローしたかど?(?件数が?た?合でかつ次の??タがある?合?、true)
315             */
316            private boolean addTotalRows( final int maxRowCount, final ResourceManager resource, final boolean[] sumFilter
317                                                                            ,  final boolean[] groupFilter, final boolean[] subTotalFilter,  final boolean[] totalFilter ) {
318    
319                    String subTotalLabel = ( config.useSubTotal() ? resource.makeDBColumn( "EDIT_SUBTOTAL_VALUE" ).getLongLabel() : null );
320                    String totalLabel = ( config.useTotal() ? resource.makeDBColumn( "EDIT_TOTAL_VALUE" ).getLongLabel() : null );
321                    String grandTotalLabel = ( config.useGrandTotal() ? resource.makeDBColumn( "EDIT_GRANDTOTAL_VALUE" ).getLongLabel() : null );
322    
323                    int numberOfRows = getRowCount();
324                    int sumClmCount = config.getSumClmCount();
325    //              double subTotalSum[] = new double[sumClmCount];
326    //              double totalSum[] = new double[sumClmCount];
327    //              double grandTotalSum[] = new double[sumClmCount];
328                    BigDecimal subTotalSum[] = new BigDecimal[sumClmCount]; // 5.6.1.0 (2013/02/01)
329                    BigDecimal totalSum[] = new BigDecimal[sumClmCount];
330                    BigDecimal grandTotalSum[] = new BigDecimal[sumClmCount];
331    
332                    String lastSubTotalKey = null;
333                    String lastTotalKey = null;
334    
335                    int subTotalCount = 0;
336                    int totalCount = 0;
337                    int grandTotalCount = 0;
338                    int rowCount =0;
339    
340                    int tblIdx = 0;
341                    while( numberOfRows < maxRowCount && tblIdx < getRowCount() ) {
342    //                      double[] sumVals = new double[sumClmCount];
343                            BigDecimal[] sumVals = new BigDecimal[sumClmCount]; // 5.6.1.0 (2013/02/01)
344                            StringBuilder groupKey = new StringBuilder();
345                            StringBuilder subTotalKey = new StringBuilder();
346                            StringBuilder totalKey = new StringBuilder();
347    
348                            int sc = 0;
349                            for( int column=0; column<numberOfColumns; column++ ) {
350                                    String val = getValue( tblIdx, column );
351                                    if( groupFilter[column] )               { groupKey.append( val ).append( JS ); }
352    //                              if( sumFilter[column] )                 { sumVals[sc++] = ( val != null && val.length() > 0 ? Double.valueOf( val ) : 0 ); }
353                                    if( sumFilter[column] )                 { sumVals[sc++] = ( val != null && val.length() > 0 ? new BigDecimal( val ) : new BigDecimal(0) ); } // 5.6.1.0 (2013/02/01)
354                                    if( subTotalFilter[column] )    { subTotalKey.append( val ).append( JS ); }
355                                    if( totalFilter[column] )               { totalKey.append( val ).append( JS ); }
356                                    if( column == rowCountColumn )  { rowCount = ( val != null && val.length() > 0 ? Integer.valueOf( val ) : 0 ); }
357                            }
358    
359                            // 小計キーブレイク処?
360                            if( numberOfRows < maxRowCount && config.useSubTotal() && lastSubTotalKey != null && lastSubTotalKey.length() > 0
361                                    && !lastSubTotalKey.equals( subTotalKey.toString() ) ) {
362                                    addRow( subTotalFilter, subTotalLabel, subTotalCount, sumFilter, subTotalSum, tblIdx );
363    //                              subTotalSum = new double[sumClmCount];
364                                    subTotalSum = new BigDecimal[sumClmCount]; // 5.6.1.0 (2013/02/01)
365                                    subTotalCount = 0;
366                                    numberOfRows++;
367                                    tblIdx++;
368                            }
369    
370                            // 合計キーブレイク処?
371                            if( numberOfRows < maxRowCount && config.useTotal() && lastTotalKey != null && lastTotalKey.length() > 0
372                                    && !lastTotalKey.equals( totalKey.toString() ) ) {
373                                    addRow( totalFilter, totalLabel, totalCount, sumFilter, totalSum, tblIdx );
374    //                              totalSum = new double[sumClmCount];
375                                    totalSum = new BigDecimal[sumClmCount]; // 5.6.1.0 (2013/02/01)
376                                    totalCount = 0;
377                                    numberOfRows++;
378                                    tblIdx++;
379                            }
380    
381                            // 小計?合計?総合計単位に??目の合計?を加算します?
382                            for( int cnt=0; cnt<sumClmCount; cnt++ ) {
383    //                              subTotalSum[cnt] += sumVals[cnt];
384    //                              totalSum[cnt] += sumVals[cnt];
385    //                              grandTotalSum[cnt] += sumVals[cnt];
386    //                              subTotalSum[cnt] = subTotalSum[cnt] == null ? new BigDecimal(0) : subTotalSum[cnt].add(sumVals[cnt]); // 5.6.1.0 (2013/02/01)
387    //                              totalSum[cnt] = totalSum[cnt] == null ? new BigDecimal(0) : totalSum[cnt].add(sumVals[cnt]);
388    //                              grandTotalSum[cnt] = grandTotalSum[cnt] == null ? new BigDecimal(0) : grandTotalSum[cnt].add(sumVals[cnt]);
389                                    subTotalSum[cnt] = subTotalSum[cnt] == null ? new BigDecimal(0).add(sumVals[cnt]) : subTotalSum[cnt].add(sumVals[cnt]); // 5.6.8.1 (2013/09/13)
390                                    totalSum[cnt] = totalSum[cnt] == null ? new BigDecimal(0).add(sumVals[cnt]) : totalSum[cnt].add(sumVals[cnt]);
391                                    grandTotalSum[cnt] = grandTotalSum[cnt] == null ? new BigDecimal(0).add(sumVals[cnt]) : grandTotalSum[cnt].add(sumVals[cnt]);
392    
393                            }
394    
395                            lastSubTotalKey = subTotalKey.toString();
396                            lastTotalKey = totalKey.toString();
397    
398                            // グループ集計時はグルーピングした行数を加算する?
399                            int gcnt = 1;
400                            if( config.useGroup() && rowCountColumn >= 0 && rowCount > 0 ) {
401                                    gcnt = rowCount;
402                            }
403                            subTotalCount += gcnt;
404                            totalCount    += gcnt;
405                            grandTotalCount += gcnt;
406    
407                            tblIdx++;
408                    }
409    
410                    // ?件数が??た?合でかつ次の??タがある?合?、オーバ?フロー
411                    boolean isOverFlow = ( tblIdx < getRowCount() );
412    
413                    // 小計キー?行??
414                    if( config.useSubTotal() && lastSubTotalKey != null ) {
415                            if( numberOfRows < maxRowCount ) {
416                                    addRow( subTotalFilter, subTotalLabel, subTotalCount, sumFilter, subTotalSum, tblIdx );
417                                    numberOfRows++;
418                                    tblIdx++;
419                            }
420                            else {
421                                    isOverFlow = true;
422                            }
423                    }
424    
425                    // 合計キー?行??
426                    if( config.useTotal() && lastTotalKey != null ) {
427                            if( numberOfRows < maxRowCount ) {
428                                    addRow( totalFilter, totalLabel, totalCount, sumFilter, totalSum, tblIdx );
429                                    numberOfRows++;
430                                    tblIdx++;
431                            }
432                            else {
433                                    isOverFlow = true;
434                            }
435                    }
436    
437                    // 総合計??
438                    if( config.useGrandTotal() && numberOfRows > 0 ) {
439                            if( numberOfRows < maxRowCount ) {
440                                    boolean[] grandTotalFilter = new boolean[numberOfColumns];
441                                    // 総合計?ラベル表示?
442                                    // grandTotalFilter[0] = true;
443                                    addRow( grandTotalFilter, grandTotalLabel, grandTotalCount, sumFilter, grandTotalSum, tblIdx );
444                                    numberOfRows++;
445                                    tblIdx++;
446                            }
447                            else {
448                                    isOverFlow = true;
449                            }
450                    }
451    
452                    if( isOverFlow ) {
453                            setOverflow( true );
454                    }
455    
456                    return isOverFlow;
457            }
458    
459            /**
460             * キーの値配??計?の配?を引数として、追?を生?し?DBTableModelに追?ます?
461             * キー、及び??がDBTableModel上?どのカラ?位置するか?、キーフィルタ?計フィルタで?します?
462             * 
463             * @og.rev 5.6.1.0 (2013/02/01) doubleをdecimalに
464             *
465             * @param keyFilter キーフィルタ
466             * @param keyVals キーの値配?
467             * @param keyCount ?した行?カウン?
468             * @param sumFilter ?フィルタ
469             * @param sumVals ??配?
470             * @param aRow 挿入する行番号
471             */
472    //      private void addRow( final boolean[] keyFilter, final String[] keyVals, final int keyCount
473    //                                                      , final boolean[] sumFilter, final double[] sumVals, final int aRow ) {
474            private void addRow( final boolean[] keyFilter, final String[] keyVals, final int keyCount
475                            , final boolean[] sumFilter, final BigDecimal[] sumVals, final int aRow ) {
476                    String[] columnValues = new String[numberOfColumns];
477                    int sc = 0;
478                    int kc = 0;
479                    for( int column=0; column<numberOfColumns; column++ ) {
480                            String val = "";
481                            if( keyFilter[column] ) {
482                                    val = keyVals[kc++];
483                            }
484                            if( sumFilter[column] ) {
485                                    val = FORMAT.format( sumVals[sc++] );
486                            }
487                            if( column == rowCountColumn ) {
488                                    val = String.valueOf( keyCount );
489                            }
490                            columnValues[column] = val;
491                    }
492    
493                    if( aRow < 0 ) {
494                            addColumnValues( columnValues );
495                    }
496                    else {
497                            addValues( columnValues, aRow, false );
498                    }
499            }
500    
501            /**
502             * キーの値配??計?の配?を引数として、追?を生?し?DBTableModelに追?ます?
503             * キー、及び??がDBTableModel上?どのカラ?位置するか?、キーフィルタ?計フィルタで?します?
504             * 
505             * @og.rev 5.6.1.0 (2013/02/01) doubleをbigDecimal
506             *
507             * @param keyFilter キーフィルタ
508             * @param keyVals キーの値配?
509             * @param keyCount ?した行?カウン?
510             * @param sumFilter ?フィルタ
511             * @param sumVals ??配?
512             */
513    //      private void addRow( final boolean[] keyFilter, final String[] keyVals, final int keyCount
514    //                                                      , final boolean[] sumFilter, final double[] sumVals ) {
515            private void addRow( final boolean[] keyFilter, final String[] keyVals, final int keyCount
516                            , final boolean[] sumFilter, final BigDecimal[] sumVals ) {
517                    addRow( keyFilter, keyVals, keyCount, sumFilter, sumVals, -1 );
518            }
519    
520            /**
521             * キーの値?計?の配?を引数として、追?を生?し?DBTableModelに追?ます?
522             * キー、及び??がDBTableModel上?どのカラ?位置するか?、キーフィルタ?計フィルタで?します?
523             * 
524             * @og.rev 5.6.1.0 (2013/02/01) doubleをbigDecimalに
525             *
526             * @param keyFilter キーフィルタ
527             * @param keyVal キーの値
528             * @param keyCount ?した行?カウン?
529             * @param sumFilter ?フィルタ
530             * @param sumVals ??配?
531             * @param aRow 挿入する行番号
532             */
533    //      private void addRow( final boolean[] keyFilter, final String keyVal, final int keyCount
534    //                                                      , final boolean[] sumFilter, final double[] sumVals, final int aRow ) {
535            private void addRow( final boolean[] keyFilter, final String keyVal, final int keyCount
536                            , final boolean[] sumFilter, final BigDecimal[] sumVals, final int aRow ) {
537                    List<String> tmp = new ArrayList<String>();
538                    for( int column=0; column<numberOfColumns; column++ ) {
539                            if( keyFilter[column] ) {
540                                    tmp.add( keyVal );
541                            }
542                    }
543    //              addRow( keyFilter, tmp.toArray( new String[0] ), keyCount, sumFilter, sumVals, aRow );
544                    addRow( keyFilter, tmp.toArray( new String[tmp.size()] ), keyCount, sumFilter, sumVals, aRow );
545            }
546    }