Package jc.outputwindow

Examples of jc.outputwindow.OutputWindow$Process


  @Override
  public void traverse(List<? extends EObject> contents) {
    for(EObject e : contents) {
      if(e instanceof Definitions) {
        List<RootElement> roots = ((Definitions) e).getRootElements();
        Process p = null;
        for(RootElement root : roots) {
          if(root instanceof Process) {
            p = (Process) root;
          }
        }
View Full Code Here


   
    public void processTemplates() {
        List<RootElement> rootElements = def.getRootElements();
        for(RootElement re : rootElements) {
            if(re instanceof Process) {
                Process process = (Process) re;
                if(process != null && process.getId() != null && process.getId().length() > 0) {

                    // get the list of process properties
                    List<Property> processProperties = process.getProperties();

                    if (taskId == null) {
                        TaskFormInfo tfi = new TaskFormInfo();
                        tfi.setId(process.getId() + "-taskform");
                        if(process.getName() != null && process.getName().length() > 0 ) {
                            tfi.setProcessName(process.getName());
                        } else {
                            tfi.setProcessName(process.getId());
                        }
                        tfi.setProcessId(process.getId());
                        //String packageName1 = "";
    //                    FeatureMap attrs = process.getAnyAttribute();
    //                    for (Object attr : attrs) {
    //                        EStructuralFeatureImpl.SimpleFeatureMapEntry a = (EStructuralFeatureImpl.SimpleFeatureMapEntry) attr;
    //                        if("packageName".equals(a.getEStructuralFeature().getName())) {
    //                            packageName1 = (String)a.getValue();
    //                        }
    //                    }
                        tfi.setPkgName(packageName);
                        for(Property prop : processProperties) {
                            if(isValidStructureRef(prop.getItemSubjectRef().getStructureRef())) {
                                TaskFormInput input = new TaskFormInput();
                                input.setName(prop.getId());
                                input.setRefType(prop.getItemSubjectRef().getStructureRef());
                                tfi.getTaskInputs().add(input);
                            }
                        }
                        tfi.setProcessForm(true);
                        tfi.setUserTaskForm(false);
                        taskFormInformationList.add(tfi);
                    }
                   
                    for(FlowElement fe : process.getFlowElements()) {
                        if(fe instanceof UserTask) {
                            getTaskInfoForUserTask((UserTask) fe, process, processProperties, taskId);
                        } else if(fe instanceof FlowElementsContainer) {
                            getTaskInfoForContainers((FlowElementsContainer) fe, process, processProperties, taskId);
                        }
View Full Code Here

      FixFlowConverter fixFlowConverter = new FixFlowConverter();
     
        ObjectMapper objectMapper = new ObjectMapper();
            InputStream input = new FileInputStream(buildPath() +File.separator+request.getParameter("fileName"));
            Definitions definitions = fixFlowConverter.getDefinitions("process_1", input);
            Process process = (Process)definitions.getRootElements().get(0);
        ObjectNode on = fixFlowConverter.convertDefinitions2Json(definitions);
        ObjectNode rootNode = objectMapper.createObjectNode();
        rootNode.put("name", process.getName());
        rootNode.put("description", process.getName());
        rootNode.put("modelId", process.getId());
        rootNode.put("model", on);
        out = response.getWriter();
        out.print(rootNode);
    } catch (Exception e) {
      throw new RuntimeException(e);
View Full Code Here

        throw new FixFlowException(ExceptionCode.EXCEPTION_DEFAULT,e);
      }
    }
    URI uri = URI.createFileURI(path);
    Definitions definitions = getDefinitions("process_1",inputStreamNewFile);
    Process process =  (Process)definitions.getRootElements().get(0);
    process.setId(processId);
    process.setName(processName);
    save(definitions, uri);
  }
View Full Code Here

   * @param lanes
   * @param baseElement
   */
  private void fillAllLanes(List<Lane> lanes,BaseElement baseElement){
    if(baseElement instanceof Process){
      Process process = (Process)baseElement;
      for(LaneSet laneSet :process.getLaneSets()){
        for(Lane lane : laneSet.getLanes()){
          lanes.add(lane);
        }
      }
    }
View Full Code Here

    String nodeTempPath = ProcessEngineManagement.getDefaultProcessEngine().getProcessEngineConfiguration().getCopyTemplatePath();
    InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(nodeTempPath);
    Definitions bpmnModel = new FixFlowConverter().getDefinitions("temp", inputStream);
    BPMNDiagram bpmnDiagram=bpmnModel.getDiagrams().get(0);
    BPMNPlane bpmnPlane = bpmnDiagram.getPlane();
    Process process = (Process)bpmnModel.getRootElements().get(0);
    Map<String, JsonNode> shapeMap = new HashMap<String, JsonNode> ();
    Map<String, JsonNode> sourceRefMap = new HashMap<String, JsonNode>();
    Map<String, JsonNode> edgeMap = new HashMap<String, JsonNode>();
    Map<String, List<JsonNode>> sourceAndTargetMap = new HashMap<String, List<JsonNode>>();
    readShapeDI(modelNode, 0, 0, shapeMap, sourceRefMap, bpmnModel);
    filterAllEdges(modelNode, edgeMap, sourceAndTargetMap, shapeMap, sourceRefMap);
    ArrayNode shapesArrayNode = (ArrayNode) modelNode.get(EDITOR_CHILD_SHAPES);
    //做pool的时候用
    boolean nonEmptyPoolFound = false;

    if (nonEmptyPoolFound == false) {
        JsonNode processIdNode = JsonConverterUtil.getProperty(PROPERTY_OVERRIDE_ID, modelNode);
        if(processIdNode != null && StringUtils.isNotEmpty(processIdNode.asText())) {
          process.setId(processIdNode.asText());
        }
        JsonNode processNameNode = JsonConverterUtil.getProperty(PROPERTY_NAME, modelNode);
        if(processNameNode != null && StringUtils.isNotEmpty(processNameNode.asText())) {
          process.setName(processNameNode.asText());
        }
       
        //加载process的扩展元素
        //任务主题
        JsonNode processSubject = JsonConverterUtil.getProperty(PROPERTY_PROCESS_SUBJECT, modelNode);
        if(processSubject != null && StringUtils.isNotEmpty(processSubject.asText())) {
          TaskSubject taskSubject = FixFlowFactory.eINSTANCE.createTaskSubject();
            Expression subjectExpression = FixFlowFactory.eINSTANCE.createExpression();
            subjectExpression.setName(processSubject.asText());
            subjectExpression.setValue(processSubject.asText());
            taskSubject.setExpression(subjectExpression);
            taskSubject.setId("TaskSubject_1");
            BpmnModelUtil.addExtensionElement(process, FixFlowPackage.Literals.DOCUMENT_ROOT__TASK_SUBJECT, taskSubject);
        }
       
        //流程分类
        JsonNode processCategory = JsonConverterUtil.getProperty(PROPERTY_PROCESS_CATEGORY, modelNode);
        if(processCategory != null &&!"null".equals(processCategory.asText()) && StringUtil.isNotEmpty(processCategory.asText())){
          BpmnModelUtil.addExtensionAttribute(process, FixFlowPackage.Literals.DOCUMENT_ROOT__CATEGORY, processCategory.asText());
        }
       
        //默认表单
        JsonNode processFormUri = JsonConverterUtil.getProperty(PROPERTY_PROCESS_DEFAULT_FORMURI, modelNode);
        if(processFormUri != null && StringUtil.isNotEmpty(processFormUri.asText())){
          FormUri formUri = FixFlowFactory.eINSTANCE.createFormUri();
          Expression expression = FixFlowFactory.eINSTANCE.createExpression();
          expression.setName(processFormUri.asText());
          expression.setValue(processFormUri.asText());
          formUri.setExpression(expression);
          BpmnModelUtil.addExtensionElement(process, FixFlowPackage.Literals.DOCUMENT_ROOT__FORM_URI, formUri);
        }
       
        //流程变量
        JsonNode dataVariablesNode = JsonConverterUtil.getProperty(PROPERTY_PROCESS_DATAVARIABLE, modelNode);
        if(dataVariablesNode != null){
          JsonNode itemsNode = dataVariablesNode.get(EDITOR_PROPERTIES_GENERAL_ITEMS);
          if(itemsNode != null) {
                Iterator<JsonNode> variableIterator = itemsNode.getElements();
                while(variableIterator.hasNext()) {
                  JsonNode variableNode = variableIterator.next();
                  String id = variableNode.get(PROPERTY_DATAVARIABLE_ID).asText();
                  String dataType = variableNode.get(PROPERTY_DATAVARIABLE_TYPE).asText();
                  String bizType = variableNode.get(PROPERTY_DATAVARIABLE_BIZTYPE).asText();
                  boolean isPersistence = StringUtil.getBoolean(variableNode.get(PROPERTY_DATAVARIABLE_IS_PERSISTENCE));
                  String expression = "";
                  JsonNode tmpNode = variableNode.get(PROPERTY_DATAVARIABLE_DEFAULT_VALUE);
                  if(tmpNode != null){
                    expression = tmpNode.asText();
                  }
                  DataVariable dataVariableObj = FixFlowFactory.eINSTANCE.createDataVariable();
                  dataVariableObj.setBizType(bizType);
                  dataVariableObj.setId(id);
                  dataVariableObj.setDataType(dataType);
                  dataVariableObj.setIsPersistence(isPersistence);
                  Expression variableExpression = FixFlowFactory.eINSTANCE.createExpression();
                  variableExpression.setValue(expression);
                  variableExpression.setName(expression);
                  dataVariableObj.setExpression(variableExpression);
                  BpmnModelUtil.addExtensionElement(process, FixFlowPackage.Literals.DOCUMENT_ROOT__DATA_VARIABLE, dataVariableObj);
                }
          }
        }
        String isVerify = JsonConverterUtil.getProperty(PROPERTY_PROCESS_IS_VERIFY, modelNode).asText();
        BpmnModelUtil.addExtensionAttribute(process, FixFlowPackage.Literals.DOCUMENT_ROOT__VERIFICATION, isVerify);
       
        JsonNode processTargetNamespace = JsonConverterUtil.getProperty(PROPERTY_PROCESS_NAMESPACE, modelNode);
        if(processTargetNamespace != null && StringUtils.isNotEmpty(processTargetNamespace.asText())) {
          bpmnModel.setTargetNamespace(processTargetNamespace.asText());
        }
      
        ConnectorInstanceElm cie = new ConnectorInstanceElm();
        List<ConnectorInstance> list_ci = cie.convertJsonToElement(modelNode);
        if(list_ci != null){
          for (int i = 0; i < list_ci.size(); i++) {
            BpmnModelUtil.addExtensionElement(process, FixFlowPackage.Literals.DOCUMENT_ROOT__CONNECTOR_INSTANCE, list_ci.get(i));
          }
        }
        processJsonElements(shapesArrayNode, modelNode, process, shapeMap,sourceAndTargetMap,bpmnModel);
    }
   
      // Add flows to map for later processing
   
    Map<String, SequenceFlow> flowSourceMap = new HashMap<String, SequenceFlow>();
    Map<String, SequenceFlow> flowTargetMap = new HashMap<String, SequenceFlow>();
    //初始化线条的source map和target map,后面为flowNode加载来源和target
    addAllSequenceFlows(process.getFlowElements(), flowSourceMap, flowTargetMap);
    //flowElement的incoming和outgoing处理
    postProcessElements(process, process.getFlowElements(), flowSourceMap, flowTargetMap);
    //给根plane set 关联元素
    bpmnPlane.setBpmnElement(BpmnModelUtil.getBaseElement(bpmnModel, process.getId()));
    //给shape元素 set 关联元素
    for(DiagramElement diagram :  bpmnModel.getDiagrams().get(0).getPlane().getPlaneElement()){
      if(diagram instanceof BPMNShape){
        BPMNShape bpmnShape = (BPMNShape)diagram;
        String shapeId = bpmnShape.getId();
View Full Code Here

                parentLane.setChildLaneSet(laneSet);
            }else{
              parentLane.getChildLaneSet().getLanes().add(lane);
            }
          }else if(parentElement instanceof Process){
            Process process = (Process)parentElement;
            if(process.getLaneSets().size() >0){
              process.getLaneSets().get(0).getLanes().add(lane);
              }else{
                LaneSet laneSet = Bpmn2Factory.eINSTANCE.createLaneSet();
                laneSet.getLanes().add(lane);
                process.getLaneSets().add(laneSet);
              }
          }
        processJsonElements(shapeNode.get(EDITOR_CHILD_SHAPES), modelNode, lane, shapeMap,sourceAndTargetMap,model);
        continue;
        }
     
        //处理非lane元素
        Class<? extends BaseBpmnJsonConverter> converter = convertersToBpmnMap.get(stencilId);
        if (converter != null) {
          try {
            converter.newInstance().convertToBpmnModel(shapeNode, modelNode, this, parentElement, shapeMap,sourceAndTargetMap,model);
          } catch (Exception e) {
            e.printStackTrace();
            LOGGER.error("Error converting {}", BpmnJsonConverterUtil.getStencilId(shapeNode), e);
          }
        }
      }
   
      //fixflow线条处理  给线条增加source 和target元素
      if (parentElement instanceof Process) {
          ProcessDefinitionBehavior process = (ProcessDefinitionBehavior) parentElement;
          addSourceAndTarget(process.getFlowElements(),sourceAndTargetMap,model);
      }
  }
View Full Code Here

    if (parentElement instanceof Process) {
      ((Process) parentElement).getFlowElements().add(flowElement);
    } else if (parentElement instanceof SubProcess) {
      ((SubProcess) parentElement).getFlowElements().add(flowElement);
    } else if (parentElement instanceof Lane) {
      Process process = (Process)this.model.getRootElements().get(0);
      Lane lane = (Lane) parentElement;
      process.getFlowElements().add(flowElement);
      lane.getFlowNodeRefs().add((FlowNode)flowElement);
    }
  }
View Full Code Here

      handler.moveLane(movedLane, targetParticipant);
    } catch (IOException e) {
      Activator.logError(e);
    }

    Process process = targetParticipant.getProcessRef();
    if (process.getLaneSets().isEmpty()) {
      LaneSet createLaneSet = ModelHandler.FACTORY.createLaneSet();
//      createLaneSet.setId(EcoreUtil.generateUUID());
      process.getLaneSets().add(createLaneSet);
      ModelUtil.setID(createLaneSet);
    }
    process.getLaneSets().get(0).getLanes().add(movedLane);

    Lane fromLane = (Lane) getBusinessObjectForPictogramElement(context.getSourceContainer());
    fromLane.getChildLaneSet().getLanes().remove(movedLane);
    if (fromLane.getChildLaneSet().getLanes().isEmpty()) {
      fromLane.setChildLaneSet(null);
View Full Code Here

        laneSet.getLanes().remove(movedLane);
        if (laneSet.getLanes().isEmpty()) {
          internalParticipant.getProcessRef().getLaneSets().remove(laneSet);
        }

        Process process = targetParticipant.getProcessRef();
        if (process.getLaneSets().isEmpty()) {
          LaneSet claneSet = ModelHandler.FACTORY.createLaneSet();
//          claneSet.setId(EcoreUtil.generateUUID());
          process.getLaneSets().add(claneSet);
          ModelUtil.setID(claneSet);
        }
        process.getLaneSets().get(0).getLanes().add(movedLane);
      }
    } catch (IOException e) {
      Activator.logError(e);
    }
  }
View Full Code Here

TOP

Related Classes of jc.outputwindow.OutputWindow$Process

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.