Search in sources :

Example 1 with Documentation

use of org.camunda.bpm.model.bpmn.instance.Documentation in project camunda-bpmn-model by camunda.

the class DocumentationImpl method registerType.

public static void registerType(ModelBuilder modelBuilder) {
    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Documentation.class, BPMN_ELEMENT_DOCUMENTATION).namespaceUri(BPMN20_NS).instanceProvider(new ModelTypeInstanceProvider<Documentation>() {

        public Documentation newInstance(ModelTypeInstanceContext instanceContext) {
            return new DocumentationImpl(instanceContext);
        }
    });
    idAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_ID).idAttribute().build();
    textFormatAttribute = typeBuilder.stringAttribute(BPMN_ATTRIBUTE_TEXT_FORMAT).defaultValue("text/plain").build();
    typeBuilder.build();
}
Also used : Documentation(org.camunda.bpm.model.bpmn.instance.Documentation) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)

Example 2 with Documentation

use of org.camunda.bpm.model.bpmn.instance.Documentation in project camunda-bpm-platform by camunda.

the class ProcessDefinitionQueryImpl method addProcessDefinitionToCacheAndRetrieveDocumentation.

protected void addProcessDefinitionToCacheAndRetrieveDocumentation(List<ProcessDefinition> list) {
    for (ProcessDefinition processDefinition : list) {
        BpmnModelInstance bpmnModelInstance = Context.getProcessEngineConfiguration().getDeploymentCache().findBpmnModelInstanceForProcessDefinition((ProcessDefinitionEntity) processDefinition);
        ModelElementInstance processElement = bpmnModelInstance.getModelElementById(processDefinition.getKey());
        if (processElement != null) {
            Collection<Documentation> documentations = processElement.getChildElementsByType(Documentation.class);
            List<String> docStrings = new ArrayList<String>();
            for (Documentation documentation : documentations) {
                docStrings.add(documentation.getTextContent());
            }
            ProcessDefinitionEntity processDefinitionEntity = (ProcessDefinitionEntity) processDefinition;
            processDefinitionEntity.setProperty(BpmnParse.PROPERTYNAME_DOCUMENTATION, BpmnParse.parseDocumentation(docStrings));
        }
    }
}
Also used : ModelElementInstance(org.camunda.bpm.model.xml.instance.ModelElementInstance) Documentation(org.camunda.bpm.model.bpmn.instance.Documentation) ArrayList(java.util.ArrayList) ProcessDefinition(org.camunda.bpm.engine.repository.ProcessDefinition) BpmnModelInstance(org.camunda.bpm.model.bpmn.BpmnModelInstance) ProcessDefinitionEntity(org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)

Aggregations

Documentation (org.camunda.bpm.model.bpmn.instance.Documentation)2 ArrayList (java.util.ArrayList)1 ProcessDefinitionEntity (org.camunda.bpm.engine.impl.persistence.entity.ProcessDefinitionEntity)1 ProcessDefinition (org.camunda.bpm.engine.repository.ProcessDefinition)1 BpmnModelInstance (org.camunda.bpm.model.bpmn.BpmnModelInstance)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementInstance (org.camunda.bpm.model.xml.instance.ModelElementInstance)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1