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.report; 017 018// import org.opengion.fukurou.util.Shell; 019// import org.opengion.hayabusa.common.HybsSystem; 020import org.opengion.hayabusa.db.DBTableModel; 021import static org.opengion.fukurou.system.HybsConst.BUFFER_MIDDLE; // 6.4.2.1 (2016/02/05) 022 023/** 024 * CSVPrintPoint インターフェース のデフォルト実装クラスです。 025 * execute() をオーバーライドして、各種CSV取込み方式のシステムに対応して下さい。 026 * 027 * @og.group 帳票システム 028 * 029 * @version 5.0 030 * @author Masakazu Takahashi 031 * @since JDK6.0, 032 */ 033public abstract class AbstractCSVPrintPointService implements CSVPrintPointService { 034 035 /** カラム */ protected String ykno ; 036 /** カラム */ protected String systemId ; 037 /** カラム */ protected String fgrun ; 038// /** カラム */ protected String hostName ; // 7.3.0.0 (2021/01/06) SpotBugs:読み出されないフィールド 039// /** カラム */ protected String prtName ; // 7.3.0.0 (2021/01/06) SpotBugs:読み出されないフィールド 040 /** カラム */ protected DBTableModel table ; 041 /** カラム */ protected DBTableModel tableH ; 042 /** カラム */ protected DBTableModel tableF ; 043// /** カラム */ protected String prgdir ; // 7.3.0.0 (2021/01/06) SpotBugs:読み出されないフィールド 044// /** カラム */ protected String prgfile ; // 7.3.0.0 (2021/01/06) SpotBugs:読み出されないフィールド 045 /** カラム */ protected String outdir ; 046 /** カラム */ protected String prtid ; 047// /** カラム */ protected String portnm ; // 7.3.0.0 (2021/01/06) SpotBugs:読み出されないフィールド 048 /** カラム */ protected String listid ; 049 /** カラム */ protected String modelname ; 050 051 /** カラム */ protected String grpid ; // 5.9.2.2 (2015/11/20) 052 /** カラム */ protected String dmngrp ; // 5.9.2.2 (2015/11/20) 053 /** カラム */ protected String option ; // 5.9.3.0 (2015/12/04) 054// /** カラム */ protected String fgcut ; // 5.9.3.0 (2015/12/04) 055 056 /** エラーメッセージ */ protected final StringBuilder errMsg = new StringBuilder( BUFFER_MIDDLE ); // エラーメッセージ 057 /** 完了フラグ */ protected String fgkan = GE50Access.FG_ERR2; // 初期値はアプリエラー 058 059// private static final int TIMEOUT = HybsSystem.sysInt( "REPORT_DAEMON_TIMEOUT" ); // Shellタイムアウト 6.3.9.1 (2015/11/27) private static final化 060// /** シェルコマンド */ protected String shellCmd ; // 7.3.0.0 (2021/01/06) SpotBugs:未使用のフィールド 061 062 /** 実行フラグ {@value} */ protected static final String FGRUN_EXCEL = "H"; 063 /** 実行フラグ {@value} */ protected static final String FGRUN_PDF = "I"; 064 /** 実行フラグ {@value} */ protected final static String FGRUN_EXCEL2 = "J"; // 5.9.4.2 (2016/01/13) 065 066// private static final String CR = System.getProperty("line.separator"); 067 068 /** 069 * デフォルトコンストラクター 070 * 071 * @og.rev 6.4.2.0 (2016/01/29) PMD refactoring. Each class should declare at least one constructor. 072 */ 073 protected AbstractCSVPrintPointService() { super(); } // これも、自動的に呼ばれるが、空のメソッドを作成すると警告されるので、明示的にしておきます。 074 075 /** 076 * 発行処理 077 * 対象のシステムに応じてこのメソッドをオーバーライドします 078 * 実行後はfgkanの値を正しい値でセットしなおして下さい。 079 * 080 * @return 結果 [true:正常/false:異常] 081 */ 082 public abstract boolean execute(); 083 084 /** 085 * 帳票起動された要求番号をセットします。 086 * 087 * @param no 要求NO 088 */ 089 public void setYkno( final String no ) { 090 ykno = no; 091 } 092 093 /** 094 * システムIDをセットします。 095 * 096 * @param id システムID 097 */ 098 public void setSystemId( final String id ) { 099 systemId = id; 100 } 101 102 /** 103 * 実行方法をセットします。 104 * 105 * @param flag 実行方法 106 */ 107 public void setFgrun( final String flag ) { 108 fgrun = flag; 109 } 110 111 /** 112 * 帳票デーモンが実行されているホスト名をセットします。 113 * 114 * @og.rev 7.3.0.0 (2021/01/06) SpotBugs:読み出されないフィールド 115 * 116 * @param host ホスト名 117 */ 118 public void setHostName( final String host ) { 119// hostName = host; 120 } 121 122 /** 123 * プリンター名をセットします。 124 * 125 * @og.rev 7.3.0.0 (2021/01/06) SpotBugs:読み出されないフィールド 126 * 127 * @param printerName プリンタ名 128 */ 129 public void setPrinterName( final String printerName ) { 130// prtName = printerName; 131 } 132 133 /** 134 * DBTableModel をセットします。 135 * 136 * @param tbl DBTableModelオブジェクト 137 */ 138 public void setTable( final DBTableModel tbl ) { 139 table = tbl; 140 } 141 142 /** 143 * DBTableModel をセットします。 144 * 145 * @param tbl DBTableModelオブジェクト 146 */ 147 public void setTableH( final DBTableModel tbl ) { 148 tableH = tbl; 149 } 150 151 /** 152 * DBTableModel をセットします。 153 * 154 * @param tbl DBTableModelオブジェクト 155 */ 156 public void setTableF( final DBTableModel tbl ) { 157 tableF = tbl; 158 } 159 160 /** 161 * 起動するバッチ等のプログラム(ディレクトリ)をセットします。 162 * 163 * @og.rev 7.3.0.0 (2021/01/06) SpotBugs:読み出されないフィールド 164 * 165 * @param dir バッチプログラムディレクトリ 166 */ 167 public void setPrgDir( final String dir ){ 168// prgdir = dir; 169 } 170 171 /** 172 * 起動するバッチ等のプログラムをセットします。 173 * 空の場合は起動しません。 174 * 175 * @og.rev 7.3.0.0 (2021/01/06) SpotBugs:読み出されないフィールド 176 * 177 * @param file バッチプログラム名 178 */ 179 public void setPrgFile( final String file ){ 180// prgfile = file; 181 } 182 183 /** 184 * ファイル出力時のディレクトリを指定します。 185 * 186 * @param dir ファイル出力ディレクトリ 187 */ 188 public void setOutDir( final String dir ){ 189 outdir = dir; 190 } 191 192 /** 193 * プリンタIDを指定します。 194 * 195 * @param id プリンタID 196 */ 197 public void setPrtId( final String id ){ 198 prtid = id; 199 } 200 201 /** 202 * プリンタのポート名。 203 * 204 * @og.rev 7.3.0.0 (2021/01/06) SpotBugs:読み出されないフィールド 205 * 206 * @param port ポート名 207 */ 208 public void setPortnm( final String port ){ 209// portnm = port; 210 } 211 212 /** 213 * 帳票IDをセットします。 214 * 215 * @param id 帳票ID 216 */ 217 public void setListId( final String id ) { 218 listid = id; 219 } 220 221 /** 222 * 雛形ファイル名をセットします。 223 * 224 * @param name 雛形ファイル名 225 */ 226 public void setModelname( final String name ) { 227 modelname = name; 228 } 229 230 /** 231 * グループIDをセットします。 232 * 233 * @param id グループID 234 */ 235 public void setGrpId( final String id ) { 236 grpid = id; 237 } 238 239 /** 240 * デーモングループをセットします。 241 * 242 * @param name デーモングループ 243 */ 244 public void setDmnGrp( final String name ) { 245 dmngrp = name; 246 } 247 248 /** 249 * オプション文字列をセットします。 250 * 251 * @og.rev 5.9.3.0 (2015/12/04) 252 * 253 * @param opt オプション文字列 254 */ 255 public void setOption( final String opt ) { 256 option = opt; 257 } 258 259 /** 260 * ページエンドカットフラグをセットします。 261 * 262 * @og.rev 5.9.3.0 (2015/12/04) 263 * @og.rev 7.3.0.0 (2021/01/06) SpotBugs:読み出されないフィールド 264 * 265 * @param flg エンドカットフラグ 266 */ 267 public void setFgcut( final String flg ) { 268// fgcut = flg; 269 } 270 271 /** 272 * 完成フラグを返します。 273 * 274 * @return 完成フラグ String 275 */ 276 public String getFgkan(){ 277 return fgkan; 278 } 279 280 /** 281 * エラーメッセージを返します。 282 * 283 * @return エラーメッセージ String 284 */ 285 public String getErrMsg(){ 286 return errMsg.toString(); 287 } 288 289// /** 290// * シェルの実行を行います。 291// * 292// * @og.rev 5.4.3.0 (2011/12/26) 293// * @og.rev 7.3.0.0 (2021/01/06) SpotBugs:書き込まてれいない public または protected フィールド 294// * 295// * @return 結果 [true:正常/false:異常] 296// */ 297// protected boolean programRun(){ 298// final Shell shell = new Shell(); 299// shell.setCommand( shellCmd,true ); // BATCHプロセスで実行する 300// shell.setWait( true ); // プロセスの終了を待つ 301// shell.setTimeout( TIMEOUT ); 302// 303// if( shell.exec() != 0 ) { 304// errMsg.append( "Shell Command exequte Error." ).append( CR ) 305// .append( "==============================" ).append( CR ) 306// .append( shellCmd ).append( CR ) 307// .append( shell.getStdoutData() ).append( CR ) 308// .append( shell.getStderrData() ).append( CR ) 309// .append( CR ); 310// return false; 311// } 312// 313// return true; 314// } 315 316}