001package org.opengion.fukurou.util; 002 003import org.opengion.fukurou.business.BizLogicHelper; 004import org.opengion.fukurou.db.TransactionImpl; 005 006/** 007 * bizLogicファイル共通クラス 008 * bizLogicファイルを処理するための、 009 * 共通クラスです。 010 * 011 * @og.rev 5.10.15.2 (2019/09/20) 新規作成 012 * 013 * @version 5 014 * @author oota 015 * @since JDK7 016 */ 017public class BizUtil { 018 019 /** 020 * private コンスタクター 021 * インスタンスは生成せずに、利用します。 022 */ 023 private BizUtil() { } 024 025 /** 026 * bizLogicファイルの実行 bizLogicファイルをホットデプロイして、 027 * 処理を実行します。 028 * 029 * @param srcDir ソースディレクトリ 030 * @param classDir クラスディレクトリ 031 * @param isAutoCompile オートコンプリートフラグ 032 * @param isHotDeploy ホットデプロイフラグ 033 * @param classPath クラスパス 034 * @param systemId システムID 035 * @param logicName ロジック名 036 * @param keys キーリスト 037 * @param vals 値リスト 038 * @throws エラー情報 039 */ 040 public static void actBizLogic(final String srcDir, final String classDir, final boolean isAutoCompile, final boolean isHotDeploy, final String classPath, 041 final String systemId, final String logicName, final String[] keys, final String[] vals) throws Throwable { 042 043 // bizクラスファイルのホットデプロイ 044 HybsLoader ldr = HybsLoaderFactory 045 .getLoader(new HybsLoaderConfig(srcDir, classDir, isAutoCompile, isHotDeploy, classPath)); 046 047 BizLogicHelper helper = new BizLogicHelper(logicName, ldr); 048 049 TransactionImpl tran = new TransactionImpl(null); 050 helper.setTransaction(tran); 051 helper.setDbid(systemId); 052 helper.setKeys(keys); 053 helper.setVals(vals); 054 055 try { 056 // bizLogic実行 057 helper.exec(); 058 059 // 正常に実行された場合 060 tran.commit(); 061 tran.finish(); 062 }catch(Throwable e) { 063 // エラー発生時 064 tran.rollback(); 065 throw e; 066 } finally { 067 if (tran != null) { 068 tran.close(); 069 tran.realClose(); 070 } 071 } 072 } 073}