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();
}
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));
}
}
}
Aggregations