Search in sources :

Example 1 with Documentation

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();
}
Also used : Documentation(org.camunda.bpm.model.cmmn.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.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));
}
Also used : Documentation(org.camunda.bpm.model.cmmn.instance.Documentation) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 3 with Documentation

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));
}
Also used : Documentation(org.camunda.bpm.model.cmmn.instance.Documentation) CmmnActivity(org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity) Test(org.junit.Test)

Example 4 with Documentation

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();
}
Also used : PlanItemDefinition(org.camunda.bpm.model.cmmn.instance.PlanItemDefinition) Documentation(org.camunda.bpm.model.cmmn.instance.Documentation) CamundaString(org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)

Example 5 with Documentation

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();
}
Also used : CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) Documentation(org.camunda.bpm.model.cmmn.instance.Documentation) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance) Test(org.junit.Test)

Aggregations

Documentation (org.camunda.bpm.model.cmmn.instance.Documentation)5 Test (org.junit.Test)3 CmmnActivity (org.camunda.bpm.engine.impl.cmmn.model.CmmnActivity)2 CmmnModelInstance (org.camunda.bpm.model.cmmn.CmmnModelInstance)1 CasePlanModel (org.camunda.bpm.model.cmmn.instance.CasePlanModel)1 PlanItemDefinition (org.camunda.bpm.model.cmmn.instance.PlanItemDefinition)1 CamundaString (org.camunda.bpm.model.cmmn.instance.camunda.CamundaString)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1