Search in sources :

Example 1 with Event

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

the class EventImpl method registerType.

public static void registerType(ModelBuilder modelBuilder) {
    ModelElementTypeBuilder typeBuilder = modelBuilder.defineType(Event.class, CMMN_ELEMENT_EVENT).namespaceUri(CMMN10_NS).extendsType(PlanItemDefinition.class).instanceProvider(new ModelTypeInstanceProvider<Event>() {

        public Event newInstance(ModelTypeInstanceContext instanceContext) {
            return new EventImpl(instanceContext);
        }
    });
    typeBuilder.build();
}
Also used : PlanItemDefinition(org.camunda.bpm.model.cmmn.instance.PlanItemDefinition) ModelElementTypeBuilder(org.camunda.bpm.model.xml.type.ModelElementTypeBuilder) Event(org.camunda.bpm.model.cmmn.instance.Event) ModelTypeInstanceContext(org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)

Example 2 with Event

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

the class Cmmn10Test method shouldNotAbleToAddCmmn10Element.

@Test
public void shouldNotAbleToAddCmmn10Element() {
    CmmnModelInstance modelInstance = Cmmn.readModelFromStream(Cmmn10Test.class.getResourceAsStream("Cmmn11Test.cmmn"));
    CasePlanModel casePlanModel = modelInstance.getModelElementsByType(CasePlanModel.class).iterator().next();
    Event event = modelInstance.newInstance(Event.class);
    casePlanModel.getPlanItemDefinitions().add(event);
    try {
        Cmmn.writeModelToStream(System.out, modelInstance);
        fail("cannot save cmmn 1.1 model");
    } catch (Exception e) {
    // expected exception
    }
}
Also used : CasePlanModel(org.camunda.bpm.model.cmmn.instance.CasePlanModel) TimerEvent(org.camunda.bpm.model.cmmn.instance.TimerEvent) Event(org.camunda.bpm.model.cmmn.instance.Event) UserEvent(org.camunda.bpm.model.cmmn.instance.UserEvent) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance) Test(org.junit.Test)

Example 3 with Event

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

the class Cmmn10Test method shouldGetEvents.

@Test
public void shouldGetEvents() {
    CmmnModelInstance modelInstance = getCmmnModelInstance();
    Event event = modelInstance.getModelElementsByType(Event.class).iterator().next();
    assertThat(event).isNotNull();
    UserEvent userEvent = modelInstance.getModelElementsByType(UserEvent.class).iterator().next();
    assertThat(userEvent).isNotNull();
    TimerEvent timerEvent = modelInstance.getModelElementsByType(TimerEvent.class).iterator().next();
    assertThat(timerEvent).isNotNull();
}
Also used : TimerEvent(org.camunda.bpm.model.cmmn.instance.TimerEvent) Event(org.camunda.bpm.model.cmmn.instance.Event) UserEvent(org.camunda.bpm.model.cmmn.instance.UserEvent) TimerEvent(org.camunda.bpm.model.cmmn.instance.TimerEvent) CmmnModelInstance(org.camunda.bpm.model.cmmn.CmmnModelInstance) UserEvent(org.camunda.bpm.model.cmmn.instance.UserEvent) Test(org.junit.Test)

Aggregations

Event (org.camunda.bpm.model.cmmn.instance.Event)3 CmmnModelInstance (org.camunda.bpm.model.cmmn.CmmnModelInstance)2 TimerEvent (org.camunda.bpm.model.cmmn.instance.TimerEvent)2 UserEvent (org.camunda.bpm.model.cmmn.instance.UserEvent)2 Test (org.junit.Test)2 CasePlanModel (org.camunda.bpm.model.cmmn.instance.CasePlanModel)1 PlanItemDefinition (org.camunda.bpm.model.cmmn.instance.PlanItemDefinition)1 ModelTypeInstanceContext (org.camunda.bpm.model.xml.impl.instance.ModelTypeInstanceContext)1 ModelElementTypeBuilder (org.camunda.bpm.model.xml.type.ModelElementTypeBuilder)1