当前位置: 首页>>代码示例>>Java>>正文


Java Artifact类代码示例

本文整理汇总了Java中org.activiti.bpmn.model.Artifact的典型用法代码示例。如果您正苦于以下问题:Java Artifact类的具体用法?Java Artifact怎么用?Java Artifact使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Artifact类属于org.activiti.bpmn.model包,在下文中一共展示了Artifact类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: processArtifacts

import org.activiti.bpmn.model.Artifact; //导入依赖的package包/类
protected void processArtifacts(FlowElementsContainer container,
        BpmnModel model, ArrayNode shapesArrayNode, double containerX,
        double containerY) {
    for (Artifact artifact : container.getArtifacts()) {
        Class<? extends BaseBpmnJsonConverter> converter = convertersToJsonMap
                .get(artifact.getClass());

        if (converter != null) {
            try {
                converter.newInstance().convertToJson(artifact, this,
                        model, container, shapesArrayNode, containerX,
                        containerY);
            } catch (Exception e) {
                LOGGER.error("Error converting {}", artifact, e);
            }
        }
    }
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:19,代码来源:BpmnJsonConverter.java

示例2: createXML

import org.activiti.bpmn.model.Artifact; //导入依赖的package包/类
private void createXML(FlowElement flowElement, BpmnModel model, XMLStreamWriter xtw) throws Exception {
  
  if (flowElement instanceof SubProcess) {
    
    SubProcess subProcess = (SubProcess) flowElement;
    xtw.writeStartElement(ELEMENT_SUBPROCESS);
    xtw.writeAttribute(ATTRIBUTE_ID, subProcess.getId());
    if (StringUtils.isNotEmpty(subProcess.getName())) {
      xtw.writeAttribute(ATTRIBUTE_NAME, subProcess.getName());
    } else {
      xtw.writeAttribute(ATTRIBUTE_NAME, "subProcess");
    }
    
    if (subProcess instanceof EventSubProcess) {
      xtw.writeAttribute(ATTRIBUTE_TRIGGERED_BY, ATTRIBUTE_VALUE_TRUE);
    }
    
    if (StringUtils.isNotEmpty(subProcess.getDocumentation())) {

      xtw.writeStartElement(ELEMENT_DOCUMENTATION);
      xtw.writeCharacters(subProcess.getDocumentation());
      xtw.writeEndElement();
    }
    
    boolean wroteListener = ActivitiListenerExport.writeListeners(subProcess, false, xtw);
    if (wroteListener) {
      // closing extensions element
      xtw.writeEndElement();
    }
    MultiInstanceExport.writeMultiInstance(subProcess, xtw);
    
    for (FlowElement subElement : subProcess.getFlowElements()) {
      createXML(subElement, model, xtw);
    }
    
    for (Artifact artifact : subProcess.getArtifacts()) {
      createXML(artifact, model, xtw);
    }
    
    xtw.writeEndElement();
    
  } else {
  
    Class<? extends BaseBpmnXMLConverter> converter = convertersToXMLMap.get(flowElement.getClass());
    
    if (converter == null) {
      throw new XMLException("No converter for " + flowElement.getClass() + " found");
    }
    
    converter.newInstance().convertToXML(xtw, flowElement, model);
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:53,代码来源:BpmnXMLConverter.java

示例3: gatherAllArtifacts

import org.activiti.bpmn.model.Artifact; //导入依赖的package包/类
protected static List<Artifact> gatherAllArtifacts(BpmnModel bpmnModel) {
    List<Artifact> artifacts = new ArrayList<Artifact>();

    for (org.activiti.bpmn.model.Process process : bpmnModel.getProcesses()) {
        artifacts.addAll(process.getArtifacts());
    }

    return artifacts;
}
 
开发者ID:zhaojunfei,项目名称:lemon,代码行数:10,代码来源:CustomProcessDiagramGenerator.java

示例4: processArtifacts

import org.activiti.bpmn.model.Artifact; //导入依赖的package包/类
protected void processArtifacts(BpmnParse bpmnParse, Collection<Artifact> artifacts, ScopeImpl scope) {
  // associations  
  for (Artifact artifact : artifacts) {
    if (artifact instanceof Association) {
      createAssociation(bpmnParse, (Association) artifact, scope);
    }
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:9,代码来源:AbstractBpmnParseHandler.java

示例5: convertToBpmnModel

import org.activiti.bpmn.model.Artifact; //导入依赖的package包/类
public void convertToBpmnModel(XMLStreamReader xtr, BpmnModel model, Process activeProcess, 
    List<SubProcess> activeSubProcessList) throws Exception {
  
  this.model = model;
  this.activeProcess = activeProcess;
  
  String elementId = xtr.getAttributeValue(null, ATTRIBUTE_ID);
  String elementName = xtr.getAttributeValue(null, ATTRIBUTE_NAME);
  boolean async = parseAsync(xtr);
  boolean notExclusive = parseNotExclusive(xtr);
  String defaultFlow = xtr.getAttributeValue(null, ATTRIBUTE_DEFAULT);
  boolean isForCompensation = parseForCompensation(xtr);
  
  BaseElement parsedElement = convertXMLToElement(xtr);
  
  if (parsedElement instanceof Artifact) {
    Artifact currentArtifact = (Artifact) parsedElement;
    currentArtifact.setId(elementId);

    if (isInSubProcess(activeSubProcessList)) {
      final SubProcess currentSubProcess = activeSubProcessList.get(activeSubProcessList.size() - 2);
      currentSubProcess.addArtifact(currentArtifact);

    } else {
      this.activeProcess.addArtifact(currentArtifact);
    }
  }
  
  if(parsedElement instanceof FlowElement) {
    
    FlowElement currentFlowElement = (FlowElement) parsedElement;
    currentFlowElement.setId(elementId);
    currentFlowElement.setName(elementName);
    
    if(currentFlowElement instanceof Activity) {
      
      Activity activity = (Activity) currentFlowElement;
      activity.setAsynchronous(async);
      activity.setNotExclusive(notExclusive);
      activity.setForCompensation(isForCompensation);
      if(StringUtils.isNotEmpty(defaultFlow)) {
        activity.setDefaultFlow(defaultFlow);
      }
    }
    
    if(currentFlowElement instanceof Gateway) {
      if(StringUtils.isNotEmpty(defaultFlow)) {
        ((Gateway) currentFlowElement).setDefaultFlow(defaultFlow);
      }
    }
    
    if (activeSubProcessList.size() > 0) {
      activeSubProcessList.get(activeSubProcessList.size() - 1).addFlowElement(currentFlowElement);
    } else {
      this.activeProcess.addFlowElement(currentFlowElement);
    }
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:59,代码来源:BaseBpmnXMLConverter.java

示例6: convertToXML

import org.activiti.bpmn.model.Artifact; //导入依赖的package包/类
public byte[] convertToXML(BpmnModel model, String encoding) {
  try {

    ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
    
    XMLOutputFactory xof = XMLOutputFactory.newInstance();
    OutputStreamWriter out = new OutputStreamWriter(outputStream, encoding);

    XMLStreamWriter writer = xof.createXMLStreamWriter(out);
    XMLStreamWriter xtw = new IndentingXMLStreamWriter(writer);

    DefinitionsRootExport.writeRootElement(model, xtw, encoding);
    SignalAndMessageDefinitionExport.writeSignalsAndMessages(model, xtw);
    PoolExport.writePools(model, xtw);
    
    for (Process process : model.getProcesses()) {
      
      if(process.getFlowElements().size() == 0 && process.getLanes().size() == 0) {
        // empty process, ignore it 
        continue;
      }
    
      ProcessExport.writeProcess(process, xtw);
      
      for (FlowElement flowElement : process.getFlowElements()) {
        createXML(flowElement, model, xtw);
      }
      
      for (Artifact artifact : process.getArtifacts()) {
        createXML(artifact, model, xtw);
      }
      
      // end process element
      xtw.writeEndElement();
    }

    BPMNDIExport.writeBPMNDI(model, xtw);

    // end definitions root element
    xtw.writeEndElement();
    xtw.writeEndDocument();

    xtw.flush();

    outputStream.close();

    xtw.close();
    
    return outputStream.toByteArray();
    
  } catch (Exception e) {
    LOGGER.error("Error writing BPMN XML", e);
    throw new XMLException("Error writing BPMN XML", e);
  }
}
 
开发者ID:springvelocity,项目名称:xbpm5,代码行数:56,代码来源:BpmnXMLConverter.java


注:本文中的org.activiti.bpmn.model.Artifact类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。