Search in sources :

Example 1 with Definitions

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

the class GenerateIdTest method shouldNotGenerateIdsOnRead.

@Test
public void shouldNotGenerateIdsOnRead() {
    CmmnModelInstance modelInstance = Cmmn.readModelFromStream(GenerateIdTest.class.getResourceAsStream("GenerateIdTest.cmmn"));
    Definitions definitions = modelInstance.getDefinitions();
    assertThat(definitions.getId()).isNull();
    Case caseElement = modelInstance.getModelElementsByType(Case.class).iterator().next();
    assertThat(caseElement.getId()).isNull();
    CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();
    assertThat(casePlanModel.getId()).isNull();
    HumanTask humanTask = modelInstance.getModelElementsByType(HumanTask.class).iterator().next();
    assertThat(humanTask.getId()).isNull();
}
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 2 with Definitions

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

the class CmmnTransform method transformCaseDefinitions.

protected void transformCaseDefinitions() {
    Definitions definitions = model.getDefinitions();
    Collection<Case> cases = definitions.getCases();
    for (Case currentCase : cases) {
        context.setCaseDefinition(null);
        context.setParent(null);
        CmmnCaseDefinition caseDefinition = transformCase(currentCase);
        caseDefinitions.add((CaseDefinitionEntity) caseDefinition);
    }
}
Also used : CmmnCaseDefinition(org.camunda.bpm.engine.impl.cmmn.model.CmmnCaseDefinition) Definitions(org.camunda.bpm.model.cmmn.instance.Definitions) Case(org.camunda.bpm.model.cmmn.instance.Case)

Example 3 with Definitions

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

the class CmmnTransform method transformRootElement.

protected void transformRootElement() {
    transformImports();
    transformCaseDefinitions();
    Definitions definitions = model.getDefinitions();
    for (CmmnTransformListener transformListener : transformListeners) {
        transformListener.transformRootElement(definitions, caseDefinitions);
    }
}
Also used : Definitions(org.camunda.bpm.model.cmmn.instance.Definitions)

Example 4 with Definitions

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

the class CaseHandler method initializeActivity.

protected void initializeActivity(Case element, CmmnActivity activity, CmmnHandlerContext context) {
    CaseDefinitionEntity definition = (CaseDefinitionEntity) activity;
    Deployment deployment = context.getDeployment();
    definition.setKey(element.getId());
    definition.setName(element.getName());
    definition.setDeploymentId(deployment.getId());
    definition.setTaskDefinitions(new HashMap<String, TaskDefinition>());
    definition.setHistoryTimeToLive(ParseUtil.parseHistoryTimeToLive(element.getCamundaHistoryTimeToLiveString()));
    CmmnModelInstance model = context.getModel();
    Definitions definitions = model.getDefinitions();
    String category = definitions.getTargetNamespace();
    definition.setCategory(category);
}
Also used : TaskDefinition(org.camunda.bpm.engine.impl.task.TaskDefinition) CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) Definitions(org.camunda.bpm.model.cmmn.instance.Definitions) Deployment(org.camunda.bpm.engine.repository.Deployment) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance)

Example 5 with Definitions

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

the class CmmnElementHandlerTest method setup.

@Before
public void setup() {
    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);
    context = new CmmnHandlerContext();
    CaseDefinitionEntity caseDefinition = new CaseDefinitionEntity();
    caseDefinition.setTaskDefinitions(new HashMap<String, TaskDefinition>());
    context.setCaseDefinition(caseDefinition);
    ExpressionManager expressionManager = new ExpressionManager();
    context.setExpressionManager(expressionManager);
}
Also used : ExpressionManager(org.camunda.bpm.engine.impl.el.ExpressionManager) TaskDefinition(org.camunda.bpm.engine.impl.task.TaskDefinition) CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) Definitions(org.camunda.bpm.model.cmmn.instance.Definitions) CmmnHandlerContext(org.camunda.bpm.engine.impl.cmmn.handler.CmmnHandlerContext) CaseDefinitionEntity(org.camunda.bpm.engine.impl.cmmn.entity.repository.CaseDefinitionEntity) Case(org.camunda.bpm.model.cmmn.instance.Case) Before(org.junit.Before)

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