クラス ForeachExecuteAfter
java.lang.Object
jp.ne.mki.wedge.rule.base.AbstractBase
jp.ne.mki.wedge.rule.base.AbstractClient
jp.ne.mki.wedge.rule.client.control.ForeachExecuteAfter
- すべての実装されたインタフェース:
ClientInterface
,CommonInterface
,jp.ne.mki.wedge.run.interfaces.RuleEngineInterface
Foreachループ処理(Afterイベント実行)
In(0)に設定されたアイテムを複数回呼び出します。
In(1)以降に設定したCOLTEXTアイテムの行数分ループ処理が実行され、
処理の各々で、その行のデータをOutのTEXTアイテムに設定します。
例)
InputRecord
アイテム名 | データ | |||
---|---|---|---|---|
EVENT_ITEM | ||||
COL_ID | 0001 | 0002 | 0003 | 0004 |
COL_名称 | AA | BB | CC | DD |
アイテム名 | データ |
---|---|
TXT_ID | |
TXT_名称 |
実行時の動作
この場合、COLTEXTが四行分のデータがあるため、
四回、EVENT_ITEMのAfterの処理が実行されます。
一回目は、TXT_IDに[0001]、TXT_名称に[AA]という文字が設定されます。
以下
二回目:TXT_ID=[0002], TXT_名称=[BB]
三回目:TXT_ID=[0003], TXT_名称=[CC]
四回目:TXT_ID=[0004], TXT_名称=[DD]
と、ループのたびにOutRecordの値を変更しながら動作することとなります。
ループ処理はパフォーマンスの低下に繋がることがございます。
特にループ処理の中でトランザクション呼び出しを行うと、
ループのたびに通信処理が動作するため 著しくパフォーマンスが
低下することとなります。
ループを使用しなくて実装が可能な場合は、
極力 ループを使用せずに実装することを推奨します。
例)
アイテム名 | データ | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
ID | 0001 | 0002 | 0003 | 0004 | 0005 | 0006 | 0007 | 0008 | 0009 | 0010 |
名称 | AA | BB | CC | DD | EE | FF | GG | HH | II | JJ |
種別 | 1 | 2 | 2 | 1 | 2 | 2 | 1 | 1 | 1 | 2 |
種別が1のレコードは トランザクション1を呼出し、
種別が2のレコードは トランザクション2を呼び出すような
処理を実装することとします。
処理パフォーマンスの悪い実装(ループ処理)
ForeachDecisionTableを使用して、1レコードずつにループを行います。ループ内で、都度 サーバ へ接続をしてトランザクションを実行します。
このようにすると、最大10回 トランザクション処理が
動作することとなります。
10回であればさほど処理速度の低下は気にならないかもしれませんが、
これが1000レコード、10000レコードとなると、処理の遅さが
目に見えるかと思います。
処理パフォーマンスの良い実装(項目郡毎の一括処理)
IfMatchParamThenCopyValueを使用して、レコードを二つの項目郡に分けます。IfMatchParamThenCopyValueを使って、種別が1のレコードを抽出。
アイテム名 | データ | ||||
---|---|---|---|---|---|
ID_1 | 0001 | 0004 | 0007 | 0008 | 0009 |
名称_1 | AA | DD | GG | HH | II |
種別_1 | 1 | 1 | 1 | 1 | 1 |
IfMatchParamThenCopyValueを使って、種別が2のレコードを抽出。
アイテム名 | データ | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
ID_2 | 0002 | 0003 | 0005 | 0006 | 0010 | |||||
名称_2 | BB | CC | EE | FF | JJ | |||||
種別_2 | 2 | 2 | 2 | 2 | 2 |
こうするとサーバへの接続は2回のみで済み、
前述した ループの方法と比べた場合、非常に高速に処理ができます。
JDK1.5では、CaretのUpdatePolicyを NEVER_UPDATEにしているときに テキストフィールドに対して値を設定をすると、 CaretのRepaintEventが都度発生します。
そのため、ループ処理で何度もテキストフィールドの値を更新すると、 OutOfMemoryErrorが発生することがございます。
(OutOfMemoryError はログ出力中にエラーが発生することがあるため、 ログに正常に出力されない場合もあります。ご注意下さい。)
この問題に対応するためには、ループ処理の実行前に
SetCaretUpdatePolicyをを使用して、 UpdatePolicyを NEVER_UPDATEにして下さい。
(テキストフィールドの挙動が変わるため、 SetCaretUpdatePolicyのパラメータに-tempを指定してください。)
[I/O RECORD]
InputRecord | OutputRecord |
---|---|
|
|
[RULE PARAMETER]
Parameter |
---|
- 導入されたバージョン:
- 1.2.0-04
- バージョン:
- 1.0
-
フィールドの概要
フィールドクラスから継承されたフィールド jp.ne.mki.wedge.rule.base.AbstractBase
controlRecord, engineManager, errorMessage, executeType, id, inputRecord, logicalName, logicClassDelegate, outputRecord, physicalName, ruleParameter, ruleType, serverParameter, userConstant
インタフェースから継承されたフィールド jp.ne.mki.wedge.rule.base.interfaces.ClientInterface
FRAME_CLOSE, FRAME_QUIT, SKIP_ALL, STOP, STOP_SELECT_ALL, SYSTEM_EXIT, SYSTEM_QUIT, TIMING_AFTER, TIMING_BEFORE, TIMING_LOAD, TIMING_ROW_CLICK, TIMING_ROW_WCLICK, TIMING_UN_LOAD
インタフェースから継承されたフィールド jp.ne.mki.wedge.rule.base.interfaces.CommonInterface
CANCEL, ERROR, EXECUTE_BOTH, EXECUTE_CLIENT, EXECUTE_DEBUG, EXECUTE_HTMLGATEWAY, EXECUTE_SERVER, EXECUTE_SERVERDC, IO_ERROR, IO_ERROR_EXECUTE_PARAMETER, IO_ERROR_IN, IO_ERROR_IO_MUST_SAME_COUNT, IO_ERROR_ITEM_TYPE, IO_ERROR_OUT, IO_ERROR_PARAMETER, NONE, OK, PARAMETER_DELIMITER, SKIP, USER_ERROR
-
コンストラクタの概要
コンストラクタ -
メソッドの概要
クラスから継承されたメソッド jp.ne.mki.wedge.rule.base.AbstractClient
executeCurrentAfter, executeRule, executeRule, getAdapterName, getClientRuleObject, getComponent, getComponent, getComponents, getConfig, getConfImagePath, getContentPane, getCurrentComponent, getDesktop, getExecuteIndex, getExecuteParameter, getExecuteTiming, getExecutions, getExpectNextComponent, getFrame, getFrameRunner, getImageIcon, getInItem, getInItem, getItems, getLogicClassType, getManager, getMemory, getOutItem, getOutItem, getParameter, getReturnString, getRevision, isApplet, isApplication, isClientTraceMode, isConpiled, isJWS, isServerTraceMode, isWeb, log, loopInItem, loopInItemSub, loopInOutItem, loopInOutItemSub, loopOutItem, loopOutItemSub, setEngineManager, setErrorMessageMustInComp, setErrorMessageMustOutComp, setExecuteParameter, setFocus, setFocus, setFocus, setFrameRunnerErrorStatus, setPropertyFromEngine, setStatusBarText, showErrorDialog, showFrame, showFrame, showFrame, showFrame, terminate, writeErrorLog, writeErrorLog, writeErrorLog, writeTraceLog
クラスから継承されたメソッド jp.ne.mki.wedge.rule.base.AbstractBase
callDispose, checkDelegate, createErrorMessage, createLogicErrorLogRecord, createLogicExceptionLogRecord, createLogicLogRecord, dataClearOfOutRecord, dataClearOfRecord, dispose, getAppAccount, getAppAuthority, getAppMenu, getAppPassword, getClassErrorName, getClientId, getConnectionId, getConnectionPoolId, getConstantKeys, getConstantValue, getConstantValueAsStringArray, getControlRecord, getDbAccessCount, getDbErrorCode, getDbErrorMessage, getDbStatus, getDbUpdatedRecordCount, getEngineManager, getErrorMessage, getErrorMessage, getErrorMessage, getExceptionMessage, getExecuteType, getId, getInputRecordIterator, getInRecord, getInRecord, getInRecord, getInRecordCount, getInRecordList, getIpAddress_G_Index, getIpAddress_P_Index, getLogicalErrorName, getLogicalName, getLogicClassDelegate, getOutputHtml, getOutputRecordIterator, getOutRecord, getOutRecord, getOutRecord, getOutRecordCount, getOutRecordList, getPhysicalErrorName, getPhysicalName, getProjectId, getQueryEndLine, getQueryMaxCount, getQueryPageCount, getQueryStartLine, getRowSize, getRowSizeOfInRecord, getRuleParameter, getRuleParameters, getRuleParameters, getRuleParameters, getRuleType, getRuleTypeName, getServerMessage, getServerParameter, getServerStatus, getServerSubName, getServerSubRevision, getServerTran, getUpdateErrorLine, getUpdateTargetCount, getWebServerIpAddress, isExecutable, isJDK15, log, logDebug, logError, logError, logFatal, logFatal, logInfo, logTrace, logWarn, logWarn, loopInOutRecord, loopInOutRecordSub, loopInRecord, loopInRecordSub, loopOutRecord, loopOutRecordSub, setControlRecord, setErrorMessage, setErrorMessageMustInRecord, setErrorMessageMustOutRecord, setErrorMessageMustParamIsNumber, setExecuteType, setFatalError, setId, setInRecord, setLogicalName, setLogicClassDelegate, setOutputHtml, setOutRecord, setPhysicalName, setRuleParameter, setRuleType, setServerParameter, setUserConstant, showErrorDialog, showErrorDialogAddRuleName, writeErrorLog, writeErrorLog, writeLog, writeLog, writeLog, writeTraceLog
クラスから継承されたメソッド java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
インタフェースから継承されたメソッド jp.ne.mki.wedge.rule.base.interfaces.CommonInterface
dispose, getAppAccount, getAppAuthority, getAppMenu, getAppPassword, getClassErrorName, getClientId, getConnectionId, getConnectionPoolId, getDbAccessCount, getDbErrorCode, getDbErrorMessage, getDbStatus, getEngineManager, getExceptionMessage, getExecuteType, getId, getInRecord, getInRecord, getInRecord, getInRecordCount, getIpAddress_G_Index, getIpAddress_P_Index, getLogicalErrorName, getLogicalName, getOutRecord, getOutRecord, getOutRecord, getOutRecordCount, getPhysicalErrorName, getPhysicalName, getProjectId, getQueryEndLine, getQueryMaxCount, getQueryPageCount, getQueryStartLine, getRuleParameter, getRuleParameters, getRuleType, getRuleTypeName, getServerMessage, getServerParameter, getServerStatus, getServerSubName, getServerSubRevision, getServerTran, getUpdateErrorLine, getUpdateTargetCount, getWebServerIpAddress, isExecutable, logDebug, logError, logError, logFatal, logFatal, logInfo, logTrace, logWarn, logWarn, setExecuteType, setRuleType, setServerParameter, showErrorDialog, showErrorDialogAddRuleName, writeErrorLog, writeLog, writeLog, writeTraceLog
インタフェースから継承されたメソッド jp.ne.mki.wedge.run.interfaces.RuleEngineInterface
createLogicErrorLogRecord, createLogicExceptionLogRecord, createLogicLogRecord, getLogicClassDelegate, setControlRecord, setId, setInRecord, setLogicalName, setLogicClassDelegate, setOutRecord, setPhysicalName, setRuleParameter, setUserConstant
-
フィールド詳細
-
caretReturnRunnables
List caretReturnRunnables
-
-
コンストラクタの詳細
-
ForeachExecuteAfter
public ForeachExecuteAfter()
-
-
メソッドの詳細
-
getIOParameter
インタフェースからコピーされた説明:CommonInterface
IOパラメータ取得。execute
の前に実行される。- 戻り値:
- int OK=処理続行、IO_ERROR=入出力レコードエラー、IO_ERROR_IN=入力レコードエラー、IO_ERROR_OUT=出力レコードエラー、 IO_ERROR_IO_MUST_SAME_COUNT=入力レコード数と出力レコー数の非合致エラー、IO_ERROR_PARAMETER=パラメータエラー、 IO_ERROR_EXECUTE_PARAMETER=実行リストパラメータエラー
- 例外:
Throwable
- 関連項目:
-
execute
インタフェースからコピーされた説明:CommonInterface
処理を実行。- 戻り値:
- int OK=処理続行、ERROR=異常終了、CANCEL=処理を中断(正常終了)、SKIP=次行を実行しない、USER_ERROR=戻り値をユーザ側で任意に設定
- 例外:
Throwable
- 関連項目:
-
exit
インタフェースからコピーされた説明:CommonInterface
- 例外:
Throwable
- 関連項目:
-