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