Search in sources :

Example 6 with Definitions

use of org.camunda.bpm.model.cmmn.instance.Definitions in project camunda-bpm-platform by camunda.

the class CmmnTransformerTest method setup.

@Before
public void setup() {
    CmmnTransformer transformerWrapper = new CmmnTransformer(null, new DefaultCmmnElementHandlerRegistry(), null);
    transformer = new CmmnTransform(transformerWrapper);
    deployment = new DeploymentEntity();
    deployment.setId("aDeploymentId");
    transformer.setDeployment(deployment);
    modelInstance = Cmmn.createEmptyModel();
    definitions = modelInstance.newInstance(Definitions.class);
    definitions.setTargetNamespace("http://camunda.org/examples");
    modelInstance.setDefinitions(definitions);
    caseDefinition = createElement(definitions, "aCaseDefinition", Case.class);
    casePlanModel = createElement(caseDefinition, "aCasePlanModel", CasePlanModel.class);
}
Also used : DeploymentEntity(org.camunda.bpm.engine.impl.persistence.entity.DeploymentEntity) CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) Definitions(org.camunda.bpm.model.cmmn.instance.Definitions) DefaultCmmnElementHandlerRegistry(org.camunda.bpm.engine.impl.cmmn.handler.DefaultCmmnElementHandlerRegistry) CmmnTransformer(org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransformer) CmmnTransform(org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransform) Case(org.camunda.bpm.model.cmmn.instance.Case) Before(org.junit.Before)

Example 7 with Definitions

use of org.camunda.bpm.model.cmmn.instance.Definitions in project camunda-cmmn-model by camunda.

the class CmmnModelInstanceTest method testClone.

@Test
public void testClone() throws Exception {
    CmmnModelInstance modelInstance = Cmmn.createEmptyModel();
    Definitions definitions = modelInstance.newInstance(Definitions.class);
    definitions.setId("TestId");
    modelInstance.setDefinitions(definitions);
    CmmnModelInstance cloneInstance = modelInstance.clone();
    cloneInstance.getDefinitions().setId("TestId2");
    assertThat(modelInstance.getDefinitions().getId(), is(equalTo("TestId")));
    assertThat(cloneInstance.getDefinitions().getId(), is(equalTo("TestId2")));
}
Also used : Definitions(org.camunda.bpm.model.cmmn.instance.Definitions) Test(org.junit.Test)

Example 8 with Definitions

use of org.camunda.bpm.model.cmmn.instance.Definitions in project camunda-cmmn-model by camunda.

the class GenerateIdTest method shouldGenerateIdsOnCreate.

@Test
public void shouldGenerateIdsOnCreate() {
    CmmnModelInstance modelInstance = Cmmn.createEmptyModel();
    Definitions definitions = modelInstance.newInstance(Definitions.class);
    assertThat(definitions.getId()).isNotNull();
    Case caseElement = modelInstance.newInstance(Case.class);
    assertThat(caseElement.getId()).isNotNull();
    CasePlanModel casePlanModel = modelInstance.newInstance(CasePlanModel.class);
    assertThat(casePlanModel.getId()).isNotNull();
    HumanTask humanTask = modelInstance.newInstance(HumanTask.class);
    assertThat(humanTask.getId()).isNotNull();
}
Also used : CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) Definitions(org.camunda.bpm.model.cmmn.instance.Definitions) HumanTask(org.camunda.bpm.model.cmmn.instance.HumanTask) Case(org.camunda.bpm.model.cmmn.instance.Case) Test(org.junit.Test)

Example 9 with Definitions

use of org.camunda.bpm.model.cmmn.instance.Definitions in project camunda-cmmn-model by camunda.

the class DefinitionsImpl method registerType.

public static void registerType(ModelBuilder modelBuilder) {
    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Definitions.class, CMMN_ELEMENT_DEFINITIONS).namespaceUri(CMMN11_NS).instanceProvider(new ModelElementTypeBuilder.ModelTypeInstanceProvider<Definitions>() {

        public Definitions newInstance(ModelTypeInstanceContext instanceContext) {
            return new DefinitionsImpl(instanceContext);
        }
    });
    idAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_ID).idAttribute().build();
    nameAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_NAME).build();
    targetNamespaceAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_TARGET_NAMESPACE).required().build();
    expressionLanguageAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_EXPRESSION_LANGUAGE).defaultValue(XPATH_NS).build();
    exporterAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_EXPORTER).build();
    exporterVersionAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_EXPORTER_VERSION).build();
    authorAttribute = typeBuilder.stringAttribute(CMMN_ATTRIBUTE_AUTHOR).build();
    SequenceBuilder sequenceBuilder = typeBuilder.sequence();
    importCollection = sequenceBuilder.elementCollection(Import.class).build();
    caseFileItemDefinitionCollection = sequenceBuilder.elementCollection(CaseFileItemDefinition.class).build();
    caseCollection = sequenceBuilder.elementCollection(Case.class).build();
    processCollection = sequenceBuilder.elementCollection(Process.class).build();
    decisionCollection = sequenceBuilder.elementCollection(Decision.class).build();
    extensionElementsChild = sequenceBuilder.element(ExtensionElements.class).minOccurs(0).maxOccurs(1).build();
    relationshipCollection = sequenceBuilder.elementCollection(Relationship.class).build();
    artifactCollection = sequenceBuilder.elementCollection(Artifact.class).build();
    typeBuilder.build();
}
Also used : Definitions(org.camunda.bpm.model.cmmn.instance.Definitions) SequenceBuilder(org.camunda.bpm.model.xml.type.child.SequenceBuilder) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)

Aggregations

Definitions (org.camunda.bpm.model.cmmn.instance.Definitions)9 Case (org.camunda.bpm.model.cmmn.instance.Case)5 CasePlanModel (org.camunda.bpm.model.cmmn.instance.CasePlanModel)4 Test (org.junit.Test)3 CaseDefinitionEntity (org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity)2 TaskDefinition (org.camunda.bpm.engine.impl.task.TaskDefinition)2 HumanTask (org.camunda.bpm.model.cmmn.instance.HumanTask)2 Before (org.junit.Before)2 CmmnHandlerContext (org.camunda.bpm.engine.impl.cmmn.handler.CmmnHandlerContext)1 DefaultCmmnElementHandlerRegistry (org.camunda.bpm.engine.impl.cmmn.handler.DefaultCmmnElementHandlerRegistry)1 CmmnCaseDefinition (org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition)1 CmmnTransform (org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransform)1 CmmnTransformer (org.camunda.bpm.engine.impl.cmmn.transformer.CmmnTransformer)1 ExpressionManager (org.camunda.bpm.engine.impl.el.ExpressionManager)1 DeploymentEntity (org.camunda.bpm.engine.impl.persistence.entity.DeploymentEntity)1 Deployment (org.camunda.bpm.engine.repository.Deployment)1 CmmnModelInstance (org.camunda.bpm.model.cmmn.CmmnModelInstance)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1 SequenceBuilder (org.camunda.bpm.model.xml.type.child.SequenceBuilder)1