5.1. IM-Workflow¶
IM-BPMから、IM-Workflowと連携する方法を説明します。
5.1.1. 起票・申請タスク に前処理ユーザプログラムを設定する¶
「IM-Workflow」を起票、または、申請する前の処理を差し込みます。
前処理ユーザプログラムは、決められたインタフェースを実装する必要があります。
package sample; import jp.co.intra_mart.activiti.engine.delegate.DelegateExecution; import jp.co.intra_mart.activiti.engine.delegate.ImWorkflowDraftPreprocess; import jp.co.intra_mart.foundation.workflow.application.model.param.DraftParam; public class SampleWorkflowDraftPreprocess implements ImWorkflowDraftPreprocess { @Override public void execute(DelegateExecution execution, DraftParam param) throws Exception { String matterName = (String) execution.getVariable("matterName"); String matterNumber = (String) execution.getVariable("matterNumber"); if (matterName != null) { param.setMatterName(matterName); } if (matterNumber != null) { param.setMatterNumber(matterNumber); } } }package sample; import java.util.Map; import jp.co.intra_mart.activiti.engine.delegate.DelegateExecution; import jp.co.intra_mart.activiti.engine.delegate.ImWorkflowApplyParamModel; import jp.co.intra_mart.activiti.engine.delegate.ImWorkflowApplyPreprocess; import jp.co.intra_mart.foundation.workflow.application.model.param.ApplyParam; public class SampleWorkflowApplyPreprocess implements ImWorkflowApplyPreprocess { @Override public void execute(DelegateExecution execution, ImWorkflowApplyParamModel model) throws Exception { ApplyParam applyParam = model.getApplyParam(); String matterName = (String) execution.getVariable("matterName"); String matterNumber = (String) execution.getVariable("matterNumber"); if (matterName != null) { applyParam.setMatterName(matterName); } if (matterNumber != null) { applyParam.setMatterNumber(matterNumber); } Map<String, Object> userParam = model.getUserParam(); String param1 = (String) execution.getVariable("param1"); String param2 = (String) execution.getVariable("param2"); userParam.put("param1", param1); userParam.put("param2", param2); } }