package com.vci.client.workflow.editor;
|
|
import java.awt.Color;
|
import java.awt.FlowLayout;
|
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionListener;
|
import java.awt.image.BufferedImage;
|
import java.io.BufferedReader;
|
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayOutputStream;
|
import java.io.File;
|
import java.io.InputStream;
|
import java.io.InputStreamReader;
|
import java.util.ArrayList;
|
import java.util.Arrays;
|
import java.util.HashMap;
|
import java.util.Iterator;
|
import java.util.List;
|
import java.util.Map;
|
|
import javax.imageio.ImageIO;
|
import javax.swing.JButton;
|
import javax.swing.JComponent;
|
import javax.swing.JOptionPane;
|
import javax.swing.JPanel;
|
import javax.xml.parsers.DocumentBuilder;
|
import javax.xml.parsers.DocumentBuilderFactory;
|
|
import org.apache.commons.lang3.StringUtils;
|
import org.dom4j.Attribute;
|
import org.dom4j.Document;
|
import org.dom4j.Element;
|
import org.dom4j.io.SAXReader;
|
import org.w3c.dom.Node;
|
|
import com.mxgraph.io.mxCodec;
|
import com.mxgraph.model.mxCell;
|
import com.mxgraph.model.mxICell;
|
import com.mxgraph.model.mxIGraphModel;
|
import com.mxgraph.swing.mxGraphComponent;
|
import com.mxgraph.util.mxUtils;
|
import com.mxgraph.view.mxGraph;
|
import com.vci.client.LogonApplication;
|
import com.vci.client.ui.locale.LocaleDisplay;
|
import com.vci.client.workflow.delegate.EventConfClientDelegate;
|
import com.vci.client.workflow.delegate.ProcessCustomClientDelegate;
|
import com.vci.client.workflow.editor.ui.DecisionPanel;
|
import com.vci.client.workflow.editor.ui.FlowInfoPanel;
|
import com.vci.client.workflow.editor.ui.IProcessProperty;
|
import com.vci.client.workflow.editor.ui.MailPanel;
|
import com.vci.client.workflow.editor.ui.PropertyObject;
|
import com.vci.client.workflow.editor.ui.StartEndPanel;
|
import com.vci.client.workflow.editor.ui.SubProcesslPanel;
|
import com.vci.client.workflow.editor.ui.TaskNewPanel;
|
import com.vci.client.workflow.editor.ui.TransitionPanel;
|
import com.vci.client.workflow.template.object.ProcessCategoryObject;
|
import com.vci.client.workflow.template.object.ProcessDefinitionObject;
|
import com.vci.common.resource.CommonProperties;
|
import com.vci.corba.common.VCIError;
|
import com.vci.corba.workflow.data.CustomInfo;
|
import com.vci.corba.workflow.data.ProcessTaskInfo;
|
import com.vci.corba.workflow.data.PropertyInfo;
|
import com.vci.corba.workflow.data.SubprocessTemInfo;
|
import com.vci.corba.workflow.data.TaskRevokeInfo;
|
|
public class FlowDeployNewPanel extends JPanel {
|
|
private static final long serialVersionUID = -2304467530018557819L;
|
|
private BasicGraphEditor designer;
|
|
private ProcessCategoryObject flowCategory;
|
private ProcessDefinitionObject processDefinition;
|
|
//导入时任务对应的对象
|
private ProcessTaskInfo importProcessTaskInfo;
|
private TaskDescCObject[] importTaskDescCObjects;
|
private Document importObjectXmlDoc;
|
|
private String fileSeparator = System.getProperty("file.separator");
|
|
//记录路由XML信息
|
private List<Element> trainsitionXmllist = null;
|
// private PhaseObject[] phaseObjects;
|
private String jbpmDeploymentId;
|
private boolean flag = false;
|
public FlowDeployNewPanel(final BasicGraphEditor designer) {
|
setLayout(new FlowLayout(FlowLayout.LEFT, 2, 2));
|
this.designer = designer;
|
JButton deployBtn = new JButton("部署");
|
deployBtn.addActionListener(new ActionListener() {
|
public void actionPerformed(ActionEvent e) {
|
deployFlow();
|
}
|
});
|
|
add(deployBtn);
|
checkDeployDir();
|
}
|
|
public boolean isEdit(boolean flag){
|
this.flag = flag;
|
return flag;
|
}
|
private void deployFlow() {
|
if(processNameIsEmpty()){
|
JOptionPane.showMessageDialog(this, "流程名不能为空,请确认");
|
return;
|
}
|
|
// if(keyIsEmpty()){
|
// JOptionPane.showMessageDialog(this, "key名称不能为空,请确认");
|
// return;
|
// }
|
if(!isEdit(flag)){
|
if(checkKey()){
|
JOptionPane.showMessageDialog(this, "流程名或key名称已存在,请确认");
|
return;
|
}
|
}
|
|
if(!checkTask()){
|
JOptionPane.showMessageDialog(this, "流程任务不能重名,请确认");
|
return;
|
}
|
if(!checkJoin()){
|
JOptionPane.showMessageDialog(this, "合并节点不能重名,请确认");
|
return;
|
}
|
if(!checkFork()){
|
JOptionPane.showMessageDialog(this, "分支节点不能重名,请确认");
|
return;
|
}
|
if(!checkDecision()){
|
JOptionPane.showMessageDialog(this, "判断节点不能重名,请确认");
|
return;
|
}
|
if(!checkEdge()){
|
JOptionPane.showMessageDialog(this, "路由名称和节点名称重名,请确认");
|
return;
|
}
|
// if(!isNullEdge()){
|
// JOptionPane.showMessageDialog(this, "路由名称不能为空,请确认");
|
// return;
|
// }
|
EditorCreateXmlToJbpm getXml = new EditorCreateXmlToJbpm(designer);
|
String jbpmXml = getXml.getsXml();
|
|
mxCodec codec = new mxCodec();
|
mxIGraphModel model = designer.getGraphComponent().getGraph().getModel();
|
Node encode = codec.encode(model);
|
String graphXml = mxUtils.getXml(encode);
|
|
mxGraphComponent graphComponent = designer.getGraphComponent();
|
try {
|
mxGraph graph = designer.getGraphComponent().getGraph();
|
BufferedImage image = FlowCellRenderer.createBufferedImage(graph, null, 1, Color.decode("#FFFBFF"), graphComponent.isAntiAlias(), graphComponent.getCanvas());
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ImageIO.write(image, "png", baos);
|
byte[] jbpmImage = baos.toByteArray();
|
|
ProcessTaskInfo[] processTaskInfos = getTaskPropertyByGraph();
|
boolean result = new ProcessCustomClientDelegate(LogonApplication.getUserEntityObject()).deployProcess(jbpmImage, jbpmXml, graphXml, flowCategory.getId(), processTaskInfos);
|
SubprocessTemInfo[] subprocessTemInfos = getSubprocessTemInfoByGraph();
|
if(subprocessTemInfos!=null&&subprocessTemInfos.length>0){
|
new ProcessCustomClientDelegate().saveSubProcess(subprocessTemInfos);
|
}
|
if(result) {
|
JOptionPane.showMessageDialog(this, "流程部署成功");
|
//探出的对话框消失
|
this.designer.getParent().getParent().getParent().setVisible(false);
|
}else{
|
JOptionPane.showMessageDialog(this, "流程部署失败");
|
}
|
} catch (Exception e) {
|
e.printStackTrace();
|
JOptionPane.showMessageDialog(this, "流程部署失败");
|
}
|
}
|
|
/**
|
* 判断key是否重复
|
*/
|
private boolean checkKey() {
|
mxGraph graph = designer.getGraphComponent().getGraph();
|
mxCell rootCell = (mxCell)graph.getModel().getRoot();
|
String nameAndkey = rootCell.getValue().toString().trim();
|
String[] splieKey = nameAndkey.split(",");
|
String keyValue = "";
|
String name = "";
|
if(splieKey.length==2){
|
name = splieKey[0];
|
keyValue = splieKey[1];
|
try {
|
return new ProcessCustomClientDelegate().checkKey(name, keyValue);
|
} catch (VCIError e) {
|
e.printStackTrace();
|
}
|
}
|
return false;
|
}
|
private boolean processNameIsEmpty() {
|
mxGraph graph = designer.getGraphComponent().getGraph();
|
mxCell rootCell = (mxCell)graph.getModel().getRoot();
|
String nameAndkey = rootCell.getValue().toString().trim();
|
String[] splieKey = nameAndkey.split(",");
|
if(splieKey.length==0){
|
return true;
|
}else{
|
if(splieKey[0] == null||"".equals(splieKey[0] )) {
|
return true;
|
}
|
}
|
return false;
|
}
|
|
private boolean checkTask() {
|
mxGraph graph = designer.getGraphComponent().getGraph();
|
Object parent = graph.getDefaultParent();
|
Object[] ocjectCells = graph.getChildCells(parent);
|
List<String> taskNames = new ArrayList<String>();
|
for (Object objectCell : ocjectCells) {
|
if (objectCell instanceof mxCell) {
|
mxCell cell = (mxCell) objectCell;
|
if (!cell.isEdge() && cell.getStyle().equals(FlowConstants.XMLTASK)) {
|
String taskName = cell.getValue().toString();
|
if (taskNames.contains(taskName)) {
|
return false;
|
}else{
|
taskNames.add(taskName);
|
}
|
}
|
}
|
}
|
return true;
|
}
|
|
private boolean checkJoin() {
|
mxGraph graph = designer.getGraphComponent().getGraph();
|
Object parent = graph.getDefaultParent();
|
Object[] ocjectCells = graph.getChildCells(parent);
|
List<String> joins = new ArrayList<String>();
|
for (Object objectCell : ocjectCells) {
|
if (objectCell instanceof mxCell) {
|
mxCell cell = (mxCell) objectCell;
|
if (!cell.isEdge() && cell.getStyle().equals(FlowConstants.XMLJOIN)) {
|
String joinName = cell.getValue().toString();
|
if (joins.contains(joinName)) {
|
return false;
|
}else{
|
joins.add(joinName);
|
}
|
}
|
}
|
}
|
return true;
|
}
|
private boolean checkFork() {
|
mxGraph graph = designer.getGraphComponent().getGraph();
|
Object parent = graph.getDefaultParent();
|
Object[] ocjectCells = graph.getChildCells(parent);
|
List<String> forks = new ArrayList<String>();
|
for (Object objectCell : ocjectCells) {
|
if (objectCell instanceof mxCell) {
|
mxCell cell = (mxCell) objectCell;
|
if (!cell.isEdge() && cell.getStyle().equals(FlowConstants.XMLFORK)) {
|
String forkName = cell.getValue().toString();
|
if (forks.contains(forkName)) {
|
return false;
|
}else{
|
forks.add(forkName);
|
}
|
}
|
}
|
}
|
return true;
|
}
|
private boolean checkDecision() {
|
mxGraph graph = designer.getGraphComponent().getGraph();
|
Object parent = graph.getDefaultParent();
|
Object[] ocjectCells = graph.getChildCells(parent);
|
List<String> forks = new ArrayList<String>();
|
for (Object objectCell : ocjectCells) {
|
if (objectCell instanceof mxCell) {
|
mxCell cell = (mxCell) objectCell;
|
if (!cell.isEdge() && cell.getStyle().equals(FlowConstants.DECISION)) {
|
String forkName = cell.getValue().toString();
|
if (forks.contains(forkName)) {
|
return false;
|
}else{
|
forks.add(forkName);
|
}
|
}
|
}
|
}
|
return true;
|
}
|
|
private boolean isNullEdge() {
|
mxGraph graph = designer.getGraphComponent().getGraph();
|
Object parent = graph.getDefaultParent();
|
Object[] ocjectCells = graph.getChildCells(parent);
|
for (Object objectCell : ocjectCells) {
|
if (objectCell instanceof mxCell) {
|
mxCell cell = (mxCell) objectCell;
|
if (cell.isEdge()) {
|
String edgeName = cell.getValue().toString();
|
if ("".equals(edgeName)) {
|
return false;
|
}
|
}
|
}
|
}
|
return true;
|
}
|
|
private boolean checkEdge() {
|
mxGraph graph = designer.getGraphComponent().getGraph();
|
Object parent = graph.getDefaultParent();
|
Object[] ocjectCells = graph.getChildCells(parent);
|
List<String> nodes = new ArrayList<String>();
|
List<String> edges = new ArrayList<String>();
|
for (Object objectCell : ocjectCells) {
|
if (objectCell instanceof mxCell) {
|
mxCell cell = (mxCell) objectCell;
|
String eleValues = cell.getValue().toString();
|
if (!cell.isEdge()) {
|
nodes.add(eleValues);
|
}else{
|
edges.add(eleValues);
|
}
|
}
|
}
|
for(String node : nodes){
|
for(String edge : edges){
|
if(node.equals(edge)){
|
return false;
|
}
|
}
|
}
|
return true;
|
}
|
|
private ProcessTaskInfo[] getTaskPropertyByGraph() {
|
mxGraph graph = designer.getGraphComponent().getGraph();
|
Object parent = graph.getDefaultParent();
|
Object[] ocjectCells = graph.getChildCells(parent);
|
List<ProcessTaskInfo> list = new ArrayList<ProcessTaskInfo>();
|
for (Object objectCell : ocjectCells) {
|
if (objectCell instanceof mxCell) {
|
mxCell cell = (mxCell) objectCell;
|
if (cell.getValue() instanceof IProcessProperty && !cell.isEdge()) {
|
IProcessProperty object = (IProcessProperty) cell.getValue();
|
String nodeType = object.getNodeType();
|
if (nodeType.equals(FlowConstants.XMLTASK)) {
|
TaskNewPanel task = (TaskNewPanel) object;
|
list.add(task.getProcessTaskInfo());
|
}
|
}
|
}
|
}
|
return list.toArray(new ProcessTaskInfo[0]);
|
}
|
|
private SubprocessTemInfo[] getSubprocessTemInfoByGraph() {
|
mxGraph graph = designer.getGraphComponent().getGraph();
|
Object parent = graph.getDefaultParent();
|
Object[] ocjectCells = graph.getChildCells(parent);
|
List<SubprocessTemInfo> list = new ArrayList<SubprocessTemInfo>();
|
for (Object objectCell : ocjectCells) {
|
if (objectCell instanceof mxCell) {
|
mxCell cell = (mxCell) objectCell;
|
if (cell.getValue() instanceof IProcessProperty && !cell.isEdge()) {
|
IProcessProperty object = (IProcessProperty) cell.getValue();
|
String nodeType = object.getNodeType();
|
if (nodeType.equals(FlowConstants.SUBPROCESS)) {
|
SubProcesslPanel spp = (SubProcesslPanel) object;
|
mxCell rootCell = (mxCell)graph.getModel().getRoot();
|
String nameAndkey = rootCell.getValue().toString().trim();
|
String[] splieKey = nameAndkey.split(",");
|
spp.getSubprocessTemInfo().parentTemName=splieKey[0];
|
list.add(spp.getSubprocessTemInfo());
|
}
|
}
|
}
|
}
|
return list.toArray(new SubprocessTemInfo[0]);
|
}
|
private void checkDeployDir() {
|
String path = System.getProperty("user.home") + fileSeparator + ".flow";
|
File deployDir = new File(path);
|
if (!deployDir.exists()) {
|
deployDir.mkdir();
|
}
|
}
|
|
public void setFlowCategory(ProcessCategoryObject flowCategory) {
|
this.flowCategory = flowCategory;
|
}
|
|
public void setProcessDefinition(ProcessDefinitionObject pd) throws Exception {
|
try {
|
processDefinition = pd;
|
jbpmDeploymentId = pd.getJbpmDeploymentId();
|
byte[] graphXml = new ProcessCustomClientDelegate().getProcessGraphXml(jbpmDeploymentId);
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
DocumentBuilder docBuilder = factory.newDocumentBuilder();
|
InputStream gin = new ByteArrayInputStream(graphXml);
|
|
org.w3c.dom.Document document = docBuilder.parse(gin);
|
mxCodec codec = new mxCodec(document);
|
codec.decode(document.getDocumentElement(), designer
|
.getGraphComponent().getGraph().getModel());
|
|
byte[] processXml = new ProcessCustomClientDelegate().getProcessXml(jbpmDeploymentId);
|
InputStream in = new ByteArrayInputStream(processXml);
|
BufferedReader reader = new BufferedReader(new InputStreamReader(in, "utf-8"));
|
|
SAXReader saxr = new SAXReader();
|
Document doc = saxr.read(reader);
|
updateGraph(doc);
|
|
resetDesigner(designer);
|
// mxGraph graph = designer.getGraphComponent().getGraph();
|
// graph.refresh();
|
} catch (Exception e) {
|
e.printStackTrace();
|
throw e;
|
}
|
}
|
|
public void setProcessDefinition(byte[] graphXml, byte[] processXml,ProcessDefinitionObject pd,byte[] objectXml ) throws Exception {
|
try {
|
processDefinition = pd;
|
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
|
DocumentBuilder docBuilder = factory.newDocumentBuilder();
|
InputStream gin = new ByteArrayInputStream(graphXml);
|
|
org.w3c.dom.Document document = docBuilder.parse(gin);
|
mxCodec codec = new mxCodec(document);
|
codec.decode(document.getDocumentElement(), designer
|
.getGraphComponent().getGraph().getModel());
|
|
InputStream in = new ByteArrayInputStream(processXml);
|
BufferedReader reader = new BufferedReader(new InputStreamReader(in, "utf-8"));
|
|
SAXReader saxr = new SAXReader();
|
Document doc = saxr.read(reader);
|
|
//对象xml解析
|
InputStream objectXmlIn = new ByteArrayInputStream(objectXml);
|
BufferedReader objectXmlReader = new BufferedReader(new InputStreamReader(objectXmlIn, "utf-8"));
|
SAXReader objectXmlSaxr = new SAXReader();
|
Document objectXmlDoc = objectXmlSaxr.read(objectXmlReader);
|
importObjectXmlDoc = objectXmlDoc;
|
|
updateGraph(doc);
|
|
resetDesigner(designer);
|
// mxGraph graph = designer.getGraphComponent().getGraph();
|
// graph.refresh();
|
} catch (Exception e) {
|
e.printStackTrace();
|
throw e;
|
}
|
}
|
|
|
private void resetDesigner(BasicGraphEditor editor) {
|
editor.setModified(false);
|
editor.getUndoManager().clear();
|
}
|
|
private void updateGraph(Document doc) throws Exception{
|
mxGraph graph = designer.getGraphComponent().getGraph();
|
Object parent = graph.getDefaultParent();
|
graph.getModel().beginUpdate();
|
|
try {
|
Element root = doc.getRootElement();
|
mxCell rootCell = (mxCell)graph.getModel().getRoot();
|
|
//遍历根process节点的属性
|
FlowInfoPanel flowInfo = new FlowInfoPanel(graph);
|
flowInfo.setValue(processDefinition.getName());
|
flowInfo.setKey(processDefinition.getKey());
|
rootCell.setValue(flowInfo);
|
|
|
//XML元素的遍历
|
for (Iterator<?> a = root.elementIterator(); a.hasNext();) {
|
Element next = (Element) a.next();
|
String cellType = next.getName();
|
if(cellType.equals(FlowConstants.GLOBAL)){
|
ProcessTaskInfo processTaskInfo = new ProcessTaskInfo();
|
List<PropertyInfo> processTypeProperties = new ArrayList<PropertyInfo>();
|
// Element globalElement = next.element(FlowConstants.GLOBAL);
|
for (Iterator<?> b = next.elementIterator(); b.hasNext();) {
|
Element fieldElement = (Element)b.next();//多个field element
|
if(fieldElement.getName().equals(FlowConstants.EVENT_FIELD)){
|
PropertyInfo propertyInfo = new PropertyInfo();
|
propertyInfo.property = fieldElement.attributeValue(FlowConstants.XMLNAME);
|
for (Iterator<?> c = fieldElement.elementIterator(); c.hasNext();) {
|
Element stringElement = (Element)c.next();
|
if(stringElement.getName().equals(FlowConstants.EVENT_STRING)){
|
propertyInfo.value = stringElement.attributeValue(FlowConstants.EVENT_VALUE);
|
}
|
}
|
processTypeProperties.add(propertyInfo);
|
}
|
}
|
processTaskInfo.taskTypeProperties = processTypeProperties.toArray(new PropertyInfo[0]);
|
flowInfo.setPropertyInfo(processTaskInfo.taskTypeProperties);
|
}else{
|
if(cellType.equalsIgnoreCase(FlowConstants.EVENT_ON)){
|
if(next.getName().equalsIgnoreCase(FlowConstants.EVENT_ON)) {
|
setProcessEvent(flowInfo, next);
|
}
|
}else{
|
parseJpdl(next, graph, parent);
|
}
|
}
|
}
|
|
//记录路由XML信息
|
trainsitionElInfo(root);
|
|
//处理transition
|
updateEdge(graph);
|
} catch (Exception e) {
|
e.printStackTrace();
|
throw e;
|
} finally {
|
graph.getModel().endUpdate();
|
}
|
}
|
|
private void updateEdge(mxGraph graph) throws VCIError {
|
Object parent = graph.getDefaultParent();
|
Object[] cells = graph.getChildCells(parent);
|
int trainsitionXmlInfoIndex = 0;
|
for (int i = 0; i < cells.length; i++) {
|
if (cells[i] instanceof mxCell) {
|
mxCell cell = (mxCell) cells[i];
|
if(cell.isEdge() && cell.getValue() instanceof String) {
|
String style = (cell.getStyle()==null?"":cell.getStyle()).trim();
|
if(style.length() == 0) {
|
style = "transition_horizontal";
|
}
|
FlowNode flowNode = new FlowNode(style, (String)cell.getValue());
|
cell.setValue(flowNode);
|
JComponent component = ProcessComponentFactory.getComponent(graph, cell);
|
cell.setValue(component);
|
mxICell source = cell.getSource();
|
mxICell target = cell.getTarget();
|
Object value = source.getValue();
|
Object value2 = target.getValue();
|
String sourceName = "";
|
String targetName ="";
|
if(value instanceof StartEndPanel){
|
sourceName = ((StartEndPanel) value).toString();
|
}
|
if(value2 instanceof StartEndPanel){
|
targetName = ((StartEndPanel) value2).toString();
|
}
|
if(value instanceof TaskNewPanel){
|
sourceName = ((TaskNewPanel) value).toString();
|
|
}
|
if(value2 instanceof TaskNewPanel){
|
targetName = ((TaskNewPanel) value2).toString();
|
}
|
String fromto = sourceName+"->"+flowNode.getName()+"->"+targetName;
|
System.out.println("setTrainstion==" + fromto);
|
List<Element> elements = trainsitonMap.get(fromto);
|
TransitionPanel transitionPanel = (TransitionPanel)component;
|
if(elements!=null){
|
if(elements!=null){
|
setTransitionEvent(transitionPanel, elements);
|
}
|
}
|
transitionPanel.setTrainsitionDescPanel(trainsitionUrlMap.get(fromto));
|
|
}
|
}
|
}
|
}
|
|
/**
|
* 记录路由XML信息
|
* @param root
|
* @return
|
*/
|
private Map<String,List<Element>> trainsitonMap = new HashMap<String,List<Element>>();
|
private Map<String,String> trainsitionUrlMap = new HashMap<String, String>();
|
private List<Element> trainsitionElInfo(Element root) {
|
String name = "";
|
for (Iterator<?> a = root.elementIterator(); a.hasNext();) {
|
String fromTo = "";
|
//存储路由事件信息
|
trainsitionXmllist = new ArrayList<Element>();
|
Element next = (Element)a.next();
|
System.out.println("next.getName()="+next.getName());
|
if(next.getName().equalsIgnoreCase(FlowConstants.XMLSTART)){
|
name = next.attribute(FlowConstants.XMLNAME)==null?"":next.attribute(FlowConstants.XMLNAME).getValue();
|
}
|
else if(next.getName().equalsIgnoreCase(FlowConstants.XMLTASK)){
|
name = next.attribute(FlowConstants.XMLNAME)==null?"":next.attribute(FlowConstants.XMLNAME).getValue();
|
}
|
else if(next.getName().equalsIgnoreCase(FlowConstants.XMLEND)){
|
name = next.attribute(FlowConstants.XMLNAME)==null?"":next.attribute(FlowConstants.XMLNAME).getValue();
|
}
|
else if(next.getName().equalsIgnoreCase(FlowConstants.XMLFORK)){
|
name = next.attribute(FlowConstants.XMLNAME)==null?"":next.attribute(FlowConstants.XMLNAME).getValue();
|
}
|
else if(next.getName().equalsIgnoreCase(FlowConstants.XMLJOIN)){
|
name = next.attribute(FlowConstants.XMLNAME)==null?"":next.attribute(FlowConstants.XMLNAME).getValue();
|
}
|
else if(next.getName().equalsIgnoreCase(FlowConstants.DECISION)){
|
name = next.attribute(FlowConstants.XMLNAME)==null?"":next.attribute(FlowConstants.XMLNAME).getValue();
|
}
|
for (Iterator<?> trainsitionIt = next.elementIterator(); trainsitionIt.hasNext();) {
|
trainsitionXmllist = new ArrayList<Element>();
|
Element trainsitionNext = (Element) trainsitionIt.next();
|
if(trainsitionNext.getName().equalsIgnoreCase(FlowConstants.TRANSITION)) {
|
// Element trainsitonEl = trainsitionNext.element(FlowConstants.TRANSITION);
|
Attribute attribute = trainsitionNext.attribute(FlowConstants.URL_PATH);
|
if(attribute!= null){
|
String transitionName = trainsitionNext.attribute(FlowConstants.XMLNAME)==null?"":trainsitionNext.attribute(FlowConstants.XMLNAME).getValue();
|
String to = trainsitionNext.attribute(FlowConstants.XMLTARGET)==null?"":trainsitionNext.attribute(FlowConstants.XMLTARGET).getValue();
|
String trainsitionUrlfromTo = name + "->" + transitionName + "->" + to;
|
trainsitionUrlMap.put(trainsitionUrlfromTo, attribute.getText());
|
}
|
for(Iterator<?> trainsitonElIt = trainsitionNext.elementIterator(); trainsitonElIt.hasNext();){
|
Element trainsitioListener = (Element) trainsitonElIt.next();
|
String transitionName = trainsitionNext.attribute(FlowConstants.XMLNAME)==null?"":trainsitionNext.attribute(FlowConstants.XMLNAME).getValue();
|
String to = trainsitionNext.attribute(FlowConstants.XMLTARGET)==null?"":trainsitionNext.attribute(FlowConstants.XMLTARGET).getValue();
|
fromTo = name + "->" + transitionName + "->" + to;
|
System.out.println("getTrainstion=="+fromTo+"/////Listener=="+trainsitioListener);
|
trainsitionXmllist.add(trainsitioListener);
|
trainsitonMap.put(fromTo, trainsitionXmllist);
|
}
|
}
|
}
|
}
|
return trainsitionXmllist;
|
}
|
|
|
private mxCell getCell(mxGraph graph, String name){
|
if(name != null) {
|
Object parent = graph.getDefaultParent();
|
Object[] cells = graph.getChildCells(parent);
|
for (int i = 0; i < cells.length; i++) {
|
if (cells[i] instanceof mxCell) {
|
mxCell cell = (mxCell) cells[i];
|
if(!cell.isEdge() && name.equals(cell.getValue().toString())) {
|
return cell;
|
}
|
}
|
}
|
}
|
return null;
|
}
|
|
private void parseJpdl(Element element, mxGraph graph, Object parent) throws VCIError {
|
String cellType = element.getName();
|
FlowNode flowNode = new FlowNode(cellType);
|
String cellName = element.attributeValue(FlowConstants.XMLNAME);
|
mxCell cell = getCell(graph, cellName);
|
Object value = cell.getValue();
|
if(value != null) {
|
flowNode.setName(value.toString());
|
}
|
cell.setValue(flowNode);
|
|
if(cellType.equalsIgnoreCase(FlowConstants.XMLSTART)
|
|| cellType.equalsIgnoreCase(FlowConstants.XMLEND)
|
|| cellType.equalsIgnoreCase(FlowConstants.XMLFORK)
|
|| cellType.equalsIgnoreCase(FlowConstants.XMLJOIN)){
|
JComponent component = ProcessComponentFactory.getComponent(graph, cell);
|
cell.setValue(component);
|
}
|
else if(cellType.equalsIgnoreCase(FlowConstants.XMLTASK)) {
|
JComponent component = ProcessComponentFactory.getComponent(graph, cell);
|
cell.setValue(component);
|
// TaskPanel taskPanel = (TaskPanel)component;
|
TaskNewPanel taskPanel = (TaskNewPanel)component;
|
try {
|
if(jbpmDeploymentId!=null&&!"".equals(jbpmDeploymentId)){
|
ProcessTaskInfo processTaskInfo = new ProcessCustomClientDelegate().findById(jbpmDeploymentId, taskPanel.toString());
|
taskPanel.setProcessTaskInfo(processTaskInfo);
|
}else{
|
if(importObjectXmlDoc!=null){
|
ProcessTaskInfo processTaskInfo = new ProcessTaskInfo();
|
Element root = importObjectXmlDoc.getRootElement();
|
//获取流程任务信息
|
Element processTaskInfoEle = root.element("ProcessTaskInfo");
|
if(processTaskInfoEle!=null){
|
processTaskInfo.id = processTaskInfoEle.attribute("id").getValue();
|
processTaskInfo.deploymentId = processTaskInfoEle.attribute("deploymentId").getValue();
|
processTaskInfo.taskName = processTaskInfoEle.attribute("taskName").getValue();
|
processTaskInfo.taskType = processTaskInfoEle.attribute("taskType").getValue();
|
processTaskInfo.taskDesc = processTaskInfoEle.attribute("taskDesc").getValue();
|
processTaskInfo.pltreatment = Integer.parseInt(processTaskInfoEle.attribute("pltreatment").getValue());
|
processTaskInfo.popUserDialog = processTaskInfoEle.attribute("popUserDialog").getValue();
|
}
|
//获取任务属性信息
|
List<Element> propertyInfoEle = importObjectXmlDoc.selectNodes("/root/ProcessTaskInfo/PropertyInfo" );
|
PropertyInfo[] taskTypeProperties = null ;
|
if(propertyInfoEle!=null){
|
taskTypeProperties = new PropertyInfo[propertyInfoEle.size()];
|
Iterator<Element> iter = propertyInfoEle.iterator();
|
int i=0;
|
if(iter.hasNext()){
|
PropertyInfo p = new PropertyInfo();
|
Element next = iter.next();
|
p.property = next.attribute("property").getValue() == null?"":next.attribute("property").getValue();
|
p.value = next.attribute("value").getValue() ==null?"":next.attribute("value").getValue();
|
taskTypeProperties[i] = p;
|
i++;
|
}
|
}
|
processTaskInfo.taskTypeProperties = taskTypeProperties==null?new PropertyInfo[0]:taskTypeProperties;
|
|
//获取任务属性信息
|
List<Element> customInfoEle = importObjectXmlDoc.selectNodes("/root/ProcessTaskInfo/CustomInfo" );
|
CustomInfo[] customUserInfos = null;
|
if(customInfoEle!=null){
|
customUserInfos = new CustomInfo[customInfoEle.size()];
|
Iterator<Element> iter = customInfoEle.iterator();
|
int i=0;
|
if(iter.hasNext()){
|
CustomInfo p = new CustomInfo();
|
Element next = iter.next();
|
p.className = next.attribute("className").getValue()==null?"":next.attribute("className").getValue();
|
p.value = next.attribute("value").getValue()==null?"":next.attribute("value").getValue();
|
customUserInfos[i] = p;
|
i++;
|
}
|
}
|
processTaskInfo.customUserInfos = customUserInfos==null?new CustomInfo[0]:customUserInfos;
|
taskPanel.setProcessTaskInfo(processTaskInfo);
|
}
|
}
|
} catch (VCIError e) {
|
e.printStackTrace();
|
}
|
|
//如果是自定义用户接口,则通过assignHandler的field获取用户字符串
|
String userDialogControl = CommonProperties.getStringProperty("workflow.UserDialog");
|
if(userDialogControl!=null&&!"".equals(userDialogControl)){
|
Element eventElement = element.element(FlowConstants.ASSIFNMENT_HANDLER);
|
if(eventElement!=null){
|
for (Iterator<?> b = eventElement.elementIterator(); b.hasNext();) {
|
Element fieldElement = (Element)b.next();//多个field element
|
if(fieldElement.getName().equals(FlowConstants.EVENT_FIELD)){
|
for (Iterator<?> c = fieldElement.elementIterator(); c.hasNext();) {
|
Element stringElement = (Element)c.next();
|
if(stringElement.getName().equals(FlowConstants.EVENT_STRING)){
|
List<String> users = new ArrayList<String>();
|
String userName = stringElement.attributeValue(FlowConstants.EVENT_VALUE);
|
users.add(userName);
|
// taskPanel.setTaskOwners(users);
|
}
|
}
|
}
|
}
|
}
|
}else{
|
Attribute attribute = element.attribute(FlowConstants.XMLUSER);
|
if(attribute != null) {
|
String userName = attribute.getValue();
|
if(!userName.equals(FlowConstants.PROCESS_APPLICANT)){
|
List<String> users = new ArrayList<String>();
|
users.add(userName);
|
// taskPanel.setTaskOwners(users);
|
}
|
}else{
|
Attribute usersAttribute = element.attribute(FlowConstants.XMLUSERS);
|
if(usersAttribute != null) {
|
String userName = usersAttribute.getValue();
|
String str = userName;
|
int count = 1;
|
while(str.indexOf(";") > -1) {
|
String ele = str.substring(0, str.indexOf(";"));
|
str = str.substring(str.indexOf(";") + 1);
|
if (count == 1 && !"".equals(ele)) {
|
taskPanel.setTaskUserDepartment(Arrays.asList(ele));
|
}
|
if (count == 2 && !"".equals(ele)) {
|
taskPanel.setTaskUserRole(Arrays.asList(ele));
|
}
|
if (count == 3 && !"".equals(ele)) {
|
taskPanel.setTaskUserDept(Arrays.asList(ele));
|
}
|
if (count == 4 && !"".equals(ele)) {
|
taskPanel.setTaskUserLine(Arrays.asList(ele));
|
}
|
if (count == 5 && !"".equals(ele)) {
|
taskPanel.setTaskDeptAndUser(Arrays.asList(ele));
|
}
|
count++;
|
}
|
}
|
}
|
}
|
|
Attribute constituentAttr = element.attribute(FlowConstants.XMLCONSTITUENT);
|
System.out.println("constituentAttr =="+constituentAttr);
|
if(constituentAttr != null) {
|
String userName = constituentAttr.getValue();
|
System.out.println("constituentAttr::userName=="+userName);
|
String[] splits = userName.split(",");
|
taskPanel.setconstituents(Arrays.asList(splits));
|
}
|
|
|
//获取自定义Url路径
|
Attribute urlPathattribute = element.attribute(FlowConstants.URL_PATH);
|
String urlText = "";
|
if(urlPathattribute!=null){
|
urlText = urlPathattribute.getValue();
|
}
|
|
if(jbpmDeploymentId!=null&&!"".equals(jbpmDeploymentId)){
|
|
//取得控制策略
|
TaskDescCObject[] taskDescCObject = new ProcessCustomClientDelegate(LogonApplication.getUserEntityObject()).getTaskDescList(jbpmDeploymentId, taskPanel.toString());
|
String desc = "";
|
long flag = 0;
|
String popuserdialogflag="";
|
CustomInfo[] custominfos = new CustomInfo[taskDescCObject.length];
|
for(int i=0;i<taskDescCObject.length;i++){
|
CustomInfo info = new CustomInfo();
|
flag = taskDescCObject[i].getPltreatment();
|
popuserdialogflag = taskDescCObject[i].getPopUserDialog();
|
desc = taskDescCObject[i].getPltaskdesc();
|
flag = taskDescCObject[i].getPltreatment();
|
info.className = taskDescCObject[i].getPlcustomclassname()==null?"":taskDescCObject[i].getPlcustomclassname();
|
info.value = taskDescCObject[i].getPlcustomparam()==null?"":taskDescCObject[i].getPlcustomparam();
|
custominfos[i] = info;
|
|
}
|
//设置自定义类的值
|
taskPanel.setCustomInfo(custominfos);
|
taskPanel.setTaskTreatmentPanel(flag);
|
//modify by weidy@2022-05-19
|
//因为增加了会签,所以需要对面板的显示做出来
|
Attribute votePercentAT = element.attribute(FlowConstants.SIGN_VOTE_PRCENT);
|
if(votePercentAT !=null){
|
String votePercent = votePercentAT.getValue();
|
if(StringUtils.isNotBlank(votePercent)){
|
taskPanel.setVotePercent(votePercent);
|
}
|
}
|
taskPanel.setPopUserDialog(popuserdialogflag);
|
taskPanel.setTaskDescPanel(desc,urlText);
|
}else if(importObjectXmlDoc!=null){
|
String desc = "";
|
int flag = 0;
|
String popuserdialogflag="";
|
Element root = importObjectXmlDoc.getRootElement();
|
//获取任务属性信息
|
List<Element> taskDescCObjectEle = importObjectXmlDoc.selectNodes("/root/ProcessTaskInfo/TaskDescCObject" );
|
if(taskDescCObjectEle!=null){
|
CustomInfo[] custominfos = new CustomInfo[taskDescCObjectEle.size()];
|
Iterator<Element> iter = taskDescCObjectEle.iterator();
|
int i=0;
|
if(iter.hasNext()){
|
CustomInfo info = new CustomInfo();
|
Element next = iter.next();
|
|
desc = next.attribute("pltaskdesc").getValue()==null?"":next.attribute("pltaskdesc").getValue();
|
flag = Integer.parseInt(next.attribute("pltreatment").getValue());
|
popuserdialogflag = next.attribute("popUserDialog").getValue()==null?"":next.attribute("popUserDialog").getValue();
|
info.className = next.attribute("plcustomclassname").getValue()==null?"":next.attribute("plcustomclassname").getValue();
|
info.value = next.attribute("plcustomparam").getValue()==null?"":next.attribute("plcustomparam").getValue();
|
custominfos[i] = info;
|
i++;
|
}
|
//设置自定义类的值
|
taskPanel.setCustomInfo(custominfos);
|
taskPanel.setTaskTreatmentPanel(flag);
|
taskPanel.setPopUserDialog(popuserdialogflag);
|
taskPanel.setTaskDescPanel(desc,urlText);
|
}
|
}
|
//获取撤销策略
|
if(jbpmDeploymentId!=null&&!"".equals(jbpmDeploymentId)){
|
TaskRevokeCObject[] taskRevokeCObject = new ProcessCustomClientDelegate(LogonApplication.getUserEntityObject()).getTaskRevokeList(jbpmDeploymentId, taskPanel.toString());
|
TaskRevokeInfo[] revokeInfos = new TaskRevokeInfo[taskRevokeCObject.length];
|
String revokeFlag = "";
|
PropertyInfo[] propertyInfos = new PropertyInfo[taskRevokeCObject.length];
|
for(int i=0;i<taskRevokeCObject.length;i++){
|
revokeFlag = taskRevokeCObject[i].getPlrevoke();
|
TaskRevokeInfo info = new TaskRevokeInfo();
|
PropertyInfo propertyInfo = new PropertyInfo();
|
info.className = taskRevokeCObject[i].getPlclassname();
|
info.deploymentId = taskRevokeCObject[i].getPljbpmdeploymentid();
|
info.taskName = taskRevokeCObject[i].getPltask();
|
info.id = taskRevokeCObject[i].getId();
|
PropertyObject[] eventTypes = taskPanel.getEventTypes("revoke");
|
for(int p =0;p<eventTypes.length;p++){
|
String className = taskRevokeCObject[i].getPlclassname();
|
String classValue = "";
|
String initEventClass = "";
|
classValue = eventTypes[p].getProperty();
|
/*initEventClass = EventProperties.getStringProperty("workflow.event.type." + classValue
|
+ ".class");*/
|
|
//add by caill start 2016.4.8 通过corba连接服务端
|
try {
|
initEventClass = new EventConfClientDelegate().getStringProperty("workflow.event.type." + classValue
|
+ ".class");
|
} catch (VCIError e) {
|
// TODO Auto-generated catch block
|
e.printStackTrace();
|
}
|
//add by caill end
|
if(initEventClass.equals(className)){
|
propertyInfo.property = eventTypes[p].getValue();
|
propertyInfo.value = initEventClass;
|
}
|
}
|
revokeInfos[i] = info;
|
propertyInfos[i] = propertyInfo;
|
}
|
taskPanel.setRevoke(revokeFlag);
|
taskPanel.setRevokeInfos("revoke", propertyInfos);
|
}
|
//解析任务的事件
|
for (Iterator<?> a = element.elementIterator(); a.hasNext();) {
|
Element next = (Element)a.next();
|
if(next.getName().equalsIgnoreCase(FlowConstants.EVENT_ON)) {
|
// //设置自定义候选人
|
setTaskEvent(taskPanel, next);
|
}
|
}
|
|
}else if(cellType.equalsIgnoreCase(FlowConstants.XMLDECISION)) {
|
JComponent component = ProcessComponentFactory.getComponent(graph, cell);
|
cell.setValue(component);
|
DecisionPanel decisionPanel = (DecisionPanel)component;
|
for (Iterator<?> a = element.elementIterator(); a.hasNext();) {
|
Element next = (Element)a.next();
|
if(next.getName().equalsIgnoreCase(FlowConstants.HANDLER)) {
|
String handlerClass = next.attributeValue(FlowConstants.EVENT_CLASS);
|
decisionPanel.setHandlerClass(handlerClass);
|
}
|
}
|
Attribute attribute = element.attribute(FlowConstants.EXPRESSION);
|
if(attribute!=null){
|
if(attribute.getValue()!=null&&!"".equals(attribute.getValue())){
|
decisionPanel.setValue(attribute.getValue());
|
}
|
}
|
}else if(cellType.equalsIgnoreCase(FlowConstants.MAIL)){
|
JComponent component = ProcessComponentFactory.getComponent(graph, cell);
|
cell.setValue(component);
|
MailPanel mailPanel = (MailPanel)component;
|
|
for (Iterator<?> a = element.elementIterator(); a.hasNext();) {
|
Element next = (Element)a.next();
|
if(next.getName().equalsIgnoreCase(FlowConstants.XMLTARGET)) {
|
String address = next.attributeValue(FlowConstants.MAIL_ADDRESSES);
|
mailPanel.getAccepterTextArea().setText(address);
|
}
|
else if(next.getName().equalsIgnoreCase(FlowConstants.MAIL_CC)){
|
String address = next.attributeValue(FlowConstants.MAIL_ADDRESSES);
|
mailPanel.getCcTextArea().setText(address);
|
}
|
else if(next.getName().equalsIgnoreCase(FlowConstants.MAIL_BCC)){
|
String address = next.attributeValue(FlowConstants.MAIL_ADDRESSES);
|
mailPanel.getBccTextArea().setText(address);
|
}
|
else if(next.getName().equalsIgnoreCase(FlowConstants.MAIL_SUBJECT)){
|
String subject = next.getTextTrim();
|
mailPanel.getSubjectTextField().setText(subject);
|
}
|
else if(next.getName().equalsIgnoreCase(FlowConstants.MAIL_TEXT)){
|
String content = next.getTextTrim();
|
mailPanel.getContentTextArea().setText(content);
|
}
|
}
|
}else if(cellType.equalsIgnoreCase(FlowConstants.SUBPROCESS)){
|
JComponent component = ProcessComponentFactory.getComponent(graph, cell);
|
cell.setValue(component);
|
SubProcesslPanel subProcesslPanel = (SubProcesslPanel)component;
|
Attribute attribute = element.attribute(FlowConstants.SUBPROCESSKEY);
|
subProcesslPanel.getSubProcessTextField().setText(attribute.getText().toString());
|
subProcesslPanel.getOutComeTextField().setText("#{result}");
|
}
|
}
|
|
private void setProcessEvent(FlowInfoPanel flowInfoPanel, Element taskElement) {
|
List<PropertyInfo> customClassInfos = new ArrayList<PropertyInfo>();
|
String eventType = taskElement.attributeValue(FlowConstants.EVENT);//start or end
|
String eventClass = "";
|
String taskType = eventClass;
|
ProcessTaskInfo processTaskInfo = new ProcessTaskInfo();
|
processTaskInfo.taskType = taskType;
|
for (Iterator<?> a = taskElement.elementIterator(); a.hasNext();) {
|
Element next = (Element)a.next();
|
eventClass = next.attributeValue(FlowConstants.EVENT_CLASS);
|
PropertyInfo customClassInfo = new PropertyInfo();
|
customClassInfo.property = eventClass;
|
customClassInfos.add(customClassInfo);
|
}
|
//设置自定义类的值
|
flowInfoPanel.setCustomClassInfo(eventType,customClassInfos.toArray(new PropertyInfo[0]));
|
|
}
|
|
private void setTaskEvent(TaskNewPanel taskPanel, Element taskElement) {
|
List<PropertyInfo> customClassInfos = new ArrayList<PropertyInfo>();
|
String eventType = taskElement.attributeValue(FlowConstants.EVENT);//start or end
|
String eventClass = "";
|
Map<String,ArrayList<PropertyInfo>> taskeventMap = new HashMap<String,ArrayList<PropertyInfo>>();
|
Map<String,Map<String,ArrayList<PropertyInfo>>> resultMap = new HashMap<String,Map<String,ArrayList<PropertyInfo>>>();
|
ArrayList<PropertyInfo> taskeventPropertylist = new ArrayList<PropertyInfo>();
|
for (Iterator<?> a = taskElement.elementIterator(); a.hasNext();) {
|
taskeventPropertylist = new ArrayList<PropertyInfo>();
|
Element next = (Element)a.next();
|
eventClass = next.attributeValue(FlowConstants.EVENT_CLASS);
|
PropertyInfo taskEventClassInfo = new PropertyInfo();
|
taskEventClassInfo.property = eventClass;
|
customClassInfos.add(taskEventClassInfo);
|
for (Iterator<?> b = next.elementIterator(); b.hasNext();) {
|
PropertyInfo propertyInfo = new PropertyInfo();
|
Element fieldElement = (Element)b.next();//多个field element
|
if(fieldElement.getName().equals(FlowConstants.EVENT_FIELD)){
|
propertyInfo.property = fieldElement.attributeValue(FlowConstants.XMLNAME);
|
for (Iterator<?> c = fieldElement.elementIterator(); c.hasNext();) {
|
Element stringElement = (Element)c.next();
|
if(stringElement.getName().equals(FlowConstants.EVENT_STRING)){
|
propertyInfo.value = stringElement.attributeValue(FlowConstants.EVENT_VALUE);
|
}
|
taskeventPropertylist.add(propertyInfo);
|
taskeventMap.put(eventClass, taskeventPropertylist);
|
}
|
}
|
}
|
resultMap.put(eventType, taskeventMap);
|
taskPanel.setResultMap(eventType,resultMap);
|
}
|
// //设置自定义类的值
|
taskPanel.setCustomClassInfo(eventType,customClassInfos.toArray(new PropertyInfo[0]));
|
|
}
|
|
private void setCustomuserClass(TaskNewPanel taskPanel, Element taskElement) {
|
List<CustomInfo> customUserInfos = new ArrayList<CustomInfo>();
|
List<CustomInfo> rescustomUserInfos = new ArrayList<CustomInfo>();
|
String eventType = taskElement.attributeValue(FlowConstants.EVENT);//start or end
|
String eventClass = "";
|
String flag = "";
|
if("start".equals(eventType)){
|
|
for (Iterator<?> a = taskElement.elementIterator(); a.hasNext();) {
|
CustomInfo customClassInfo = new CustomInfo();
|
Element next = (Element)a.next();
|
eventClass = next.attributeValue(FlowConstants.EVENT_CLASS);
|
flag = next.attributeValue(FlowConstants.CUSTOMUSERCLASS_flag);
|
if(FlowConstants.CUSTOMUSERCLASS.equals(flag)){
|
customClassInfo.className = eventClass;
|
customUserInfos.add(customClassInfo);
|
}
|
}
|
|
if(flag!=null&&!"".equals(flag)){
|
Element eventElement = taskElement.element(FlowConstants.EVENT_LISTENER);
|
for (Iterator<?> a = eventElement.elementIterator(); a.hasNext();) {
|
CustomInfo customClassInfo = new CustomInfo();
|
Element fieldElement = (Element)a.next();//多个field element
|
if(fieldElement.getName().equals(FlowConstants.EVENT_FIELD)){
|
for (Iterator<?> b = fieldElement.elementIterator(); b.hasNext();) {
|
Element stringElement = (Element)b.next();
|
if(stringElement.getName().equals(FlowConstants.EVENT_STRING)){
|
customClassInfo.value = stringElement.attributeValue(FlowConstants.EVENT_VALUE);
|
}
|
customUserInfos.add(customClassInfo);
|
}
|
}
|
}
|
for(int i=0;i<customUserInfos.size();i++){
|
CustomInfo rescustomInfo = new CustomInfo();
|
rescustomInfo.className = customUserInfos.get(i).className;
|
rescustomInfo.value = customUserInfos.get(++i).value;
|
rescustomUserInfos.add(rescustomInfo);
|
}
|
//设置自定义类的值
|
taskPanel.setCustomInfo(rescustomUserInfos.toArray(new CustomInfo[0]));
|
}
|
}
|
|
}
|
/**
|
* 设置路由事件
|
* @param transitionPanel
|
* @param transitionElements
|
* @throws VCIError
|
*/
|
private void setTransitionEvent(TransitionPanel transitionPanel, List<Element> transitionElements) throws VCIError {
|
List<PropertyInfo> customClassInfos = new ArrayList<PropertyInfo>();
|
String eventType = "trainsition";
|
String eventClass = "";
|
|
Map<String,ArrayList<PropertyInfo>> taskeventMap = new HashMap<String,ArrayList<PropertyInfo>>();
|
Map<String,Map<String,ArrayList<PropertyInfo>>> resultMap = new HashMap<String,Map<String,ArrayList<PropertyInfo>>>();
|
ArrayList<PropertyInfo> taskeventPropertylist = new ArrayList<PropertyInfo>();
|
for(int i =0;i<transitionElements.size();i++){
|
taskeventPropertylist = new ArrayList<PropertyInfo>();
|
eventClass = transitionElements.get(i).attributeValue(FlowConstants.EVENT_CLASS);
|
PropertyInfo customClassInfo = new PropertyInfo();
|
customClassInfo.property = eventClass;
|
customClassInfos.add(customClassInfo);
|
for (Iterator<?> b = transitionElements.get(i).elementIterator(); b.hasNext();) {
|
PropertyInfo propertyInfo = new PropertyInfo();
|
Element fieldElement = (Element)b.next();//多个field element
|
if(fieldElement.getName().equals(FlowConstants.EVENT_FIELD)){
|
propertyInfo.property = fieldElement.attributeValue(FlowConstants.XMLNAME);
|
for (Iterator<?> c = fieldElement.elementIterator(); c.hasNext();) {
|
Element stringElement = (Element)c.next();
|
if(stringElement.getName().equals(FlowConstants.EVENT_STRING)){
|
propertyInfo.value = stringElement.attributeValue(FlowConstants.EVENT_VALUE);
|
}
|
taskeventPropertylist.add(propertyInfo);
|
taskeventMap.put(eventClass, taskeventPropertylist);
|
}
|
}
|
}
|
resultMap.put(eventType, taskeventMap);
|
transitionPanel.setResultMap(eventType,resultMap);
|
}
|
//设置自定义类的值
|
transitionPanel.setCustomClassInfo(eventType,customClassInfos.toArray(new PropertyInfo[0]));
|
}
|
private String getI18nForEvent(String key) {
|
return LocaleDisplay.getI18nString(key, "RMIPWorkflow", getLocale());
|
}
|
}
|