package com.vci.client.uif.actions.client;
|
|
import java.util.List;
|
import java.util.Map;
|
import java.util.Map.Entry;
|
|
import com.vci.client.LogonApplication;
|
import com.vci.client.common.objects.UserEntityObject;
|
import com.vci.client.common.objects.UserObject;
|
import com.vci.client.ui.swing.VCIOptionPane;
|
import com.vci.client.uif.engine.common.IDataNode;
|
import com.vci.client.workflow.delegate.ProcessCustomClientDelegate;
|
import com.vci.client.workflow.task.ResetTaskUserByPlatformDialog;
|
import com.vci.corba.common.VCIError;
|
import com.vci.mw.ClientContextVariable;
|
|
/**
|
* 执行流程 Action
|
* <p>执行流程</p>
|
* @author liudi
|
*
|
*/
|
public class ResetTaskUserWorkFlowAction extends AbstractBusionessOperationAction {
|
|
@Override
|
public String getKey() {
|
return "resettaskuser";
|
}
|
|
@Override
|
public boolean checkHasRight(){
|
// 按BO进行数据权限检查
|
setDataRightCheckType(RightCheckConstants.RIGHT_CHECK_TYPE_B);
|
return super.checkHasRight();
|
}
|
|
/* (non-Javadoc)
|
* @see plm.uif.actions.client.BusinessOperationAction#doPost()
|
*/
|
@Override
|
public boolean doPost() {
|
// 获取选择的数据
|
// 数据的实际类型一般为 IDataNode
|
Object[] objs = getDataModel().getSelectObjects();
|
// paramsMap = getButtonParams();
|
|
UserEntityObject userEntityObject = new UserEntityObject();
|
String ip = ClientContextVariable.getInvocationInfo().clientIPInfo;
|
String loginUserName = ClientContextVariable.getInvocationInfo().userName;
|
userEntityObject.setIp(ip);
|
userEntityObject.setUserName(loginUserName);
|
userEntityObject.setModules("");
|
ProcessCustomClientDelegate delegate = new ProcessCustomClientDelegate(userEntityObject);
|
String[] taskOids = new String[objs.length];
|
String[] executionIds = new String[objs.length];
|
String[] taskNames = new String[objs.length];
|
String[] taskStatuss = new String[objs.length];
|
for(int objectIndex=0;objectIndex<objs.length;objectIndex++){
|
IDataNode idn = (IDataNode) objs[objectIndex];
|
Map<String, String> valueMap = idn.getValueMap();
|
int j=0;
|
int k=0;
|
for(Entry<String, String> entrySet : valueMap.entrySet()){
|
if(entrySet.getKey()!=null&&entrySet.getKey().equals("Executionid".toLowerCase())){
|
executionIds[j] = entrySet.getValue();
|
j++;
|
}
|
if(entrySet.getKey()!=null&&entrySet.getKey().equals("Name".toLowerCase())){
|
taskNames[k] = entrySet.getValue().substring(entrySet.getValue().lastIndexOf("-")+1);
|
k++;
|
}
|
}
|
}
|
ResetTaskUserByPlatformDialog dialog = new ResetTaskUserByPlatformDialog(executionIds[0],taskOids[0], taskNames[0],taskStatuss[0]);
|
dialog.setVisible(true);
|
try {
|
if(dialog.isSaveFlag()){
|
Map<String, List<String>> taskAndUserMap = dialog
|
.getTaskAndUserMap();
|
int taskIndex = 0;
|
// 任务名称数组
|
String[] tasknames = new String[taskAndUserMap.size()];
|
// 任务对应的用户数组
|
String[][] taskUserNames = new String[taskAndUserMap.size()][];
|
for (Entry<String, List<String>> entrySet : taskAndUserMap
|
.entrySet()) {
|
tasknames[taskIndex] = entrySet.getKey();
|
List<String> list = entrySet.getValue();
|
String[] array = list.toArray(new String[] {});
|
String[] userNames = new String[array.length];
|
for (int userIndex = 0; userIndex < array.length; userIndex++) {
|
userNames[userIndex] = array[userIndex];
|
}
|
taskUserNames[taskIndex] = userNames;
|
taskIndex++;
|
}
|
delegate.setTaskAndUserForComplete(executionIds[0], tasknames, taskUserNames);
|
}
|
return true;
|
} catch (VCIError e) {
|
e.printStackTrace();
|
VCIOptionPane.showMessageDialog(LogonApplication.frame,e.code);
|
return false;
|
}
|
}
|
}
|