package com.vci.client.workflow.editor.user;
|
|
import java.awt.BorderLayout;
|
import java.awt.FlowLayout;
|
import java.awt.GridBagConstraints;
|
import java.awt.GridBagLayout;
|
import java.awt.Insets;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
import java.lang.reflect.InvocationTargetException;
|
import java.util.ArrayList;
|
import java.util.List;
|
|
import javax.swing.BoxLayout;
|
import javax.swing.ButtonGroup;
|
import javax.swing.DefaultListModel;
|
import javax.swing.JButton;
|
import javax.swing.JComponent;
|
import javax.swing.JList;
|
import javax.swing.JPanel;
|
import javax.swing.JRadioButton;
|
import javax.swing.JScrollPane;
|
import javax.swing.JTextArea;
|
import javax.swing.border.TitledBorder;
|
|
import com.vci.client.LogonApplication;
|
import com.vci.client.bof.ClientBusinessObject;
|
import com.vci.client.bof.ClientBusinessObjectOperation;
|
import com.vci.client.common.objects.DeptObject;
|
import com.vci.client.common.objects.RoleObject;
|
import com.vci.client.common.objects.UserObject;
|
import com.vci.client.framework.delegate.RightManagementClientDelegate;
|
import com.vci.client.ui.exception.VCIException;
|
import com.vci.client.ui.swing.VCIOptionPane;
|
import com.vci.common.resource.CommonProperties;
|
import com.vci.corba.common.VCIError;
|
|
public class RMUserNewComponent extends UserPanel {
|
|
private static final long serialVersionUID = -990618910839831914L;
|
|
private JPanel userComponent;
|
|
private JList list;
|
|
private DefaultListModel listModel;
|
|
private JList userDepartmentList;
|
private JList userRoleList;
|
private JList userDeptList;
|
private JList userLineList;
|
private JList deptAndUserList;
|
private DefaultListModel userDepartmentListModel;
|
private DefaultListModel userRoleListModel;
|
private DefaultListModel userDeptListModel;
|
private DefaultListModel userLineListModel;
|
private DefaultListModel deptAndUserListModel;
|
private List<Object> userDepartmentObjs = new ArrayList<Object>();
|
private List<Object> userRoleObjs = new ArrayList<Object>();
|
private List<Object> userDeptObjs = new ArrayList<Object>();
|
private List<Object> userLineObjs = new ArrayList<Object>();
|
private List<String[]> deptAndUserObjs = new ArrayList<String[]>();
|
|
private JButton btnNewButton ;
|
private JButton btnNewButton_1 ;
|
|
private JTextArea custText = new JTextArea();
|
JScrollPane scrollPane = new JScrollPane();
|
//选中某一按钮,记录下所选按钮的对象名称
|
private String radioChoseFlag = "userDepartment";
|
|
private CustomEditPanel customUserPanel;
|
|
public RMUserNewComponent() {
|
setLayout(new BorderLayout(0, 0));
|
|
userComponent = new JPanel();
|
|
add(userComponent);
|
GridBagLayout gbl_panel_3 = new GridBagLayout();
|
userComponent.setLayout(gbl_panel_3);
|
userComponent.setBorder(new TitledBorder("候选人"));
|
|
JPanel userListPanel = new JPanel();
|
JPanel radioPanel = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
userListPanel.setLayout(new BorderLayout());
|
JRadioButton userDepartmentBtn = new JRadioButton("用户部门");
|
JRadioButton userRoleBtn = new JRadioButton("用户角色");
|
JRadioButton userDeptBtn = new JRadioButton("用户群组");
|
JRadioButton userLineBtn = new JRadioButton("用户关系");
|
JRadioButton deptAndUserBtn = new JRadioButton("部门用户关系");
|
JRadioButton custRadioBtn = new JRadioButton("自定义用户规则");
|
|
listModel = new DefaultListModel();
|
list = new JList(listModel);
|
scrollPane.setViewportView(list);
|
|
JPanel panel = new JPanel();
|
GridBagConstraints gbc_panel = new GridBagConstraints();
|
gbc_panel.fill = GridBagConstraints.BOTH;
|
gbc_panel.gridx = 1;
|
gbc_panel.gridy = 0;
|
userComponent.add(panel, gbc_panel);
|
panel.setLayout(new BorderLayout(0, 0));
|
|
JPanel panel_1 = new JPanel();
|
panel.add(panel_1, BorderLayout.WEST);
|
panel_1.setLayout(new BoxLayout(panel_1, BoxLayout.Y_AXIS));
|
|
btnNewButton = new JButton("添加");
|
btnNewButton.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent actionevent) {
|
selectUser();
|
}
|
|
});
|
panel_1.add(btnNewButton);
|
|
btnNewButton_1 = new JButton("删除");
|
btnNewButton_1.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent actionevent) {
|
delete();
|
}
|
});
|
panel_1.add(btnNewButton_1);
|
|
ButtonGroup bg = new ButtonGroup();
|
bg.add(userDepartmentBtn);
|
bg.add(userRoleBtn);
|
bg.add(userDeptBtn);
|
bg.add(userLineBtn);
|
bg.add(deptAndUserBtn);
|
bg.add(custRadioBtn);
|
userDepartmentBtn.setSelected(true);
|
radioPanel.add(userDepartmentBtn);
|
String userDialogControl = CommonProperties.getStringProperty("workflow.UserDialog");
|
if(userDialogControl==null||"".equals(userDialogControl)){
|
radioPanel.add(userRoleBtn);
|
radioPanel.add(userDeptBtn);
|
radioPanel.add(userLineBtn);
|
radioPanel.add(deptAndUserBtn);
|
radioPanel.add(custRadioBtn);
|
}
|
//用户部门单选按钮
|
userDepartmentBtn.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
radioChoseFlag = "userDepartment";
|
scrollPane.setViewportView(userDepartmentList);
|
controlBtn(radioChoseFlag);
|
}
|
});
|
//用户角色单选按钮
|
userRoleBtn.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
radioChoseFlag = "userRole";
|
scrollPane.setViewportView(userRoleList);
|
controlBtn(radioChoseFlag);
|
}
|
});
|
//用户群组单选按钮
|
userDeptBtn.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
radioChoseFlag = "userDept";
|
scrollPane.setViewportView(userDeptList);
|
controlBtn(radioChoseFlag);
|
}
|
});
|
//用户关系单选按钮
|
userLineBtn.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
radioChoseFlag = "userLine";
|
scrollPane.setViewportView(userLineList);
|
controlBtn(radioChoseFlag);
|
}
|
});
|
//部门用户部门单选按钮
|
deptAndUserBtn.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
radioChoseFlag = "deptAndUser";
|
scrollPane.setViewportView(deptAndUserList);
|
controlBtn(radioChoseFlag);
|
}
|
});
|
//用户自定义规则单选按钮
|
custRadioBtn.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
radioChoseFlag = "cust";
|
scrollPane.getViewport().add(customUserPanel);
|
controlBtn(radioChoseFlag);
|
}
|
|
});
|
|
userListPanel.add(radioPanel,BorderLayout.NORTH);
|
userListPanel.add(scrollPane,BorderLayout.CENTER);
|
|
GridBagConstraints gbc_scrollPane = new GridBagConstraints();
|
gbc_scrollPane.weighty = 1.0;
|
gbc_scrollPane.weightx = 1.0;
|
gbc_scrollPane.fill = GridBagConstraints.BOTH;
|
gbc_scrollPane.anchor = GridBagConstraints.CENTER;
|
gbc_scrollPane.insets = new Insets(0, 0, 0, 5);
|
gbc_scrollPane.gridx = 0;
|
gbc_scrollPane.gridy = 0;
|
userComponent.add(userListPanel, gbc_scrollPane);
|
|
listModel = new DefaultListModel();
|
list = new JList(listModel);
|
|
userDepartmentListModel = new DefaultListModel();
|
userRoleListModel = new DefaultListModel();
|
userDeptListModel = new DefaultListModel();
|
userLineListModel = new DefaultListModel();
|
deptAndUserListModel = new DefaultListModel();
|
userDepartmentList = new JList(userDepartmentListModel);
|
userRoleList = new JList(userRoleListModel);
|
userDeptList = new JList(userDeptListModel);
|
userLineList = new JList(userLineListModel);
|
deptAndUserList = new JList(deptAndUserListModel);
|
scrollPane.setViewportView(userDepartmentList);
|
}
|
|
private void controlBtn(String str) {
|
if("cust".equals(str)){
|
btnNewButton.setEnabled(false);
|
btnNewButton_1.setEnabled(false);
|
}else{
|
btnNewButton.setEnabled(true);
|
btnNewButton_1.setEnabled(true);
|
}
|
}
|
|
private void delete(){
|
int userDepartmentIndex = userDepartmentList.getSelectedIndex();
|
int userRoleIndex = userRoleList.getSelectedIndex();
|
int userDeptIndex = userDeptList.getSelectedIndex();
|
int userLineIndex = userDeptList.getSelectedIndex();
|
int deptAndUserIndex = userDeptList.getSelectedIndex();
|
if(radioChoseFlag.equals("userDepartment")){
|
if (userDepartmentIndex == -1) {
|
VCIOptionPane.showMessage(LogonApplication.frame, "请选择记录");
|
return;
|
}
|
if(userNameList!=null&&userNameList.size()>0){
|
userNameList.remove(userDepartmentIndex);
|
}
|
int[] selectedNum = userDepartmentList.getSelectedIndices();
|
for (int i = 0;i < selectedNum.length;i++) {
|
userDepartmentListModel.removeElementAt(selectedNum[i] - i);
|
userDepartmentObjs.remove(selectedNum[i] - i);
|
}
|
userDepartmentList.updateUI();
|
|
}
|
if(radioChoseFlag.equals("userRole")){
|
if (userRoleIndex == -1) {
|
VCIOptionPane.showMessage(LogonApplication.frame, "请选择记录");
|
return;
|
}
|
int[] selectedNum = userRoleList.getSelectedIndices();
|
for (int i = 0;i < selectedNum.length;i++) {
|
userRoleListModel.removeElementAt(selectedNum[i] - i);
|
userRoleObjs.remove(selectedNum[i] - i);
|
}
|
userRoleList.updateUI();
|
}
|
if(radioChoseFlag.equals("userDept")){
|
if (userDeptIndex == -1) {
|
VCIOptionPane.showMessage(LogonApplication.frame, "请选择记录");
|
return;
|
}
|
int[] selectedNum = userDeptList.getSelectedIndices();
|
for (int i = 0;i < selectedNum.length;i++) {
|
userDeptListModel.removeElementAt(selectedNum[i] - i);
|
userDeptObjs.remove(selectedNum[i] - i);
|
}
|
userDeptList.updateUI();
|
}
|
if(radioChoseFlag.equals("userLine")){
|
if (userLineIndex == -1) {
|
VCIOptionPane.showMessage(LogonApplication.frame, "请选择记录");
|
return;
|
}
|
int[] selectedNum = userLineList.getSelectedIndices();
|
for (int i = 0;i < selectedNum.length;i++) {
|
userLineListModel.removeElementAt(selectedNum[i] - i);
|
userLineObjs.remove(selectedNum[i] - i);
|
}
|
userLineList.updateUI();
|
}
|
if(radioChoseFlag.equals("deptAndUser")){
|
if (deptAndUserIndex == -1) {
|
VCIOptionPane.showMessage(LogonApplication.frame, "请选择记录");
|
return;
|
}
|
int[] selectedNum = deptAndUserList.getSelectedIndices();
|
for (int i = 0;i < selectedNum.length;i++) {
|
deptAndUserListModel.removeElementAt(selectedNum[i] - i);
|
deptAndUserObjs.remove(selectedNum[i] - i);
|
}
|
}
|
}
|
|
private void selectUser() {
|
String userDialogControl = CommonProperties.getStringProperty("workflow.UserDialog");
|
if(userDialogControl!=null&&!"".equals(userDialogControl)){
|
Class<?> cls;
|
try {
|
cls = Class.forName(userDialogControl);
|
CustomUserDialog res = (CustomUserDialog) cls.getConstructor(RMUserNewComponent.class).newInstance(this);
|
res.setLocationRelativeTo(null);
|
res.setVisible(true);
|
|
if(interFaceResult!=null&&!"".equals(interFaceResult)){
|
listModel.addElement(interFaceResult);
|
}
|
} catch (ClassNotFoundException e) {
|
e.printStackTrace();
|
} catch (IllegalArgumentException e) {
|
e.printStackTrace();
|
} catch (SecurityException e) {
|
e.printStackTrace();
|
} catch (InstantiationException e) {
|
e.printStackTrace();
|
} catch (IllegalAccessException e) {
|
e.printStackTrace();
|
} catch (InvocationTargetException e) {
|
e.printStackTrace();
|
} catch (NoSuchMethodException e) {
|
e.printStackTrace();
|
}
|
}else{
|
TaskUserDialog taskUserDialog = new TaskUserDialog();
|
taskUserDialog.setLocationRelativeTo(null);
|
taskUserDialog.setVisible(true);
|
|
List<Object> departobjectlist = taskUserDialog.getDepartresultList();//部门关系值
|
List<Object> roleobjectlist = taskUserDialog.getRoleresultList();//角色关系值
|
List<Object> deptobjectlist = taskUserDialog.getDeptresultList();//组织关系值
|
List<Object> lineobjectlist = taskUserDialog.getLineresultList();//用户关系值
|
List<Object> lineShowList = taskUserDialog.getLineShowList();//用户关系显示值
|
List<Object> deptUserobjectlist = taskUserDialog.getDeptUserresultList();//部门用户关系值
|
if (departobjectlist != null && departobjectlist.size() > 0) {
|
for (int i = 0 ; i < departobjectlist.size(); i++) {
|
Object obj = departobjectlist.get(i);
|
if (judgeObjectIsExist(userDepartmentObjs, obj)) {
|
continue;
|
} else {
|
if (obj instanceof ClientBusinessObject) {
|
userDepartmentListModel.addElement(((ClientBusinessObject) obj).getName());
|
userDepartmentObjs.add(obj);
|
}
|
}
|
}
|
}
|
if (roleobjectlist != null && roleobjectlist.size() > 0) {
|
for (int i = 0 ; i < roleobjectlist.size(); i++) {
|
Object obj = roleobjectlist.get(i);
|
if (judgeObjectIsExist(userRoleObjs, obj)) {
|
continue;
|
} else {
|
if (obj instanceof ClientBusinessObject) {
|
userRoleListModel.addElement(((ClientBusinessObject) obj).getName());
|
userRoleObjs.add(obj);
|
}
|
}
|
}
|
}
|
if (deptobjectlist != null && deptobjectlist.size() > 0) {
|
for (int i = 0 ; i < deptobjectlist.size(); i++) {
|
Object obj = deptobjectlist.get(i);
|
if (judgeObjectIsExist(userDeptObjs, obj)) {
|
continue;
|
} else {
|
if (obj instanceof ClientBusinessObject) {
|
userDeptListModel.addElement(((ClientBusinessObject) obj).getName());
|
userDeptObjs.add(obj);
|
}
|
}
|
}
|
}
|
if ((lineobjectlist != null && lineobjectlist.size() > 0)
|
&& (lineShowList != null && lineShowList.size() > 0)
|
&& (lineShowList.size() == lineobjectlist.size())) {
|
for (int i = 0 ; i < lineShowList.size(); i++) {
|
Object obj = lineShowList.get(i);
|
Object realObj = lineobjectlist.get(i);
|
if (judgeUserLineObjectIsExist(userLineListModel, obj)) {
|
continue;
|
} else {
|
userLineListModel.addElement(obj.toString());
|
userLineObjs.add(realObj.toString());
|
}
|
}
|
}
|
if (deptUserobjectlist != null && deptUserobjectlist.size() > 0) {
|
List showList = taskUserDialog.getDeptAndUserList();
|
for (int i = 0 ; i < deptUserobjectlist.size(); i++) {
|
Object obj = deptUserobjectlist.get(i);
|
if (judgeObjectIsExist(deptAndUserObjs, obj)) {
|
continue;
|
} else {
|
if (obj instanceof ClientBusinessObject) {
|
String[] showVal = (String[]) showList.get(i);
|
deptAndUserListModel.addElement(showVal[1]);
|
String[] info = showVal[1].split(":");
|
String[] str = new String[4];
|
str[0] = ((ClientBusinessObject) obj).getOid();
|
str[1] = showVal[0];
|
str[2] = info[2];
|
str[3] = info[3];
|
deptAndUserObjs.add(str);
|
}
|
}
|
}
|
}
|
}
|
}
|
|
boolean judgeObjectIsExist(List curList, Object curObj) {
|
boolean flag = false;
|
int size = curList.size();
|
for(int i = 0; i < size; i++){
|
if(curList.get(i) instanceof ClientBusinessObject && curObj instanceof ClientBusinessObject){
|
curObj = (ClientBusinessObject)curObj;
|
flag = ((ClientBusinessObject) curObj).getOid().equals(((ClientBusinessObject)curList.get(i)).getOid());
|
if(flag) break;
|
}
|
else if (curList.get(i) instanceof String) {
|
flag = curList.get(i).toString().equals(curObj.toString());
|
if(flag) break;
|
} else {
|
String [] str = (String[]) curList.get(i);
|
flag = str[0].equals(((ClientBusinessObject) curObj).getOid());
|
if(flag) break;
|
}
|
}
|
return flag;
|
}
|
|
/**
|
* 判断用户关系是重复
|
* @param curList
|
* @param curObj
|
* @return
|
*/
|
boolean judgeUserLineObjectIsExist(DefaultListModel curList, Object curObj) {
|
boolean flag = false;
|
int size = curList.size();
|
for(int i = 0; i < size; i++){
|
if (curList.get(i) instanceof String) {
|
flag = curList.get(i).toString().equals(curObj.toString());
|
if(flag) break;
|
}
|
}
|
return flag;
|
}
|
|
public JComponent getUserComponent() {
|
return userComponent;
|
}
|
|
public JComponent getUserComponent(CustomEditPanel customUserPanel) {
|
this.customUserPanel = customUserPanel;
|
return userComponent;
|
}
|
|
/**
|
* 获取用户部门列表
|
* @return
|
* @author cmk
|
*/
|
public List<String> getSelectedUserDepartment() {
|
List<String> list = new ArrayList<String>();
|
int rolesize = userDepartmentObjs.size();
|
for (int i = 0; i < rolesize; i++) {
|
ClientBusinessObject obj = (ClientBusinessObject) userDepartmentObjs.get(i);
|
if ("department".equals(obj.getBtmName())) {
|
list.add("dept:" + ((ClientBusinessObject) obj).getOid());
|
} else if ("person".equals(obj.getBtmName())){
|
list.add("user:" + ((ClientBusinessObject) obj).getOid());
|
}
|
}
|
return list;
|
}
|
|
/**
|
* 获取用户角色列表
|
* @return
|
* @author cmk
|
*/
|
public List<String> getSelectedUserRole() {
|
List<String> list = new ArrayList<String>();
|
int rolesize = userRoleObjs.size();
|
for (int i = 0; i < rolesize; i++) {
|
ClientBusinessObject obj = (ClientBusinessObject) userRoleObjs.get(i);
|
if ("role".equals(obj.getBtmName())) {
|
list.add("role:" + ((ClientBusinessObject) obj).getOid());
|
} else if ("person".equals(obj.getBtmName())){
|
list.add("user:" + ((ClientBusinessObject) obj).getOid());
|
}
|
}
|
return list;
|
}
|
|
/**获取用户群组列表
|
* @return
|
*/
|
public List<String> getSelectedUserOrg() {
|
List<String> list = new ArrayList<String>();
|
int rolesize = userDeptObjs.size();
|
for (int i = 0; i < rolesize; i++) {
|
ClientBusinessObject obj = (ClientBusinessObject) userDeptObjs.get(i);
|
if ("organization".equals(obj.getBtmName())) {
|
list.add("org:" + ((ClientBusinessObject) obj).getOid());
|
} else if ("person".equals(obj.getBtmName())){
|
list.add("user:" + ((ClientBusinessObject) obj).getOid());
|
}
|
}
|
return list;
|
}
|
|
/**获取用户关系列表
|
* @return
|
*/
|
public List<String> getSelectedUserLine() {
|
List<String> list = new ArrayList<String>();
|
// int rolesize = userLineListModel.size();
|
int rolesize = userLineObjs.size();
|
for (int i = 0; i < rolesize; i++) {
|
// Object obj = userLineListModel.get(i);
|
Object obj = userLineObjs.get(i);
|
list.add(obj.toString());
|
// if ("所有人".equals(obj.toString())) {
|
// list.add("expression:all");
|
// } else if ("拟稿人".equals(obj.toString())) {
|
// list.add("expression:creator");
|
// } else if ("拟稿人所在部门".equals(obj.toString())) {
|
// list.add("expression:creator.dept");
|
// } else if ("当前处理人所在部门".equals(obj.toString())) {
|
// list.add("expression:owner.dept");
|
// } else if ("所有领导".equals(obj.toString())) {
|
// list.add("expression:allleader");
|
// } else if ("所有秘书".equals(obj.toString())) {
|
// list.add("expression:allsecretary");
|
// } else if ("拟稿人所在部门领导".equals(obj.toString())) {
|
// list.add("expression:creator.dept.leader");
|
// } else if ("当前处理人所在部门领导".equals(obj.toString())) {
|
// list.add("expression:owner.dept.leader");
|
// } else if ("当前节点处理人".equals(obj.toString())) {
|
// list.add("expression:owner");
|
// } else if ("某一级别的所有人".equals(obj.toString())) {
|
// list.add("expression:onenode.alluser");
|
// } else if ("某一节点处理人".equals(obj.toString())) {
|
// list.add("expression:onenode.manager");
|
// } else if ("从业务表单中选择".equals(obj.toString())) {
|
// list.add("expression:chooseByForm");
|
// } else if ("当前人的自定义组".equals(obj.toString())) {//暂不处理
|
// list.add("expression:owner.customorg");
|
// } else if ("当前处理人的一级部门".equals(obj.toString())) {
|
// list.add("expression:owner.childdept");
|
// } else if ("反射类名".equals(obj.toString())) {
|
// list.add("custom:");
|
// }
|
}
|
return list;
|
}
|
|
/**获取部门用户关系列表
|
* @return
|
*/
|
public List<String> getSelectedDeptAddUser() {
|
List<String> list = new ArrayList<String>();
|
int rolesize = deptAndUserObjs.size();
|
for (int i = 0; i < rolesize; i++) {
|
String [] str = deptAndUserObjs.get(i);
|
list.add("dept1:" + str[0] + ":" + str[1] + ":" + str[2] + ":" + str[3]);
|
}
|
return list;
|
}
|
|
RightManagementClientDelegate rmgrDel = new RightManagementClientDelegate(LogonApplication.getUserEntityObject());
|
|
/**
|
* 设置用户部门面板数据
|
* @param users
|
*/
|
public void setSelectedUserDepartment(List<String> users) {
|
userDepartmentListModel.removeAllElements();
|
userDepartmentObjs.clear();
|
try {
|
String[] elements = users.get(0).split(",");
|
if (elements != null && elements.length > 0) {
|
for (int i = 0 ; i < elements.length; i++) {
|
String ele = elements[i];
|
if (ele.indexOf("user:") == 0) {
|
String userName = ele.substring(ele.indexOf(":") + 1);
|
ClientBusinessObjectOperation cboo = new ClientBusinessObjectOperation();
|
ClientBusinessObject cbo = cboo.readBusinessObjectById(userName, "person");
|
userDepartmentListModel.addElement(cbo.getName());
|
userDepartmentObjs.add(cbo);
|
} else if (ele.indexOf("dept:") == 0) {
|
String deptId = ele.substring(ele.indexOf(":") + 1);
|
ClientBusinessObjectOperation cboo = new ClientBusinessObjectOperation();
|
ClientBusinessObject cbo = cboo.readBusinessObjectById(deptId, "department");
|
userDepartmentListModel.addElement(cbo.getName());
|
userDepartmentObjs.add(cbo);
|
}
|
}
|
}
|
|
} catch (VCIError e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
}
|
|
/**
|
* 设置用户角色面板数据
|
* @param users
|
*/
|
public void setSelectedUserRole(List<String> users) {
|
userRoleListModel.removeAllElements();
|
userRoleObjs.clear();
|
try {
|
String[] elements = users.get(0).split(",");
|
if (elements != null && elements.length > 0) {
|
for (int i = 0 ; i < elements.length; i++) {
|
String ele = elements[i];
|
if (ele.indexOf("user:") == 0) {
|
String userName = ele.substring(ele.indexOf(":") + 1);
|
ClientBusinessObjectOperation cboo = new ClientBusinessObjectOperation();
|
ClientBusinessObject cbo = cboo.readBusinessObjectById(userName, "person");
|
userRoleListModel.addElement(cbo.getName());
|
userRoleObjs.add(cbo);
|
} else if (ele.indexOf("role:") == 0) {
|
String roleId = ele.substring(ele.indexOf(":") + 1);
|
ClientBusinessObjectOperation cboo = new ClientBusinessObjectOperation();
|
ClientBusinessObject cbo = cboo.readBusinessObjectById(roleId, "role");
|
userRoleListModel.addElement(cbo.getName());
|
userRoleObjs.add(cbo);
|
}
|
}
|
}
|
|
} catch (VCIError e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
}
|
|
/**
|
* 设置用户群组面板数据
|
* @param users
|
*/
|
public void setSelectedUserDept(List<String> users) {
|
userDeptListModel.removeAllElements();
|
userDeptObjs.clear();
|
try {
|
String[] elements = users.get(0).split(",");
|
if (elements != null && elements.length > 0) {
|
for (int i = 0 ; i < elements.length; i++) {
|
String ele = elements[i];
|
if (ele.indexOf("user:") == 0) {
|
String userName = ele.substring(ele.indexOf(":") + 1);
|
ClientBusinessObjectOperation cboo = new ClientBusinessObjectOperation();
|
ClientBusinessObject cbo = cboo.readBusinessObjectById(userName, "person");
|
userDeptListModel.addElement(cbo.getName());
|
userDeptObjs.add(cbo);
|
} else if (ele.indexOf("org:") == 0) {
|
String deptId = ele.substring(ele.indexOf(":") + 1);
|
ClientBusinessObjectOperation cboo = new ClientBusinessObjectOperation();
|
ClientBusinessObject cbo = cboo.readBusinessObjectById(deptId, "organization");
|
userDeptListModel.addElement(cbo.getName());
|
userDeptObjs.add(cbo);
|
}
|
}
|
}
|
|
} catch (VCIError e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
}
|
|
/**
|
* 设置用户关系面板数据
|
* @param users
|
*/
|
public void setSelectedUserLine(List<String> users) {
|
userLineListModel.removeAllElements();
|
userLineObjs.clear();
|
String[] elements = users.get(0).split(",");
|
if (elements != null && elements.length > 0) {
|
for (int i = 0 ; i < elements.length; i++) {
|
String ele = elements[i];
|
if (ele.indexOf("expression:") == 0) {
|
String expression = ele.substring(ele.indexOf(":") + 1);
|
if ("all".equals(expression)) {
|
userLineListModel.addElement("所有人");
|
userLineObjs.add("all");
|
} else if ("creator".equals(expression)) {
|
userLineListModel.addElement("拟稿人");
|
userLineObjs.add("creator");
|
} else if ("creator.dept".equals(expression)) {
|
userLineListModel.addElement("拟稿人所在部门");
|
userLineObjs.add("creator.dept");
|
} else if ("owner.dept".equals(expression)) {
|
userLineListModel.addElement("当前处理人所在部门");
|
userLineObjs.add("owner.dept");
|
} else if ("allleader".equals(expression)) {
|
userLineListModel.addElement("所有领导");
|
userLineObjs.add("allleader");
|
} else if ("allsecretary".equals(expression)) {
|
userLineListModel.addElement("所有秘书");
|
userLineObjs.add("allsecretary");
|
} else if ("creator.dept.leader".equals(expression)) {
|
userLineListModel.addElement("拟稿人所在部门领导");
|
userLineObjs.add("creator.dept.leader");
|
} else if ("owner.dept.leader".equals(expression)) {
|
userLineListModel.addElement("当前处理人所在部门领导");
|
userLineObjs.add("owner.dept.leader");
|
} else if ("owner".equals(expression)) {
|
userLineListModel.addElement("当前节点处理人");
|
userLineObjs.add("owner");
|
|
} else if ("onenode.alluser".equals(expression)) {
|
userLineListModel.addElement("某一级别的所有人");
|
userLineObjs.add("onenode.alluser");
|
} else if ("onenode.manager".equals(expression)) {
|
userLineListModel.addElement("某一节点处理人");
|
userLineObjs.add("onenode.manager");
|
} else if ("chooseByForm".equals(expression)) {
|
userLineListModel.addElement("从业务表单中选择");
|
userLineObjs.add("chooseByForm");
|
|
} else if ("owner.childdept".equals(expression)) {
|
userLineListModel.addElement("当前处理人的一级部门");
|
userLineObjs.add("owner.childdept");
|
} else if ("owner.customorg".equals(expression)) {//暂不处理
|
userLineListModel.addElement("当前人的自定义组");
|
userLineObjs.add("owner.customorg");
|
}
|
} else if (ele.indexOf("custom:") == 0) {
|
userLineListModel.addElement("反射类名");
|
userLineObjs.add(ele);
|
}
|
}
|
}
|
|
}
|
|
/**
|
* 设置部门用户关系面板数据
|
* 格式--------dept1:部门id:岗位id:Y:N
|
* @param users
|
*/
|
public void setSelectedDeptAndUser(List<String> users) {
|
deptAndUserListModel.removeAllElements();
|
deptAndUserObjs.clear();
|
try {
|
String[] elements = users.get(0).split(",");
|
if (elements != null && elements.length > 0) {
|
for (int i = 0 ; i < elements.length; i++) {
|
String ele = elements[i];
|
String[] ids = ele.split(":");
|
String deptId = ids[1];
|
String postId = ids[2];
|
String showSubDept = ids[3];
|
String showDeptPerson = ids[4];
|
ClientBusinessObjectOperation cboo = new ClientBusinessObjectOperation();
|
ClientBusinessObject cboDept = cboo.readBusinessObjectById(deptId, "department");
|
ClientBusinessObject cboPost = cboo.readBusinessObjectById(postId, "post");
|
String deptName = cboDept.getName();
|
String postName = cboPost.getName();
|
deptAndUserListModel.addElement(deptName + ":" + postName + ":" + showSubDept + ":" + showDeptPerson);
|
String [] str = new String[]{ids[1], ids[2], ids[3], ids[4]};
|
deptAndUserObjs.add(str);
|
}
|
}
|
|
} catch (VCIError e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
}
|
|
public void setSelectedUsers(List<String> users) {
|
userDepartmentListModel.removeAllElements();
|
userDepartmentObjs.clear();
|
try {
|
String[] userNames = users.get(0).split(",");
|
for (int k =0;k<userNames.length;k++) {
|
String userDialogControl = CommonProperties.getStringProperty("workflow.UserDialog");
|
if(userDialogControl!=null&&!"".equals(userDialogControl)){
|
if(userNames[k].contains(":")){//需不需要对所有的userName判断后再分情况
|
userNameList.add(userNames[k]);
|
userDepartmentListModel.addElement(userNames[k].split(":")[0]);
|
}else{
|
userDepartmentListModel.addElement(userNames[k]);
|
}
|
}else{
|
if("".equals(userNames[k].trim())) {
|
continue;
|
}
|
UserObject userObj = rmgrDel.fetchUserInfoByName(userNames[k]);
|
userDepartmentListModel.addElement(userObj);
|
userDepartmentObjs.add(userObj);
|
}
|
|
}
|
|
} catch (VCIException e) {
|
e.printStackTrace();
|
return;
|
}
|
}
|
public void setSelectedRoles(List<String> roles) {
|
userRoleListModel.removeAllElements();
|
userRoleObjs.clear();
|
try {
|
String[] roleNames = roles.get(0).split(",");
|
for (int k=0;k<roleNames.length;k++) {
|
if("".equals(roleNames[k])) {
|
continue;
|
}
|
RoleObject roleObj = rmgrDel.fetchRoleInfoById(roleNames[k]);
|
userRoleListModel.addElement(roleObj);
|
userRoleObjs.add(roleObj);
|
}
|
} catch (VCIException e) {
|
VCIOptionPane.showError(LogonApplication.frame,"RMIPFramework", e);
|
return;
|
}
|
}
|
public void setSelectedDepts(List<String> depts) {
|
userDeptListModel.removeAllElements();
|
userDeptObjs.clear();
|
try {
|
String[] deptNames = depts.get(0).split(",");
|
for (int k=0;k<deptNames.length;k++) {
|
if("".equals(deptNames[k])) {
|
continue;
|
}
|
DeptObject deptObj = rmgrDel.fetchDepartmentInfoById(deptNames[k]);
|
userDeptListModel.addElement(deptObj);
|
userDeptObjs.add(deptObj);
|
}
|
} catch (VCIException e) {
|
e.printStackTrace();
|
}
|
}
|
|
public String getSelectedCust() {
|
return custText.getText().trim();
|
}
|
|
public void setSelectedCust(String cust) {
|
custText.setText(cust);
|
}
|
|
public List<String> getSelectedUsers() {
|
// TODO Auto-generated method stub
|
return null;
|
}
|
|
public List<String> getSelectedRoles() {
|
// TODO Auto-generated method stub
|
return null;
|
}
|
|
public List<String> getSelectedDepts() {
|
// TODO Auto-generated method stub
|
return null;
|
}
|
|
}
|