001/*
002 * Copyright (c) 2009 The openGion Project.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *     http://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
013 * either express or implied. See the License for the specific language
014 * governing permissions and limitations under the License.
015 */
016package org.opengion.hayabusa.report2;
017
018// import java.io.File;
019import java.util.Map;                                                                                   // 8.0.3.0 (2021/12/17)
020
021import org.opengion.fukurou.system.OgRuntimeException ;                 // 6.4.2.0 (2016/01/29)
022//import org.opengion.fukurou.util.StringUtil;                                  // 6.9.8.1 (2018/06/11) 7.4.4.0 (2021/06/30) Delete
023import org.opengion.hayabusa.db.DBTableModel;
024import static org.opengion.fukurou.system.HybsConst.BUFFER_MIDDLE;      // 6.1.0.0 (2014/12/26) refactoring
025import static org.opengion.fukurou.system.HybsConst.CR ;                // 8.0.3.0 (2021/12/17)
026import static org.opengion.fukurou.system.HybsConst.FS ;                // 8.0.3.0 (2021/12/17)
027
028/**
029 * 帳票処理要求を管理するキューオブジェクトです。
030 * このオブジェクトでは、帳票の定義及びデータと、処理中に発生したエラーメッセージを管理します。
031 * また、このキューを生成したオブジェクトもこのオブジェクトにセットされます。
032 *
033 * @og.group 帳票システム
034 *
035 * @version  4.0
036 * @author   Hiroki.Nakamura
037 * @since    JDK1.6
038 */
039public class ExecQueue {
040
041        /** 実行方法(FGRUN) {@value} */
042        protected static final String OUT_ODS_ONLY              = "1";          // 変換のみ
043        /** 実行方法(FGRUN) {@value} */
044        protected static final String OUT_PRINT_ONLY    = "2";          // (印刷のみ)
045        /** 実行方法(FGRUN) {@value} */
046        protected static final String OUT_ODS_PRINT             = "3";          // プリンタ出力
047        /** 実行方法(FGRUN) {@value} */
048        protected static final String OUT_ODS_PDF               = "P";          // PDF出力
049        /** 実行方法(FGRUN) {@value} */
050        protected static final String OUT_ODS_PRINT_PDF = "Q";          // PDF+印刷
051        /** 実行方法(FGRUN) {@value} */
052        protected static final String OUT_ODS_EXCEL             = "E";          // Excel出力
053        /** 実行方法(FGRUN) {@value} */
054        protected static final String OUT_ODS_XLSX              = "F";          // 8.0.1.0 (2021/10/29) Excel2007形式
055        /** 実行方法(FGRUN) {@value} */
056        protected static final String OUT_ODS_ODS               = "S";          // ODS出力 4.3.3.4 (2008/11/01) 追加
057
058        /** 8.0.3.0 (2021/12/17) 実行方法(FGRUN)をタイプ:拡張子に変換するMap */
059        private static final Map<String,String> FGRUN2TYPE = Map.of(
060                OUT_ODS_EXCEL , ".xls" , OUT_ODS_XLSX      , ".xlsx" ,
061                OUT_ODS_PDF   , ".pdf" , OUT_ODS_PRINT_PDF , ".pdf"  ,
062                OUT_ODS_ODS   , ".ods"
063        );
064
065        // 7.4.4.0 (2021/06/30) openGionV8事前準備(EXCEL取込廃止、RFID出力廃止)
066        // /** 実行方法 {@value} */
067        // protected static final String IN_INPUT_ONLY  = "5";          // (取込のみ)
068        // /** 実行方法 {@value} */
069        // protected static final String IN_EXEC_ONLY   = "6";          // (PG起動)
070        // /** 実行方法 {@value} */
071        // protected static final String IN_INPUT_EXEC  = "7";          // 取込・PG起動
072        // /** 実行方法 {@value} */
073        // protected static final String RFID_PRINT             = "A";          // RFID(通常印刷)
074        // /** 実行方法 {@value} */
075        // protected static final String RFID_ALLPRINT  = "B";          // RFID(全印刷)
076        // /** 実行方法 {@value} */
077        // protected static final String RFID_ALLERASE  = "C";          // RFID(全消去)
078        // /** 実行方法 {@value} */
079        // protected static final String RFID_SEQERASE  = "D";          // RFID(連続消去)
080
081        //      // 8.0.1.0 (2021/10/29) CSV出力対応(ユリニタ帳票)は、一旦保留にします。
082        //      // 5.9.0.0 (2015/09/04) CSV出力対応
083        //      /** 実行方法 {@value} */
084        //      protected static final String CSV_PRINT                 = "G";
085        //      /** 実行方法 {@value} */
086        //      protected static final String CSV_PRINT_EXCEL   = "H";
087        //      /** 実行方法 {@value} */
088        //      protected static final String CSV_PRINT_PDF             = "I";
089        //      /** 実行方法 {@value} */
090        //      protected static final String CSV_PRINT_EXCEL2  = "J";          // 5.9.4.2 (2016/01/15) EXCEL2追加
091
092        /** 最大シート数 {@value} */
093//      protected static final int MAX_SHEETS_PER_FILE  = 256;          // 5.1.2.0 (2010/01/01)
094        protected static final int MAX_SHEETS_PER_FILE  = 999;          // 7.1.0.0 (2020/01/27) 256シート制限を999にしておく。
095
096        private DBTableModel body               ;
097        private DBTableModel header             ;
098        private DBTableModel footer             ;
099
100        private String[]        bodyTypes       ;               // 8.0.3.0 (2021/12/17)
101
102        private String          systemId        ;
103        private String          ykno            ;
104        private String          listId          ;
105        private String          outputName      ;
106        private String          pdfPasswd       ;
107        private String          lang            ;
108        private String          outputType      ;               // 実行方法(FGRUN)
109        private String          threadId        ;
110        private String          templateName;
111        private String          printerName     ;
112        private boolean         fglocal         ;
113        private boolean         fgcut           ;
114        private QueueManager manager    ;
115//      private String          prgdir          ;               // 4.3.3.0 (2008/10/01) 板金RFID対応。
116//      private String          prgfile         ;               // 4.3.3.0 (2008/10/01)
117//      private String          prtid           ;               // 4.3.3.0 (2008/10/01)
118
119//      private String          grpid           ;               // 5.9.2.2 (2015/11/20)
120//      private String          dmngrp          ;               // 5.9.2.2 (2015/11/20)
121        private int                     pageCnt         ;               // 5.1.2.0 (2010/01/01) 処理したページ数
122        private int                     rowCnt          ;               // 5.1.2.0 (2010/01/01) 処理した行数
123        private boolean         isDataEnd       ;               // 5.1.2.0 (2010/01/01) 全データが処理されたか (メソッド名と同じ変数名変更)
124
125        private boolean         useSheetName;           // 5.7.6.2 (2014/05/16) PAGEBREAKカラムの値を、シート名として使うかどうか。
126//      private String          fgnoml          = "0";  // 5.10.0.0 (2018/06/08) メール不要フラグ
127        //private boolean       fgnoml          ;               // 6.9.8.1 (2018/06/11) 帳票エラーメールの改修(メール不要フラグ=trueで不要、falseが必要) 7.4.4.0 (2021/06/30) Delete
128
129        private final StringBuilder errMsgBuf = new StringBuilder( BUFFER_MIDDLE );
130
131        /**
132         * デフォルトコンストラクター
133         *
134         * @og.rev 6.4.2.0 (2016/01/29) PMD refactoring. Each class should declare at least one constructor.
135         */
136        public ExecQueue() { super(); }         // これも、自動的に呼ばれるが、空のメソッドを作成すると警告されるので、明示的にしておきます。
137
138        /**
139         * 要求NOをセットします。
140         *
141         * @param ykno 要求NO
142         */
143        public void setYkno( final String ykno ) {
144                this.ykno = ykno;
145        }
146
147        /**
148         * 要求NOを取得します。
149         *
150         * @return      要求NO
151         */
152        public String getYkno() {
153                return ykno;
154        }
155
156        /**
157         * システムIDをセットします。
158         *
159         * @param systemId システムID
160         */
161        public void setSystemId( final String systemId ) {
162                this.systemId = systemId;
163        }
164
165        /**
166         * システムIDを取得します。
167         *
168         * @return  StringシステムID
169         */
170        public String getSystemId() {
171                return systemId;
172        }
173
174        /**
175         * ボディー部分のDBTableModelをセットします。
176         *
177         * @param body DBTableModelオブジェクト
178         */
179        public void setBody( final DBTableModel body ) {
180                this.body = body;
181        }
182
183        /**
184         * ボディー部分のDBTableModelを取得します。
185         *
186         * @return      ボディー部分のDBTableModelオブジェクト
187         */
188        public DBTableModel getBody() {
189                return body;
190        }
191
192        /**
193         * ボディー部分のテキスト区分の配列をセットします。
194         *
195         * @og.rev 8.0.3.0 (2021/12/17) 新規追加
196         *
197         * @param bodyTypes ボディー部分のテキスト区分の配列
198         */
199        public void setBodyTypes( final String[] bodyTypes ) {
200                this.bodyTypes = bodyTypes;
201        }
202
203        /**
204         * ボディー部分のテキスト区分の配列を取得します。
205         *
206         * @og.rev 8.0.3.0 (2021/12/17) 新規追加
207         *
208         * @return      ボディー部分のテキスト区分の配列
209         */
210        public String[] getBodyTypes() {
211                return bodyTypes;
212        }
213
214        /**
215         * ヘッダー部分のDBTableModelをセットします。
216         *
217         * @param header DBTableModelオブジェクト
218         */
219        public void setHeader( final DBTableModel header ) {
220                this.header = header;
221        }
222
223        /**
224         * ヘッダー部分のDBTableModelを取得します。
225         *
226         * @return      ヘッダー部分のDBTableModelオブジェクト
227         */
228        public DBTableModel getHeader() {
229                return header;
230        }
231
232        /**
233         * フッター部分のDBTableModelをセットします。
234         *
235         * @param footer DBTableModelオブジェクト
236         */
237        public void setFooter( final DBTableModel footer ) {
238                this.footer = footer;
239        }
240
241        /**
242         * フッター部分のDBTableModelを取得します。
243         *
244         * @return      フッター部分のDBTableModelオブジェクト
245         */
246        public DBTableModel getFooter() {
247                return footer;
248        }
249
250        /**
251         * 帳票IDをセットします。
252         *
253         * @param listId 帳票ID
254         */
255        public void setListId( final String listId ) {
256                this.listId = listId;
257        }
258
259        /**
260         * 帳票IDを取得します。
261         *
262         * @return 帳票ID
263         */
264        public String getListId() {
265                return listId;
266        }
267
268        /**
269         * PDFパスワードをセットします。
270         *
271         * @param pdfPasswd PDFパスワード
272         */
273        public void setPdfPasswd( final String pdfPasswd ) {
274                this.pdfPasswd = pdfPasswd;
275        }
276
277        /**
278         * PDFパスワードを取得します。
279         *
280         * @return PDFパスワード
281         */
282        public String getPdfPasswd() {
283                return pdfPasswd;
284        }
285
286        /**
287         * 言語をセットします。
288         *
289         * @param lang 言語
290         */
291        public void setLang( final String lang ) {
292                this.lang = lang;
293        }
294
295        /**
296         * 言語を取得します。
297         *
298         * @return 言語
299         */
300        public String getLang() {
301                return lang;
302        }
303
304        /**
305         * 雛形ファイル名をセットします。
306         *
307         * @param templateName 雛形ファイル名
308         */
309        public void setTemplateName( final String templateName ) {
310                this.templateName = templateName;
311        }
312
313        /**
314         * 雛形ファイル名を取得します。
315         *
316         * @return 帳票雛形ファイル名
317         */
318        public String getTemplateName() {
319                return templateName;
320        }
321
322        /**
323         * 実行方法(FGRUN)をセットします。
324         *
325         * @param outputType 実行方法(FGRUN)
326         */
327        public void setOutputType( final String outputType ) {
328                this.outputType = outputType;
329        }
330
331        /**
332         * 出力タイプ:実行方法(FGRUN)を取得します。
333         *
334         * @return 出力タイプ:実行方法(FGRUN)
335         */
336        public String getOutputType() {
337                return outputType;
338        }
339
340        /**
341         * プリンター名をセットします。
342         *
343         * @param  printerName プリンター名
344         */
345        public void setPrinterName( final String printerName ) {
346                this.printerName = printerName;
347        }
348
349        /**
350         * プリンター名を取得します。
351         *
352         * @return プリンタ名
353         */
354        public String getPrinterName() {
355                return printerName;
356        }
357
358        /**
359         * 処理要求を処理するスレッドIDをセットします。
360         *
361         * @param threadId スレッドID
362         */
363        public void setThreadId( final String threadId ) {
364                this.threadId = threadId;
365        }
366
367        /**
368         * 処理要求を処理するスレッドIDを取得します。
369         *
370         * @return スレッドID
371         */
372        public String getThreadId() {
373                return threadId;
374        }
375
376        /**
377         * 出力ファイル名をセットします。
378         *
379         * @param outputName 出力ファイル名
380         */
381        public void setOutputName( final String outputName ) {
382                this.outputName = outputName;
383        }
384
385        /**
386         * 出力ファイル名を設定します。
387         * GE50に設定されていない場合は第四引数(要求番号)を利用する。
388         * その場合、タイプ:実行方法(FGRUN)に応じた拡張子が自動設定される。
389         *
390         * ".xls" : OUT_ODS_EXCEL
391         * ".xlsx" : OUT_ODS_XLSX                       // 8.0.1.0 (2021/10/29)
392         * ".pdf" : OUT_ODS_PDF , OUT_ODS_PRINT_PDF
393         * ".ods" : OUT_ODS_ODS
394//       * ".xml" : RFID_PRINT , RFID_ALLPRINT , RFID_ALLERASE , RFID_SEQERASE 7.4.4.0 (2021/06/30) Delete
395//       * ".csv" : CSV_PRINT , CSV_PRINT_EXCEL , CSV_PRINT_PDF
396         *
397         * @og.rev 4.3.3.4 (2008/11/01) ODS出力対応
398         * @og.rev 5.4.3.0 (2011/12/26) RFIDデフォルト対応
399         * @og.rev 5.4.4.1 (2012/02/03) RFID拡張子変更
400         * @og.rev 5.9.0.0 (2015/09/04) CSV対応
401         * @og.rev 7.4.4.0 (2021/06/30) openGionV8事前準備(RFID出力廃止)
402         * @og.rev 8.0.1.0 (2021/10/29) CSV出力対応(ユリニタ帳票)は、一旦保留にします。
403         * @og.rev 8.0.1.0 (2021/10/29) OUT_ODS_XLSX (Excel2007形式) 評価用
404         *
405         * @param       outputDir       出力ディレクトリ名
406         * @param       outputFile      出力ファイル名
407//       * @param       type            タイプ:実行方法(FGRUN)
408         * @param       fgrun           実行方法(FGRUN)
409         * @param       yokyu           要求番号(ファイル名が指定されていない場合のファイル名)
410         *
411         */
412//      public void setOutputName( final String outputDir, final String outputFile, final String type, final String yokyu ){
413        public void setOutputName( final String outputDir, final String outputFile, final String fgrun, final String yokyu ){
414                final StringBuilder filePath = new StringBuilder( BUFFER_MIDDLE );
415//              filePath.append( outputDir ).append( File.separator );          // 6.0.2.5 (2014/10/31) char を append する。
416                filePath.append( outputDir ).append( FS );              // 6.0.2.5 (2014/10/31) char を append する。
417
418                if( outputFile == null || outputFile.isEmpty() ){ // ファイル名が指定されていない場合は要求番号を利用する。
419                        final String type = FGRUN2TYPE.getOrDefault​( fgrun,".txt" );
420                        filePath.append( yokyu );
421                        filePath.append( type );
422
423//                      if( OUT_ODS_EXCEL.equals( type ) ){
424//                              filePath.append( yokyu );
425//                              filePath.append( ".xls" );
426//                      }
427//                      else if( OUT_ODS_XLSX.equals( type ) ){                 // 8.0.1.0 (2021/10/29)
428//                              filePath.append( yokyu );
429//                              filePath.append( ".xlsx" );
430//                      }
431//                      else if( OUT_ODS_PDF.equals( type ) || OUT_ODS_PRINT_PDF.equals( type ) ){
432//                              filePath.append( yokyu );
433//                              filePath.append( ".pdf" );
434//                      }
435//                      // 4.3.3.4 (2008/11/01) 追加
436//                      else if( OUT_ODS_ODS.equals ( type ) ){
437//                              filePath.append( yokyu );
438//                              filePath.append( ".ods" );
439//                      }
440                        // 5.4.3.0 (2011/12/26) 追加
441                        // 5.4.4.2 (2012/02/03) .txtではなく.xml
442                        // 7.4.4.0 (2021/06/30) Delete
443                        //else if( ExecQueue.RFID_PRINT.equals( type ) || ExecQueue.RFID_ALLPRINT.equals( type )
444                        //              || ExecQueue.RFID_ALLERASE.equals( type ) || ExecQueue.RFID_SEQERASE.equals( type ) ) {
445                        //      filePath.append( yokyu );
446                        //      filePath.append( ".xml" ); //txt-xml
447                        //}
448                        // 5.9.0.0 (2015/09/04) 追加
449                        // 5.9.4.2 (2016/01/13) EXCEL2追加
450                        // 8.0.1.0 (2021/10/29) CSV出力対応(ユリニタ帳票)は、一旦保留にします。
451                //      else if( ExecQueue.CSV_PRINT.equals( type ) || ExecQueue.CSV_PRINT_EXCEL.equals( type )
452                //                      || ExecQueue.CSV_PRINT_PDF.equals( type ) || ExecQueue.CSV_PRINT_EXCEL2.equals( type ) ) {
453                //              filePath.append( yokyu );
454                //              filePath.append( ".csv" );
455                //      }
456                }
457                else {
458                        filePath.append( outputFile );
459                }
460
461                this.outputName = filePath.toString();
462        }
463
464        /**
465         * 出力ファイル名を取得します。
466         *
467         * @og.rev 5.1.2.0 (2010/01/01) 256シートを超える場合に対応。2ファイル目以降は、_1、_2・・・をファイル名の後ろにつける
468         * @og.rev 6.3.9.0 (2015/11/06) コンストラクタで初期化されていないフィールドを null チェックなしで利用している(findbugs)
469         *
470         * @return 出力先ファイル名
471         * @og.rtnNotNull
472         */
473        public String getOutputName() {
474                // 6.3.9.0 (2015/11/06) コンストラクタで初期化されていないフィールドを null チェックなしで利用している(findbugs)
475                if( outputName == null ) {
476                        final String errMsg = "#setOutputName(…)を先に実行しておいてください。" ;
477                        throw new OgRuntimeException( errMsg );
478                }
479
480                if( pageCnt <= MAX_SHEETS_PER_FILE ) {
481                        return outputName;
482                }
483                else {
484                        final StringBuilder fileName = new StringBuilder( BUFFER_MIDDLE );
485
486                        final int idx = outputName.lastIndexOf( '.' );
487                        final String name = outputName.substring( 0, idx );
488                        final String suffix = outputName.substring( idx );
489                        final int addNo = (int)Math.ceil( (double)pageCnt/(double)MAX_SHEETS_PER_FILE ) - 1;
490
491                        fileName.append( name ).append( '_' ).append( addNo ).append( suffix );         // 6.0.2.5 (2014/10/31) char を append する。
492
493                        return fileName.toString();
494                }
495        }
496
497//      /**
498//       * 実行ファイルディレクトリを指定します。
499//       *
500//       * @og.rev 4.3.3.0 (2008/10/01) 板金RFID対応
501//       * @og.rev 8.0.3.0 (2021/12/17) 未使用なので削除
502//       *
503//       * @param dir ディレクトリ
504//       */
505//      public void setPrgDir( final String dir ) {
506//              this.prgdir = dir;
507//      }
508
509//      /**
510//       * 実行ファイルディレクトリを取得します。
511//       *
512//       * @og.rev 4.3.3.0 (2008/10/01) 板金RFID対応
513//       * @og.rev 8.0.3.0 (2021/12/17) 未使用なので削除
514//       *
515//       * @return プログラムディレクトリ
516//       */
517//      public String getPrgDir() {
518//              return prgdir;
519//      }
520
521//      /**
522//       * 実行ファイル名をセットします。
523//       *
524//       * @og.rev 4.3.3.0 (2008/10/01) 板金RFID対応
525//       * @og.rev 8.0.3.0 (2021/12/17) 未使用なので削除
526//       *
527//       * @param       file    ファイル名
528//       */
529//      public void setPrgFile( final String file ) {
530//              this.prgfile = file;
531//      }
532
533//      /**
534//       * 実行ファイル名を取得します。
535//       *
536//       * @og.rev 4.3.3.0 (2008/10/01) 板金RFID対応
537//       * @og.rev 8.0.3.0 (2021/12/17) 未使用なので削除
538//       *
539//       * @return プログラムファイル名
540//       */
541//      public String getPrgFile() {
542//              return prgfile;
543//      }
544
545//      /**
546//       * プリンタIDをセットします。
547//       *
548//       * @og.rev 4.3.3.0 (2008/10/01) 板金RFID対応
549//       * @og.rev 8.0.3.0 (2021/12/17) 未使用なので削除
550//       *
551//       * @param       id      プリンタID
552//       */
553//      public void setPrtId( final String id ) {
554//              this.prtid = id;
555//      }
556
557//      /**
558//       * プリンタIDを取得します。
559//       *
560//       * @og.rev 4.3.3.0 (2008/10/01) 板金RFID対応
561//       * @og.rev 8.0.3.0 (2021/12/17) 未使用なので削除
562//       *
563//       * @return プリンタID
564//       */
565//      public String getPrtId() {
566//              return prtid;
567//      }
568
569//      /**
570//       * グループIDをセットします。
571//       *
572//       * @og.rev 5.9.2.2 (2015/11/20)
573//       * @og.rev 8.0.3.0 (2021/12/17) 未使用なので削除
574//       *
575//       * @param       id      グループID
576//       */
577//      public void setGrpId( final String id ) {
578//              this.grpid = id;
579//      }
580
581//      /**
582//       * グループIDを取得します。
583//       *
584//       * @og.rev 5.9.2.2 (2015/11/20)
585//       * @og.rev 8.0.3.0 (2021/12/17) 未使用なので削除
586//       *
587//       * @return グループID
588//       */
589//      public String getGrpId() {
590//              return grpid;
591//      }
592
593//      /**
594//       * デーモングループをセットします。
595//       *
596//       * @og.rev 5.9.2.2 (2015/11/20)
597//       * @og.rev 8.0.3.0 (2021/12/17) 未使用なので削除
598//       *
599//       * @param       name    デーモングループ
600//       */
601//      public void setDmnGrp( final String name ) {
602//              this.dmngrp = name;
603//      }
604
605//      /**
606//       * デーモングループを取得します。
607//       *
608//       * @og.rev 5.9.2.2 (2015/11/20)
609//       * @og.rev 8.0.3.0 (2021/12/17) 未使用なので削除
610//       *
611//       * @return デーモングループ
612//       */
613//      public String getDmnGrp() {
614//              return dmngrp;
615//      }
616
617        /**
618         * ローカルリソース使用フラグをセットします(初期値:false)。
619         *
620         * @param       fglocal ローカルリソース使用フラグ[true:使用する/false:使用しない]
621         */
622        public void setFglocal( final boolean fglocal ) {
623                this.fglocal = fglocal;
624        }
625
626        /**
627         * ローカルリソース使用フラグを取得します。
628         *
629         * @return ロールリソース使用フラグ[true:使用する/false:使用しない]
630         */
631        public boolean isFglocal() {
632                return fglocal;
633        }
634
635        /**
636         * ページエンドカットフラグをセットします(初期値:false)。
637         *
638         * @param fgcut ページエンドカットの使用可否[true:使用/false:通常]
639         */
640        public void setFgcut( final boolean fgcut ) {
641                this.fgcut = fgcut;
642        }
643
644        /**
645         * ページエンドカットフラグを取得します。
646         *
647         * @return ページエンドカットフラグ
648         */
649        public boolean isFgcut() {
650                return fgcut;
651        }
652
653        /**
654         * PAGEBREAKカラムの値を、シート名として使うかどうかをセットします(初期値:false)。
655         *
656         * @og.rev 5.7.6.2 (2014/05/16) 新規追加
657         *
658         * @param useSheetName PAGEBREAKカラムのシート名使用可否[true:使用/false:使用しない]
659         */
660        public void setUseSheetName( final boolean useSheetName ) {
661                this.useSheetName = useSheetName;
662        }
663
664        /**
665         * PAGEBREAKカラムの値を、シート名として使うかどうかを取得します。
666         *
667         * @og.rev 5.7.6.2 (2014/05/16) 新規追加
668         *
669         * @return PAGEBREAKカラムのシート名使用可否[true:使用/false:使用しない]
670         */
671        public boolean isUseSheetName() {
672                return useSheetName;
673        }
674
675        /**
676         * キューマネージャーをセットします。
677         *
678         * @param manager キューマネージャー
679         */
680        public void setManager( final QueueManager manager ) {
681                this.manager = manager;
682        }
683
684        /**
685         * 帳票処理データをセットします。
686         * 既にテーブルモデルがセットされている場合は、再セットしません。
687         *
688         */
689        public void setData() {
690                if( body == null && manager != null ) {
691                        manager.set( this );
692                }
693        }
694
695        /**
696         * キューを実行中の状態に更新します。
697         *
698         */
699        public void setExecute() {
700                if( manager != null ) {
701                        manager.execute( this );
702                }
703        }
704
705        /**
706         * キューを完了済の状態に更新します。
707         *
708         */
709        public void setComplete() {
710                if( manager != null ) {
711                        manager.complete( this );
712                }
713        }
714
715        /**
716         * キューをエラーの状態に更新します。
717         */
718        public void setError() {
719                if( manager != null ) {
720                        manager.error( this );
721                }
722        }
723
724        /**
725         * エラーメッセージをセットします。
726         *
727         * @param msg エラーメッセージの可変変数
728         */
729        public void addMsg( final String msg ) {
730//              errMsg.append( msg );
731                errMsgBuf.append( msg ).append( CR );
732        }
733
734        /**
735         * エラーメッセージを取得します。
736         *
737         * @return エラーメッセージ
738         * @og.rtnNotNull
739         */
740        public String getMsg() {
741                return errMsgBuf.toString();
742        }
743
744        /**
745         * 処理したページ数を引数の分だけカウントアップします。
746         *
747         * これは、256シート以上を印刷する場合、ファイル名に"_"を付けて
748         * 出力する機能と、GE50のSUPAGEカラムに印刷ページ数をセットするのに
749         * 使用しています。
750         * openOfficeのシート制限は解除されていますが、SUPAGEカラムが
751         * NUMBER(3) でDB定義されているため、1000以上のページを、GE50 に
752         * セットすると、エラーになります。
753         * DB定義を変更するまでの間、最大ページ数を、999 としておきます。
754         *
755         * @og.rev 5.1.2.0 (2010/01/01) 新規追加
756         * @og.rev 7.1.0.0 (2020/01/27) 256シート制限を999にしておく。
757         *
758         * @param pgs カウントアップするページ数
759         */
760        public void addExecPageCnt( final int pgs ) {
761                pageCnt += pgs;
762
763                // 7.1.0.0 (2020/01/27) 256シート制限を999にしておく。
764                if( pageCnt > MAX_SHEETS_PER_FILE ) { pageCnt = MAX_SHEETS_PER_FILE; }
765        }
766
767        /**
768         * 処理したページ数を返します。
769         *
770         * @og.rev 5.1.2.0 (2010/01/01) 新規追加
771         *
772         * @return 処理したページ数
773         */
774        public int getExecPagesCnt() {
775                return pageCnt;
776        }
777
778        /**
779         * 処理した行数をセットします。
780         *
781         * @og.rev 5.1.2.0 (2010/01/01) 新規追加
782         *
783         * @param rws 処理した行数
784         */
785        public void setExecRowCnt( final int rws ) {
786                rowCnt = rws;
787        }
788
789        /**
790         * 処理した行数を返します。
791         *
792         * @og.rev 5.1.2.0 (2010/01/01) 新規追加
793         *
794         * @return 処理した行数
795         */
796        public int getExecRowCnt() {
797                return rowCnt;
798        }
799
800        /**
801         * 全ての行が処理されたかをセットします(初期値:false)。
802         *
803         * これは、処理結果が、256シートを超えていた場合、再度残りのデータについて
804         * 処理を行うかどうかの判定するために、利用します。
805         *
806         * @og.rev 5.1.2.0 (2010/01/01) 新規追加
807         *
808         * @param flag 全ての行が処理されたか
809         */
810        public void setEnd( final boolean flag ) {
811                isDataEnd = flag;
812        }
813
814        /**
815         * 全ての行が処理されているかを返します。
816         *
817         * これは、処理結果が、256シートを超えていた場合、再度残りのデータについて
818         * 処理を行うかどうかの判定するために、利用します。
819         *
820         * @og.rev 5.1.2.0 (2010/01/01) 新規追加
821         *
822         * @return 全ての行が処理されたか
823         */
824        public boolean isEnd() {
825                return isDataEnd;
826        }
827
828        /**
829         * テンポラリ出力のキーとなる文字列を生成して返します。
830         *
831         * systemId + FS + listId + FS + ykno を連結します。
832         *
833         * @og.rev 8.0.3.0 (2021/12/17) 新規追加
834         *
835         * @return テンポラリ出力のキーとなる文字列
836         */
837        public String getTempKey() {
838                return systemId + FS + listId + FS + ykno;
839        }
840
841        // /**
842        // * FGNOMI(メール不要フラグ)を設定します(初期値=false:送信する)。
843        // *
844        // * 帳票エラー時のメール送信は帳票IDの正規表現でコントロール可能でしたが、
845        // * ID単位に未送信フラグを持たせてコントロール可能にします。
846        // * 帳票の動作にDBのカラム追加が伴うためバージョンを5.10系に上げます。
847        // * エラーメールが不要の場合は、"true", もしくは、1文字の場合のみ、"0" 以外の場合が、
848        // * メール不要として、エラーメールを送信しません。
849        // *
850        // * @og.rev 5.10.0.0 (2018/06/08) 新規追加
851        // * @og.rev 6.9.8.1 (2018/06/11) 帳票エラーメールの改修(メール不要フラグ=trueで不要、falseが必要)
852        // * @og.rev 7.4.4.0 (2021/06/30) openGionV8事前準備(GE54.FGNOML廃止)
853        // *
854//      // * @param fgnoml
855        // * @param flag メール不要フラグ
856        // */
857//      // public void setFgnoml( final String fgnoml) {
858        // 7.4.4.0 (2021/06/30) Delete
859        // public void setFgnoml( final String flag ) {
860//      //      this.fgnoml = fgnoml;
861        //      fgnoml = StringUtil.nval( flag,fgnoml );                // true,TRUE,0以外の1文字の場合、true、それ以外は、初期値
862        // }
863
864        // /**
865        // * FGNOMI(メール不要フラグ)を取得します。
866        // *
867        // * @og.rev 5.10.0.0 (2018/06/08) 新規追加
868        // * @og.rev 6.9.8.1 (2018/06/11) 帳票エラーメールの改修(メール不要フラグ=trueで不要、falseが必要)
869        // * @og.rev 7.4.4.0 (2021/06/30) openGionV8事前準備(GE54.FGNOML廃止)
870        // *
871//      // * @return fgnomi
872        // * @return メール不要フラグ [true:メール不要/false:エラーメール送信する]
873        // */
874//      // public String getFgnoml() {
875        // 7.4.4.0 (2021/06/30) Delete
876        // public boolean isFgnoml() {
877//      //      return this.fgnoml;
878        //      return fgnoml;
879        // }
880}