package com.vci.server.workflow.server.delegate;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import org.jbpm.api.ProcessDefinition;
import org.jbpm.api.task.Task;
import org.omg.CORBA.LongHolder;
import com.vci.common.log.ServerWithLog4j;
import com.vci.common.objects.QueryParam;
import com.vci.common.objects.QueryResult;
import com.vci.common.utility.ObjectUtility;
import com.vci.corba.common.VCIError;
import com.vci.corba.workflow.data.QueryParamInfo;
import com.vci.corba.common.data.UserEntityInfo;
import com.vci.corba.workflow.data.FlowApproveHistoryInfo;
import com.vci.corba.workflow.data.FlowInstanceInfo;
import com.vci.corba.workflow.data.FlowObjectInfo;
import com.vci.corba.workflow.data.FlowTaskInfo;
import com.vci.corba.workflow.data.MapTransfersInfo;
import com.vci.corba.workflow.data.NodeHideInfo;
import com.vci.corba.workflow.data.ProcessCategoryInfo;
import com.vci.corba.workflow.data.ProcessDefinitionInfo;
import com.vci.corba.workflow.data.ProcessTaskInfo;
import com.vci.corba.workflow.data.SubprocessTemInfo;
import com.vci.corba.workflow.data.TaskDescInfo;
import com.vci.corba.workflow.data.TaskRevokeInfo;
import com.vci.corba.workflow.data.TasksAssignedInfo;
import com.vci.server.workflow.common.task.FlowApproveHistory;
import com.vci.server.workflow.objects.NodeHide;
import com.vci.server.workflow.objects.PLFlowObject;
import com.vci.server.workflow.objects.ProcessCategory;
import com.vci.server.workflow.objects.ProcessTask;
import com.vci.server.workflow.objects.TaskDescSObject;
import com.vci.server.workflow.objects.TaskRevokeSObject;
import com.vci.server.workflow.server.template.ProcessCustomService;
import com.vci.server.workflow.server.template.ProcessTemplateService;
import com.vci.server.workflow.server.template.TasksAssigned;
public class ProcessCustomDelegate extends BaseDelegate {
ProcessCustomService service = null;
public ProcessCustomDelegate(UserEntityInfo userEntityInfo) {
super(userEntityInfo);
service = new ProcessCustomService(this.getUserEntity());
}
public ProcessCustomDelegate() {
service = new ProcessCustomService();
}
public ProcessCategoryInfo[] getProcessCategories(String parentId) throws VCIError {
ProcessCategoryInfo[] infos = new ProcessCategoryInfo[0];
try {
List list = service.getProcessCategories(parentId);
ProcessCategory[] objects = list.toArray(new ProcessCategory[] {});
infos = this.convertProcessCategorysToProcessCategoryInfos(objects);
} catch (Exception ex) {
throw new VCIError("410101", new String[] {});
}
return infos;
}
public ProcessCategoryInfo[] getProcessCategoriesByPage(String parentId,int pageSize,int pageIndex) throws VCIError {
ProcessCategoryInfo[] infos = new ProcessCategoryInfo[0];
try {
List list = service.getProcessCategoriesByPage(parentId,pageSize,pageIndex);
ProcessCategory[] objects = list.toArray(new ProcessCategory[] {});
infos = this.convertProcessCategorysToProcessCategoryInfos(objects);
} catch (Exception ex) {
throw new VCIError("410101", new String[] {});
}
return infos;
}
public String saveProcessCategory(ProcessCategoryInfo info) throws VCIError {
String id = ObjectUtility.getNewObjectID36();
info.id = id;
try {
service.saveProcessCategory(this.convertProcessCategoryInfoToProcessCategory(info));
} catch (Exception ex) {
throw new VCIError("410102", new String[] {});
}
return id;
}
public boolean updateProcessCategory(ProcessCategoryInfo info) throws VCIError {
boolean res = false;
try {
res = service.updateProcessCategory(this.convertProcessCategoryInfoToProcessCategory(info));
} catch (Exception ex) {
throw new VCIError("410103", new String[] {});
}
return res;
}
public boolean existProcessCategory(String id, String name) throws VCIError {
boolean result = false;
try {
result = service.existProcessCategory(id, name);
} catch (Exception ex) {
throw new VCIError("410104", new String[] {});
}
return result;
}
public boolean deleteProcessCategory(String id) throws VCIError {
boolean res = false;
try {
res = service.deleteProcessCategory(id);
} catch (Exception ex) {
ex.printStackTrace();
throw new VCIError("410105", new String[] {});
}
return res;
}
/**
* 移动流程模板
* @param deploymentId
* @param categoryId
* @return
* @throws VCIError
*/
public boolean moveDefinition( String deploymentId , String categoryId) throws VCIError{
return service.moveDefinition(deploymentId, categoryId);
}
public void loadWorkFlowTemplate(String jbpmDeploymentId){
new ProcessTemplateService().loadWorkFlowTemplate(jbpmDeploymentId);
}
public boolean deployProcess(byte[] jbpmImage, String jbmpXml, String graphXml, String processCategoryId, ProcessTaskInfo[] processTaskInfos) throws VCIError {
boolean res = false;
try {
res = new ProcessTemplateService(this.getUserEntity()).deployProcess(jbpmImage, jbmpXml, graphXml, processCategoryId, processTaskInfos);
} catch (Exception ex) {
ex.printStackTrace();
throw new VCIError("410106", new String[] {});
}
return res;
}
public boolean updateProcess(byte[] jbpmImage, String jbmpXml, String graphXml, String processCategoryId, ProcessTaskInfo[] processTaskInfos,String deployId) throws VCIError {
boolean res = false;
try {
res = new ProcessTemplateService(this.getUserEntity()).updateProcess(jbpmImage, jbmpXml, graphXml, processCategoryId, processTaskInfos, deployId);
} catch (Exception ex) {
ex.printStackTrace();
throw new VCIError("410106", new String[] {});
}
return res;
}
/**
* 通过任务节点获取阶段名称
* @param processDefinitionKey
* @param jbpmdeploymentid
* @return
* @throws VCIError
*/
public String getTaskPhaseName(String processDefinitionKey,
String jbpmdeploymentid,FlowInstanceInfo var) throws VCIError {
try{
return new ProcessTemplateService(this.getUserEntity()).getTaskPhaseName(processDefinitionKey, jbpmdeploymentid,var);
}catch(Error e){
throw e;
}
}
public boolean deleteProcessDefinition(String deployId, String pdId) throws VCIError {
boolean res = false;
try {
res = service.deleteProcessDefinition(deployId, pdId);
} catch (VCIError ex) {
ex.printStackTrace();
throw ex;
} catch (Exception ex) {
ex.printStackTrace();
throw new VCIError("410112", new String[] {});
}
return res;
}
public ProcessDefinitionInfo[] getProcessDefinitions(String processCategoryId) throws VCIError {
ProcessDefinitionInfo[] infos = new ProcessDefinitionInfo[0];
try {
List processDefinitions = new ProcessTemplateService().getProcessDefinitions(processCategoryId);
infos = processDefinitions.toArray(new ProcessDefinitionInfo[] {});
} catch (Exception ex) {
throw new VCIError("410107", new String[] {});
}
return infos;
}
public ProcessDefinitionInfo[] getAllProcessDefinitions() throws VCIError {
ProcessDefinitionInfo[] infos = new ProcessDefinitionInfo[0];
try {
List processDefinitions = new ProcessTemplateService().getAllProcessDefinitions();
infos = processDefinitions.toArray(new ProcessDefinitionInfo[] {});
} catch (Exception ex) {
throw new VCIError("410107", new String[] {});
}
return infos;
}
/**
* 编码专用
* @param processCategoryId
* @return
* @throws VCIError
*/
public ProcessDefinitionInfo[] getProcessDefinitionsForRMCode(String processCategoryId) throws VCIError {
ProcessDefinitionInfo[] infos = new ProcessDefinitionInfo[0];
try {
List processDefinitions = new ProcessTemplateService().getProcessDefinitionsForRMCode(processCategoryId);
infos = processDefinitions.toArray(new ProcessDefinitionInfo[] {});
} catch (Exception ex) {
throw new VCIError("410107", new String[] {});
}
return infos;
}
public ProcessDefinitionInfo[] getProcessDefinitionsByPage(String processCategoryId,String name, int pageSize, int pageIndex) throws VCIError {
ProcessDefinitionInfo[] infos = new ProcessDefinitionInfo[0];
try {
List processDefinitions = new ProcessTemplateService().getProcessDefinitionsByPage(processCategoryId,name, pageSize, pageIndex);
infos = processDefinitions.toArray(new ProcessDefinitionInfo[] {});
} catch (Exception ex) {
throw new VCIError("410107", new String[] {});
}
return infos;
}
public ProcessDefinitionInfo[] getProcessDefinitionByProcessDefinitionName(String processCategoryName,String processCategoryId) throws VCIError {
ProcessDefinitionInfo[] infos = new ProcessDefinitionInfo[0];
try {
List processDefinitions = new ProcessTemplateService().getProcessDefinitionByProcessDefinitionName(processCategoryName,processCategoryId);
infos = processDefinitions.toArray(new ProcessDefinitionInfo[] {});
} catch (Exception ex) {
throw new VCIError("410107", new String[] {});
}
return infos;
}
public ProcessDefinitionInfo getProcessDefinitionByDeployId(String deployId) throws VCIError {
ProcessDefinitionInfo info = new ProcessDefinitionInfo();
try {
info = new ProcessTemplateService().getProcessDefinitionByDeployId(deployId);
} catch (Exception ex) {
throw new VCIError("410115", new String[] {ex.getCause().getMessage()});
}
return info;
}
public byte[] getProcessResource(String jbpmDeploymentId, String resourceType) throws VCIError {
byte[] infos = new byte[0];
try {
infos = new ProcessTemplateService().getProcessResource(jbpmDeploymentId, resourceType);
} catch (Exception ex) {
throw new VCIError("410108", new String[] {});
}
return infos;
}
public String[] getNextCandidates(String jbpmDeploymentId, String taskName,
String outcome) throws VCIError {
String[] infos = new String[0];
try {
infos = new ProcessTemplateService().getNextCandidates(jbpmDeploymentId, taskName, outcome);
} catch (Exception ex) {
throw new VCIError("410122", new String[] {});
}
return infos;
}
/**
* 获取下一步任务候选人
* @param excutionId
* @param taskName
* @return
*/
public String[] nextTaskCandidateUsers(String excutionId,String taskName){
String[] infos = new String[0];
infos = new ProcessTemplateService().nextTaskCandidateUsers(excutionId, taskName);
return infos;
}
public String[] getNextTaskNames(String jbpmDeploymentId, String taskName,
String outcome) throws VCIError {
String[] infos = new String[0];
try {
infos = new ProcessTemplateService().getNextTaskNames(jbpmDeploymentId, taskName, outcome);
} catch (Exception ex) {
throw new VCIError("410123", new String[] {});
}
return infos;
}
public String[] getCurCandidates(String jbpmDeploymentId, String taskName,
String outcome, String excutionId) throws VCIError {
String[] infos = new String[0];
try {
infos = new ProcessTemplateService().getCurCandidates(jbpmDeploymentId, taskName, outcome, excutionId);
} catch (Exception ex) {
throw new VCIError("410124", new String[] {});
}
return infos;
}
public String[] getAllCandidatesForTask(String jbpmDeploymentId, String taskName,
String outcome) throws VCIError {
String[] infos = new String[0];
try {
infos = new ProcessTemplateService().getAllCandidatesForTask(jbpmDeploymentId, taskName, outcome);
} catch (Exception ex) {
throw new VCIError("410124", new String[] {});
}
return infos;
}
public String[] getCurConstituents(String jbpmDeploymentId, String taskName,
String outcome) throws VCIError {
String[] infos = new String[0];
try {
infos = new ProcessTemplateService().getCurConstituents(jbpmDeploymentId, taskName, outcome);
} catch (Exception ex) {
throw new VCIError("410124", new String[] {});
}
return infos;
}
public String[] getTrainName(String jbpmDeploymentId, String taskName,
String outcome) throws VCIError {
String[] infos = new String[0];
try {
infos = new ProcessTemplateService().getTrainName(jbpmDeploymentId, taskName, outcome);
} catch (Exception ex) {
throw new VCIError("410125", new String[] {});
}
return infos;
}
public ProcessDefinitionInfo[] getProcessDefinition(String rmTemplateId, String processType) throws VCIError {
ProcessDefinitionInfo[] infos = new ProcessDefinitionInfo[0];
try {
List processDefinitions = new ProcessTemplateService().getProcessDefinition(rmTemplateId, processType);
ProcessDefinition[] objects = processDefinitions.toArray(new ProcessDefinition[] {});
infos = this.convertProcessDefinitionsToProcessDefinitionInfos(objects);
} catch (Exception ex) {
throw new VCIError("410109", new String[] {});
}
return infos;
}
/**
* 获取全部流程定义
* @return
* @throws VCIError
*/
public ProcessDefinitionInfo[] getProcessDefinitionAll() throws VCIError {
ProcessDefinitionInfo[] infos = new ProcessDefinitionInfo[0];
try {
List processDefinitions = new ProcessTemplateService().getProcessDefinitionAll();
ProcessDefinition[] objects = processDefinitions.toArray(new ProcessDefinition[] {});
infos = this.convertProcessDefinitionsToProcessDefinitionInfos(objects);
} catch (Exception ex) {
throw new VCIError("410109", new String[] {});
}
return infos;
}
public void saveRMTemplateProcess(String rmTemplateId, String[] processTypes, String[] jbpmDeploymentIds) throws VCIError {
try {
new ProcessTemplateService().saveRMTemplateProcess(rmTemplateId, processTypes, jbpmDeploymentIds);
} catch (Exception ex) {
throw new VCIError("410110", new String[] {});
}
}
public boolean deleteRMTemplateProcess(String rmTemplateId) throws VCIError {
boolean res = false;
try {
res = new ProcessTemplateService().deleteRMTemplateProcess(rmTemplateId);
} catch (Exception ex) {
ex.printStackTrace();
throw new VCIError("410111", new String[] {});
}
return res;
}
public FlowInstanceInfo getFlowInstanceInfo(String taskId) throws VCIError {
FlowInstanceInfo info = new FlowInstanceInfo();
try {
info = service.getFlowInstanceInfo(taskId);
} catch (Exception ex) {
ex.printStackTrace();
throw new VCIError("410115", new String[] {});
}
return info;
}
public TaskDescInfo[] getTaskDescList(String taskName, String deploymentId){
List list = new ProcessTemplateService().getTaskDescList(taskName, deploymentId);
TaskDescInfo[] taskDescinfo = new TaskDescInfo[list.size()];
for(int i=0;i taskAndUserMap = new HashMap();
for(int i=0;i taskAndUserMap = new HashMap();
for(int i=0;i taskAndUserMap = new HashMap();
for(int i=0;i mapParams = new HashMap();
for(int i=0;i taskAndUserMap = new HashMap();
for(int i=0;i getsubTasks = new ProcessTemplateService().getsubTasks(taskId);
String[] subTasks = new String[getsubTasks.size()];
for(int i=0;i list = new ProcessTemplateService().getHistoryActivityByProInsId(processInstanceId);
return convListToFlowApproveHistoryInfo(list);
}
private FlowApproveHistoryInfo[] convListToFlowApproveHistoryInfo(List list) {
FlowApproveHistoryInfo[] f = new FlowApproveHistoryInfo[list.size()];
for (int i = 0; i < list.size(); i++) {
FlowApproveHistory flowApproveHistory = list.get(i);
f[i] = new FlowApproveHistoryInfo();
f[i].taskId = flowApproveHistory.getTaskId() == null?"":flowApproveHistory.getTaskId();
f[i].executionId = flowApproveHistory.getExecutionId() == null ? "" : flowApproveHistory.getExecutionId();
f[i].taskName = flowApproveHistory.getTaskName() == null ? "" : flowApproveHistory.getTaskName();
f[i].opinion = flowApproveHistory.getOpinion() == null ? "" : flowApproveHistory.getOpinion();
f[i].assignee = flowApproveHistory.getAssignee() == null ? "" : flowApproveHistory.getAssignee();
f[i].createTime = flowApproveHistory.getCreateTime() == null ? 0 : flowApproveHistory.getCreateTime().getTime();
f[i].endTime = flowApproveHistory.getEndTime() == null ? 0 : flowApproveHistory.getEndTime().getTime();
f[i].note = flowApproveHistory.getNote() == null ? "" : flowApproveHistory.getNote();
f[i].parentTaskId = flowApproveHistory.getParentTaskId() == null ? "" : flowApproveHistory.getParentTaskId();
}
return f;
}
public byte[] getExecutionImageByExecutionId(String executionId, String taskName) throws IOException {
return new ProcessTemplateService().getExecutionImageByExecutionId(executionId, taskName);
}
public byte[] getExecutionImage(String executionId) throws IOException {
return new ProcessTemplateService().getExecutionImage(executionId);
}
public FlowObjectInfo[] getFlowObjectByExecutionId(String executionId) {
List list = new ProcessTemplateService().getFlowObjectByExecutionId(executionId);
return convListToInfo(list);
}
private FlowObjectInfo[] convListToInfo(List extends PLFlowObject> list) {
FlowObjectInfo[] flowObjectInfo = new FlowObjectInfo[list.size()];
for (int i = 0; i < list.size(); i++) {
PLFlowObject flowObject = list.get(i);
flowObjectInfo[i] = new FlowObjectInfo();
flowObjectInfo[i].ploid = flowObject.getPloid() == null ? "" : flowObject.getPloid();
flowObjectInfo[i].plexecutionid = flowObject.getPlexecutionid() == null ? "" : flowObject.getPlexecutionid();
flowObjectInfo[i].plprocesstype = flowObject.getPlprocesstype() == null ? "" : flowObject.getPlprocesstype();
flowObjectInfo[i].plobjectid = flowObject.getPlobjectid() == null ? "" : flowObject.getPlobjectid();
flowObjectInfo[i].initStatus = flowObject.getInitStatus() == null ? "" : flowObject.getInitStatus();
}
return flowObjectInfo;
}
public String getDeploymentIdByExecutionId(String executionId) {
return new ProcessTemplateService().getDeploymentIdByExecutionId(executionId);
}
public void endProcessInstance(String processInstanceId) throws VCIError {
new ProcessTemplateService(this.getUserEntity()).endProcessInstance(processInstanceId);
}
public void endProcessInstanceByplatform(String processInstanceId) throws VCIError {
new ProcessTemplateService(this.getUserEntity()).endProcessInstanceByplatform(processInstanceId);
}
public ProcessDefinitionInfo[] getProcessDefinitionByType(String processType) throws VCIError {
ProcessDefinitionInfo[] infos = new ProcessDefinitionInfo[0];
try {
List processDefinitions = new ProcessTemplateService().getProcessDefinitionByType(processType);
ProcessDefinition[] objects = processDefinitions.toArray(new ProcessDefinition[] {});
infos = this.convertProcessDefinitionsToProcessDefinitionInfos(objects);
} catch (Exception ex) {
throw new VCIError("410109", new String[] {});
}
return infos;
}
public String getDepolymentID(String executionId) throws VCIError {
String str = "";
try{
ProcessTemplateService srv = new ProcessTemplateService();
str = srv.getDepolymentID(executionId);
}catch(Exception ex) {
ex.printStackTrace();
throw new VCIError("-1", new String[] {});
}
return str;
}
public byte[] getFlowImageByDeployID(String deployID) throws VCIError,IOException {
return new ProcessTemplateService().getFlowImageByDeployID(deployID);
}
// public FlowTaskInfo[] getDoneTaskByUserId(String pluseroid,int first,int pageSize, String expandSql) {
// return new ProcessTemplateService().getDoneTaskByUserId(pluseroid,first,pageSize, expandSql);
// }
/**
* 已办任务
* @param pluseroid
* @param first
* @param pageSize
* @param taskType
* @param querySQL
* @return
*/
public FlowTaskInfo[] getDoneTaskByUserId(String pluseroid,int first,int pageSize,String taskType,String querySQL) {
return new ProcessTemplateService().getDoneTaskByUserId(pluseroid, first, pageSize, taskType, querySQL);
}
/**
* 已办任务-可排序
* @param pluseroid
* @param first
* @param pageSize
* @param taskType
* @param querySQL
* @param orderStr
* @return
*/
public FlowTaskInfo[] getDoneTaskCompositorByUserId(String pluseroid,int first,int pageSize,String taskType,String querySQL,String orderStr) {
return new ProcessTemplateService().getDoneTaskCompositorByUserId(pluseroid, first, pageSize, taskType, querySQL, orderStr);
}
// public int queryDoneTaskCount(String pluseroid, String expandSql) throws VCIError{
// int count = 1;
// try{
// count = new ProcessTemplateService().queryDoneTaskCount(pluseroid, expandSql);
// }catch(Exception ex) {
// ex.printStackTrace();
// throw new VCIError(410117, new String[] {});
// }
// return count;
// }
/**
* 已办任务总数
* @param pluseroid
* @param expandSql
* @return
* @throws VCIError
*/
public int queryDoneTaskCount(String pluseroid,String expandSql) throws VCIError{
int count = 1;
try{
count = new ProcessTemplateService().queryDoneTaskCount(pluseroid, expandSql);
}catch(Exception ex) {
ex.printStackTrace();
throw new VCIError("410117", new String[] {});
}
return count;
}
public boolean checkKey(String name, String keyValue) throws VCIError{
return new ProcessTemplateService().checkKey(name, keyValue);
}
public String[] getDeployId(String taskId) throws VCIError {
return new ProcessTemplateService().getDeployId(taskId);
}
/**
* 判断下一任务节点是否是end节点
* @param jbpmDeploymentId
* @param taskName
* @return
* @throws VCIError
*/
public boolean getProcessTaskByTaskName(String taskId,String taskName,String outcome) throws VCIError{
try {
return new ProcessTemplateService().getProcessTaskByTaskName(taskId, taskName, outcome);
} catch (Exception e) {
e.printStackTrace();
throw new VCIError("410202", new String[]{e.getMessage()});
}
}
/**
* 五院专用
* @param pluseroid
* @param first
* @param pageSize
* @return
*/
public FlowTaskInfo[] getTodoTaskByUser(String pluseroid,int first,int pageSize) {
FlowTaskInfo[] taskInfo = new ProcessTemplateService().getTodoTaskByUserId(pluseroid,first,pageSize,"","");
// FlowTaskInfo[] todoTask = new FlowTaskInfo[taskInfo.length];
for(int i=0;i lstTaskAssign = new ArrayList();
for (TasksAssigned a : tasksAssigneds){
TasksAssignedInfo info = new TasksAssignedInfo();
info.id = a.getId();
// info.TasksId = tasksAssigned.getTasksId();
info.TasksName = a.getTasksName();
// info.TasksTrueName = tasksAssigned.getTasksTrueName();
info.userName = a.getUserName();
info.isTrue = a.getIsTrue();
info.startTime = a.getStartTime().getTime();
info.endTime = a.getEndTime().getTime();
info.fromUser = a.getFromUser()==null?"":a.getFromUser();
lstTaskAssign.add(info);
}
return lstTaskAssign.toArray(new TasksAssignedInfo[0]);
}
public void saveSubProcess(SubprocessTemInfo[] subprocessTemInfos){
new ProcessTemplateService().saveSubProcess(subprocessTemInfos);
}
public int checkSubprocessQuote(String subProcess){
return new ProcessTemplateService().checkSubprocessQuote(subProcess);
}
public void configTaskAndUser(String deploymentId,String[] dataIds,String[] taskName,String[][] userName){
Map taskAndUserMap = new HashMap();
for(int i=0;iDescription:
*
* @author xchao
* @time 2012-11-10
* @param jbpmDeploymentId
* @param taskName
* @param outcome
* @return
* @throws Exception
*/
public String getNextCandidatesDefineString(String jbpmDeploymentId, String taskName,
String outcome) throws VCIError {
String res = "";
try {
res = new ProcessTemplateService().getNextCandidatesDefineString(jbpmDeploymentId, taskName, outcome);
} catch (Exception ex) {
throw new VCIError("410122", new String[] {});
}
return res;
}
/**
* 流程监控
* @param pluseroid
* @param first
* @param pageSize
* @param taskType
* @param querySQL
* @return
*/
public FlowTaskInfo[] getProcessControlByUserId(String pluseroid,int first,int pageSize,String taskType,String querySQL) {
return new ProcessTemplateService().getProcessControlByUserId(pluseroid,first,pageSize,taskType,querySQL);
}
public int queryProcessControlCount(String pluseroid,String taskType) throws VCIError{
int count = 1;
try{
count = new ProcessTemplateService().queryProcessControlCount(pluseroid,taskType);
}catch(Exception ex) {
ex.printStackTrace();
throw new VCIError("410117", new String[] {});
}
return count;
}
public FlowTaskInfo[] getDoneProcessByUserId(String pluseroid,int first,int pageSize,String taskType,String querySQL) {
return new ProcessTemplateService().getDoneProcessByUserId(pluseroid,first,pageSize,taskType,querySQL);
}
public int queryDoneProcessCount(String pluseroid,String taskType) throws VCIError{
int count = 1;
try{
count = new ProcessTemplateService().queryDoneProcessCount(pluseroid,taskType);
}catch(Exception ex) {
ex.printStackTrace();
throw new VCIError("410117", new String[] {});
}
return count;
}
/**
* 查询流程模板的第一个任务对象
* Description:
*
* @author xchao
* @time 2012-6-6
* @param jbpmDeploymentId 流程模板部署的ID
* @return
* @throws VCIError
*/
public ProcessTaskInfo getFirstProcessTask(String jbpmDeploymentId) throws VCIError{
try{
ProcessTask processTask = new ProcessTemplateService().getFirstProcessTask(jbpmDeploymentId);
return this.findTaskPropertyById(jbpmDeploymentId, processTask.getTaskName());
}catch(Exception ex){
ex.printStackTrace();
throw new VCIError("410117", new String[]{ex.getMessage()});
}
}
public ProcessTaskInfo getFirstProcessTaskByExecId(String execId) throws VCIError{
try{
String jbpmDeploymentId = getDeploymentIdByExecutionId(execId);
ProcessTask processTask = new ProcessTemplateService().getFirstProcessTask(jbpmDeploymentId);
return this.findTaskPropertyById(jbpmDeploymentId, processTask.getTaskName());
}catch(Exception ex){
ex.printStackTrace();
throw new VCIError("410117", new String[]{ex.getMessage()});
}
}
/**
*
* 查询当前节点同意的所有的下一任务节点数据:
* 返回格式:transitionName,TaskName;transitionName,TaskName;的字符串值
*
*
* @time 2013-3-31
* @param taskId 任务ID
* @param taskName 任务名称
* @param outcome 同意或者不同意;
* @return
*/
public String getAllNoAgreeProcessTaskByTaskName(String taskId,String taskName,String outcome) throws VCIError{
try {
return new ProcessTemplateService().getAllNoAgreeProcessTaskByTaskName(taskId, taskName, outcome);
} catch (Exception e) {
e.printStackTrace();
throw new VCIError("410202", new String[]{e.getMessage()});
}
}
public boolean setNodeHide(String deploymentId) throws VCIError {
return new ProcessTemplateService().setNodeHide(deploymentId);
}
//隐藏流程节点方法
public NodeHideInfo[] getNodeHideDeploymentId() {
List list = null;
ProcessTemplateService uservice = new ProcessTemplateService();
list = uservice.getNodeHideDeploymentId();
NodeHideInfo[] info = new NodeHideInfo[list.size()];
for(int i=0;iDescription:
*
* @time 2013-4-27
* @param execId
* @return
* @throws VCIError
*/
public String getProcessTaskId(String execId)throws VCIError {
String res = "";
try {
res = new ProcessTemplateService().getProcessTaskId(execId);
}catch(Exception e) {
throw new VCIError("410205",new String[0]);
}
return res;
}
public boolean setProcessHide(String jbpmdeplotmentId,int status) throws VCIError{
boolean res = false;
try{
res = new ProcessTemplateService().setProcessHide(jbpmdeplotmentId,status);
}catch(Exception e) {
if(status ==0){
throw new VCIError("410301",new String[0]);
}else throw new VCIError("410302",new String[0]);
}
return res;
}
/**
* 获取策略列表
* @param taskName
* @param deploymentId
* @return
*/
public TaskRevokeInfo[] getTaskRevokeList(String taskName, String deploymentId){
List list = new ProcessTemplateService().getTaskRevokeList(taskName, deploymentId);
TaskRevokeInfo[] taskRevokeInfo = new TaskRevokeInfo[list.size()];
for(int i=0;i allUserListForTask = new ProcessTemplateService().getAllUserListForTask(taskName, deploymentId, outcome,varKey, varValue);
return allUserListForTask.toArray(new String[0]);
}
/**
* 撤销任务
* @param assignName
* @param destActivityName
* @param executionId
* @return
*/
public boolean revokeTask(String taskName,String destActivityName, String executionId){
return new ProcessTemplateService().revokeTask(taskName, destActivityName, executionId);
}
/**
* 任务指派
* @param destActivityName
* @param tagActivityName
* @param classNames
* @param userNames
* @return
*/
public boolean appointTask(String destActivityName,String tagActivityName,String[] classNames,String executionId, String[] userNames){
return new ProcessTemplateService().appointTask(destActivityName, tagActivityName, classNames,executionId, userNames);
}
/**
* 任务指派
* @param destActivityName
* @param tagActivityName
* @param classNames
* @param userNames
* @return
*/
public boolean appointTask2(String destActivityName,String tagActivityName,String[] classNames,String executionId, String[] userNames, UserEntityInfo userEntityInfo){
return new ProcessTemplateService(this.getUserEntity()).appointTask2(destActivityName, tagActivityName, classNames,executionId, userNames, userEntityInfo);
}
/**
* 返回流程执行时的参数值
* Description:
* @author xchao
* @time 2013-5-24
* @param executionId 流程执行ID
* @param varName 变量名称
* @return
*/
public String getProcessVariable(String executionId, String varName) throws VCIError{
String str = "";
try{
ProcessTemplateService srv = new ProcessTemplateService();
str = srv.getProcessVariable(executionId, varName);
}catch(Exception ex) {
ex.printStackTrace();
throw new VCIError("410401", new String[] {ex.getMessage()});
}
return str;
}
public String[] getTasksNameByProcessName(final String[] processNames) throws VCIError{
List list = new LinkedList();
try {
list = new ProcessTemplateService().getTasksNameByProcessName(processNames);
} catch (SQLException e) {
e.printStackTrace();
throw new VCIError("410303",new String[0]);
}
return list.toArray(new String[0]);
}
/**
*
* Description: 查看已办任务的详细信息
*
* @time 2013-4-11
* @param executionId
* @return
* @throws VCIError
*/
public String searchComplateTask(String[] param) throws VCIError {
String str = "";
try{
ProcessTemplateService srv = new ProcessTemplateService();
str = srv.searchComplateTask(param);
}catch(Exception ex) {
ex.printStackTrace();
throw new VCIError("-1", new String[] {});
}
return str;
}
public TasksAssignedInfo[] getTasksAssignedByPageing(LongHolder total,QueryParamInfo queryParamInfo) throws VCIError{
TasksAssignedInfo[] infos = new TasksAssignedInfo[0];
try{
QueryParam queryParam = this.convertQueryParam(queryParamInfo);
QueryResult res = new ProcessTemplateService(this.getUserEntity()).getTasksAssignedByPageing(queryParam);
total.value = res.getTotal();
TasksAssigned[] objects = res.getDatas();
infos = this.coventObjectListToInfoList(objects);
}catch(Exception ex){
throw new VCIError("810005", new String[]{});
}
return infos;
}
private QueryParam convertQueryParam(QueryParamInfo info){
QueryParam obj = new QueryParam();
obj.setCustomQueryString(info.customQueryString);
obj.setPageIndex(info.pageIndex);
obj.setPageSize(info.pageSize);
return obj;
}
private TasksAssignedInfo[] coventObjectListToInfoList(TasksAssigned[] obj){
TasksAssignedInfo[] infos = new TasksAssignedInfo[obj.length];
for(int i = 0;i list = new ProcessTemplateService().getHistoryActivityByProInsIdbyPLM(processInstanceId);
return convListToFlowApproveHistoryInfo(list);
}
public String startPocessByPLM_v1(String processDefinitionKey,
FlowInstanceInfo flowInstanceInfo, String[] objId,
UserEntityInfo userEntityInfo, String[] userName, String outcome,
String[] tasknames, String[][] taskUserNames,
MapTransfersInfo[] mapTransfersServerObject,
String[] objectProperty, String[][] objectPropertyValues)
throws VCIError {
Map taskAndUserMap = new HashMap();
for (int i = 0; i < tasknames.length; i++) {
taskAndUserMap.put(tasknames[i], taskUserNames[i]);
}
Map mapParams = new HashMap();
for (int i = 0; i < mapTransfersServerObject.length; i++) {
mapParams.put(mapTransfersServerObject[i].key,
mapTransfersServerObject[i].value);
}
return new ProcessTemplateService(this.getUserEntity())
.startPocessByPLM_v1(processDefinitionKey, flowInstanceInfo,
objId, userName, outcome, taskAndUserMap, mapParams,
objectProperty, objectPropertyValues, userEntityInfo);
}
public String startProcessAndExecuteFirstNode(String processDefinitionKey,
FlowInstanceInfo flowInstanceInfo, String[] objId,
UserEntityInfo userEntityInfo, String[] userName, String outcome,
String[] tasknames, String[][] taskUserNames,
MapTransfersInfo[] mapTransfersServerObject,
String[] objectProperty, String[][] objectPropertyValues)
throws VCIError {
Map taskAndUserMap = new HashMap();
for (int i = 0; i < tasknames.length; i++) {
taskAndUserMap.put(tasknames[i], taskUserNames[i]);
}
Map mapParams = new HashMap();
for (int i = 0; i < mapTransfersServerObject.length; i++) {
mapParams.put(mapTransfersServerObject[i].key,
mapTransfersServerObject[i].value);
}
return new ProcessTemplateService(this.getUserEntity())
.startProcessAndExecuteFirstNode(processDefinitionKey,
flowInstanceInfo, objId, userEntityInfo, userName,
outcome, taskAndUserMap, mapParams, objectProperty,
objectPropertyValues);
}
public boolean completeTaskByPlatform_v1(String taskId, String outcome,
String nextTask, String approvalNote,
UserEntityInfo userEntityInfo, String[] userName,
String[] objectProperty, String[][] objectPropertyValues)
throws VCIError {
try {
return new ProcessTemplateService(this.getUserEntity())
.completeTaskByPlatform_v1(taskId, outcome, nextTask,
approvalNote, userEntityInfo, userName,
objectProperty, objectPropertyValues);
} catch (VCIError e) {
throw e;
}
}
public boolean completeTasksByPlatform_v1(String[] taskIds, String outcome,
String nextTask, String approvalNote,
UserEntityInfo userEntityInfo, String[] userName,
String[] objectProperty, String[][] objectPropertyValues)
throws VCIError {
try {
return new ProcessTemplateService(this.getUserEntity())
.completeTasksByPlatform_v1(taskIds, outcome, nextTask,
approvalNote, userEntityInfo, userName,
objectProperty, objectPropertyValues);
} catch (VCIError e) {
throw e;
}
}
public boolean resetNodeUser(String executionId, String[] taskNames,
String[] userNames) throws VCIError {
return new ProcessTemplateService(this.getUserEntity()).resetNodeUser(executionId, taskNames, userNames);
}
}