org.activiti.bpmn.model.Process.getId()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(11.5k)|赞(0)|评价(0)|浏览(173)

本文整理了Java中org.activiti.bpmn.model.Process.getId()方法的一些代码示例,展示了Process.getId()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Process.getId()方法的具体详情如下:
包路径:org.activiti.bpmn.model.Process
类名称:Process
方法名:getId

Process.getId介绍

暂无

代码示例

代码示例来源:origin: Activiti/Activiti

protected void executeParse(BpmnParse bpmnParse, Process process) {
 if (process.isExecutable() == false) {
  LOGGER.info("Ignoring non-executable process with id='" + process.getId() + "'. Set the attribute isExecutable=\"true\" to deploy this process.");
 } else {
  bpmnParse.getProcessDefinitions().add(transformProcess(bpmnParse, process));
 }
}

代码示例来源:origin: Activiti/Activiti

protected void handleProcessConstraints(BpmnModel bpmnModel, Process process, List<ValidationError> errors) {
 if (process.getId() != null && process.getId().length() > Constraints.PROCESS_DEFINITION_ID_MAX_LENGTH) {
  addError(errors, Problems.PROCESS_DEFINITION_ID_TOO_LONG, process,
    "The id of the process definition must not contain more than " + Constraints.PROCESS_DEFINITION_ID_MAX_LENGTH + " characters");
 }
 if (process.getName() != null && process.getName().length() > Constraints.PROCESS_DEFINITION_NAME_MAX_LENGTH) {
  addError(errors, Problems.PROCESS_DEFINITION_NAME_TOO_LONG, process,
    "The name of the process definition must not contain more than " + Constraints.PROCESS_DEFINITION_NAME_MAX_LENGTH + " characters");
 }
 if (process.getDocumentation() != null && process.getDocumentation().length() > Constraints.PROCESS_DEFINITION_DOCUMENTATION_MAX_LENGTH) {
  addError(errors, Problems.PROCESS_DEFINITION_DOCUMENTATION_TOO_LONG, process,
    "The documentation of the process definition must not contain more than " + Constraints.PROCESS_DEFINITION_DOCUMENTATION_MAX_LENGTH + " characters");
 }
}

代码示例来源:origin: Activiti/Activiti

public static void writeLanes(Process process, XMLStreamWriter xtw) throws Exception {
  if (!process.getLanes().isEmpty()) {
   xtw.writeStartElement(ELEMENT_LANESET);
   xtw.writeAttribute(ATTRIBUTE_ID, "laneSet_" + process.getId());
   for (Lane lane : process.getLanes()) {
    xtw.writeStartElement(ELEMENT_LANE);
    xtw.writeAttribute(ATTRIBUTE_ID, lane.getId());

    if (StringUtils.isNotEmpty(lane.getName())) {
     xtw.writeAttribute(ATTRIBUTE_NAME, lane.getName());
    }

    boolean didWriteExtensionStartElement = BpmnXMLUtil.writeExtensionElements(lane, false, xtw);
    if (didWriteExtensionStartElement) {
     xtw.writeEndElement();
    }

    for (String flowNodeRef : lane.getFlowReferences()) {
     xtw.writeStartElement(ELEMENT_FLOWNODE_REF);
     xtw.writeCharacters(flowNodeRef);
     xtw.writeEndElement();
    }

    xtw.writeEndElement();
   }
   xtw.writeEndElement();
  }
 }
}

代码示例来源:origin: hs-web/hsweb-framework

byte[] exportBytes = null;
String mainProcessId = bpmnModel.getMainProcess().getId();

代码示例来源:origin: Activiti/Activiti

xtw.writeAttribute(ATTRIBUTE_ID, process.getId());

代码示例来源:origin: Activiti/Activiti

if (process.getId().equals(pool.getProcessRef())) {
 pool.setExecutable(process.isExecutable());

代码示例来源:origin: Activiti/Activiti

processId = "Collaboration";
} else {
 processId = model.getMainProcess().getId();

代码示例来源:origin: Activiti/Activiti

ProcessDefinitionEntity processDefinition = getProcessDefinition(process.getId());
if (processDefinition != null) {
 processDefinition.setGraphicalNotationDefined(true);

代码示例来源:origin: Activiti/Activiti

protected void addError(List<ValidationError> validationErrors, String problem, Process process, String id, String description) {
 ValidationError error = new ValidationError();
 if (process != null) {
  error.setProcessDefinitionId(process.getId());
  error.setProcessDefinitionName(process.getName());
 }
 error.setProblem(problem);
 error.setDefaultDescription(description);
 error.setActivityId(id);
 addError(validationErrors, error);
}

代码示例来源:origin: Activiti/Activiti

if (StringUtils.isNotEmpty(mainProcess.getId())) {
  propertiesNode.put(PROPERTY_PROCESS_ID,
            mainProcess.getId());

代码示例来源:origin: Activiti/Activiti

String processId = process.getId();
if (!isEqualToCurrentLocalizationValue(locale,
                   processId,

代码示例来源:origin: Activiti/Activiti

protected ProcessDefinitionEntity transformProcess(BpmnParse bpmnParse, Process process) {
 ProcessDefinitionEntity currentProcessDefinition = Context.getCommandContext().getProcessDefinitionEntityManager().create();
 bpmnParse.setCurrentProcessDefinition(currentProcessDefinition);
 /*
  * Mapping object model - bpmn xml: processDefinition.id -> generated by activiti engine processDefinition.key -> bpmn id (required) processDefinition.name -> bpmn name (optional)
  */
 currentProcessDefinition.setKey(process.getId());
 currentProcessDefinition.setName(process.getName());
 currentProcessDefinition.setCategory(bpmnParse.getBpmnModel().getTargetNamespace());
 currentProcessDefinition.setDescription(process.getDocumentation());
 currentProcessDefinition.setDeploymentId(bpmnParse.getDeployment().getId());
 
 if (bpmnParse.getDeployment().getEngineVersion() != null) {
  currentProcessDefinition.setEngineVersion(bpmnParse.getDeployment().getEngineVersion());
 }
 
 createEventListeners(bpmnParse, process.getEventListeners());
 if (LOGGER.isDebugEnabled()) {
  LOGGER.debug("Parsing process {}", currentProcessDefinition.getKey());
 }
 
 bpmnParse.processFlowElements(process.getFlowElements());
 processArtifacts(bpmnParse, process.getArtifacts());
 return currentProcessDefinition;
}

代码示例来源:origin: Activiti/Activiti

protected void addError(List<ValidationError> validationErrors, String problem, Process process, BaseElement baseElement, String description, boolean isWarning) {
 ValidationError error = new ValidationError();
 error.setWarning(isWarning);
 if (process != null) {
  error.setProcessDefinitionId(process.getId());
  error.setProcessDefinitionName(process.getName());
 }
 if (baseElement != null) {
  error.setXmlLineNumber(baseElement.getXmlRowNumber());
  error.setXmlColumnNumber(baseElement.getXmlColumnNumber());
 }
 error.setProblem(problem);
 error.setDefaultDescription(description);
 if (baseElement instanceof FlowElement) {
  FlowElement flowElement = (FlowElement) baseElement;
  error.setActivityId(flowElement.getId());
  error.setActivityName(flowElement.getName());
 }
 addError(validationErrors, error);
}

代码示例来源:origin: bill1012/AdminEAP

/**
 * 导出model的xml文件
 */
@RequestMapping(value = "/model/export/xml/{modelId}", method = RequestMethod.GET)
public void exportXml(@PathVariable("modelId") String modelId, HttpServletResponse response) {
  try {
    Model modelData = repositoryService.getModel(modelId);
    BpmnJsonConverter jsonConverter = new BpmnJsonConverter();
    JsonNode editorNode = objectMapper.readTree(repositoryService.getModelEditorSource(modelData.getId()));
    BpmnModel bpmnModel = jsonConverter.convertToBpmnModel(editorNode);
    BpmnXMLConverter xmlConverter = new BpmnXMLConverter();
    //没有xml
    if (bpmnModel.getProcesses().isEmpty()) {
      response.setCharacterEncoding("utf-8");
      response.getWriter().print("<script>modals.error('xml文件不存在,生成错误');</script>");
      response.flushBuffer();
      return;
    }
    byte[] bpmnBytes = xmlConverter.convertToXML(bpmnModel);
    ByteArrayInputStream in = new ByteArrayInputStream(bpmnBytes);
    IOUtils.copy(in, response.getOutputStream());
    String filename = bpmnModel.getMainProcess().getId() + ".bpmn20.model.xml";
    response.setHeader("Content-Disposition", "attachment; filename=" + filename);
    response.flushBuffer();
  } catch (Exception e) {
    LOGGER.error("导出model的xml文件失败:modelId={}", modelId, e);
  }
}

代码示例来源:origin: bluejoe2008/openwebflow

public static void importModel(RepositoryService repositoryService, File modelFile) throws IOException,
      XMLStreamException
  {
    InputStreamReader reader = new InputStreamReader(new FileInputStream(modelFile), "utf-8");
    String fileContent = IOUtils.readStringAndClose(reader, (int) modelFile.length());

    BpmnModel bpmnModel = new BpmnXMLConverter().convertToBpmnModel(new StringStreamSourceEx(fileContent), false,
      false);

    String processName = bpmnModel.getMainProcess().getName();
    if (processName == null || processName.isEmpty())
    {
      processName = bpmnModel.getMainProcess().getId();
    }

    Model modelData = repositoryService.newModel();
    ObjectNode modelObjectNode = new ObjectMapper().createObjectNode();
    modelObjectNode.put(ModelDataJsonConstants.MODEL_NAME, processName);
    modelObjectNode.put(ModelDataJsonConstants.MODEL_REVISION, 1);
    modelData.setMetaInfo(modelObjectNode.toString());
    modelData.setName(processName);
    modelData.setKey(modelFile.getName());

    repositoryService.saveModel(modelData);

    repositoryService.addModelEditorSource(modelData.getId(), fileContent.getBytes("utf-8"));
    Logger.getLogger(ModelUtils.class)
        .info(String.format("importing model file: %s", modelFile.getCanonicalPath()));
  }
}

代码示例来源:origin: org.activiti/activiti-engine

protected void executeParse(BpmnParse bpmnParse, Process process) {
 if (process.isExecutable() == false) {
  LOGGER.info("Ignoring non-executable process with id='" + process.getId() + "'. Set the attribute isExecutable=\"true\" to deploy this process.");
 } else {
  bpmnParse.getProcessDefinitions().add(transformProcess(bpmnParse, process));
 }
}

代码示例来源:origin: com.bbossgroups.activiti/activiti-engine

protected void executeParse(BpmnParse bpmnParse, Process process) {
 if (process.isExecutable() == false) {
  LOGGER.info("Ignoring non-executable process with id='" + process.getId() + "'. Set the attribute isExecutable=\"true\" to deploy this process.");
 } else {
  bpmnParse.getProcessDefinitions().add(transformProcess(bpmnParse, process));
 }
}

代码示例来源:origin: org.activiti/activiti-process-validation

protected void handleProcessConstraints(BpmnModel bpmnModel, Process process, List<ValidationError> errors) {
 if (process.getId() != null && process.getId().length() > Constraints.PROCESS_DEFINITION_ID_MAX_LENGTH) {
  addError(errors, Problems.PROCESS_DEFINITION_ID_TOO_LONG, process,
    "The id of the process definition must not contain more than " + Constraints.PROCESS_DEFINITION_ID_MAX_LENGTH + " characters");
 }
 if (process.getName() != null && process.getName().length() > Constraints.PROCESS_DEFINITION_NAME_MAX_LENGTH) {
  addError(errors, Problems.PROCESS_DEFINITION_NAME_TOO_LONG, process,
    "The name of the process definition must not contain more than " + Constraints.PROCESS_DEFINITION_NAME_MAX_LENGTH + " characters");
 }
 if (process.getDocumentation() != null && process.getDocumentation().length() > Constraints.PROCESS_DEFINITION_DOCUMENTATION_MAX_LENGTH) {
  addError(errors, Problems.PROCESS_DEFINITION_DOCUMENTATION_TOO_LONG, process,
    "The documentation of the process definition must not contain more than " + Constraints.PROCESS_DEFINITION_DOCUMENTATION_MAX_LENGTH + " characters");
 }
}

代码示例来源:origin: org.activiti/activiti-process-validation

protected void addError(List<ValidationError> validationErrors, String problem, Process process, String id, String description) {
 ValidationError error = new ValidationError();
 if (process != null) {
  error.setProcessDefinitionId(process.getId());
  error.setProcessDefinitionName(process.getName());
 }
 error.setProblem(problem);
 error.setDefaultDescription(description);
 error.setActivityId(id);
 addError(validationErrors, error);
}

代码示例来源:origin: org.activiti/activiti-process-validation

protected void addError(List<ValidationError> validationErrors, String problem, Process process, BaseElement baseElement, String description, boolean isWarning) {
 ValidationError error = new ValidationError();
 error.setWarning(isWarning);
 if (process != null) {
  error.setProcessDefinitionId(process.getId());
  error.setProcessDefinitionName(process.getName());
 }
 if (baseElement != null) {
  error.setXmlLineNumber(baseElement.getXmlRowNumber());
  error.setXmlColumnNumber(baseElement.getXmlColumnNumber());
 }
 error.setProblem(problem);
 error.setDefaultDescription(description);
 if (baseElement instanceof FlowElement) {
  FlowElement flowElement = (FlowElement) baseElement;
  error.setActivityId(flowElement.getId());
  error.setActivityName(flowElement.getName());
 }
 addError(validationErrors, error);
}

相关文章