use of org.camunda.bpm.model.cmmn.instance.Documentation in project camunda-cmmn-model by camunda.
the class DocumentationImpl method registerType.
public static void registerType(ModelBuilder modelBuilder) {
ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Documentation.class, CMMN_ELEMENT_DOCUMENTATION).namespaceUri(CMMN11_NS).instanceProvider(new ModelTypeInstanceProvider<Documentation>() {
public Documentation newInstance(ModelTypeInstanceContext instanceContext) {
return new DocumentationImpl(instanceContext);
}
});
idAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_ID).idAttribute().build();
textFormatAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_TEXT_FORMAT).defaultValue("text/plain").build();
typeBuilder.build();
}
use of org.camunda.bpm.model.cmmn.instance.Documentation in project camunda-bpm-platform by camunda.
the class DecisionTaskPlanItemHandlerTest method testPlanItemDocumentation.
@Test
public void testPlanItemDocumentation() {
// given
String description = "This is a planItem";
Documentation documentationElem = createElement(planItem, Documentation.class);
documentationElem.setTextContent(description);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
assertEquals(description, activity.getProperty(PROPERTY_ACTIVITY_DESCRIPTION));
}
use of org.camunda.bpm.model.cmmn.instance.Documentation in project camunda-bpm-platform by camunda.
the class DecisionTaskPlanItemHandlerTest method testDocumentation.
@Test
public void testDocumentation() {
// given
String description = "This is a documenation";
Documentation documentation = createElement(decisionTask, Documentation.class);
documentation.setTextContent(description);
// when
CmmnActivity activity = handler.handleElement(planItem, context);
// then
assertEquals(description, activity.getProperty(PROPERTY_ACTIVITY_DESCRIPTION));
}
use of org.camunda.bpm.model.cmmn.instance.Documentation in project camunda-bpm-platform by camunda.
the class ItemHandler method getDocumentation.
protected String getDocumentation(CmmnElement element) {
Collection<Documentation> documentations = element.getDocumentations();
if (documentations.isEmpty()) {
PlanItemDefinition definition = getDefinition(element);
documentations = definition.getDocumentations();
}
if (documentations.isEmpty()) {
return null;
}
StringBuilder builder = new StringBuilder();
for (Documentation doc : documentations) {
String content = doc.getTextContent();
if (content == null || content.isEmpty()) {
continue;
}
if (builder.length() != 0) {
builder.append("\n\n");
}
builder.append(content.trim());
}
return builder.toString();
}
use of org.camunda.bpm.model.cmmn.instance.Documentation in project camunda-cmmn-model by camunda.
the class Cmmn10Test method shouldGetDescription.
@Test
public void shouldGetDescription() {
CmmnModelInstance modelInstance = getCmmnModelInstance();
CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();
String description = casePlanModel.getDescription();
assertThat(description).isEqualTo("This is a description...");
Collection<Documentation> documentations = casePlanModel.getDocumentations();
assertThat(documentations).isEmpty();
}
Aggregations