Search in sources :

Example 1 with DataStore

use of org.activiti.bpmn.model.DataStore in project Activiti by Activiti.

the class DataStoreExport method writeDataStores.

public static void writeDataStores(BpmnModel model, XMLStreamWriter xtw) throws Exception {
    for (DataStore dataStore : model.getDataStores().values()) {
        xtw.writeStartElement(ELEMENT_DATA_STORE);
        xtw.writeAttribute(ATTRIBUTE_ID, dataStore.getId());
        xtw.writeAttribute(ATTRIBUTE_NAME, dataStore.getName());
        if (StringUtils.isNotEmpty(dataStore.getItemSubjectRef())) {
            xtw.writeAttribute(ATTRIBUTE_ITEM_SUBJECT_REF, dataStore.getItemSubjectRef());
        }
        if (StringUtils.isNotEmpty(dataStore.getDataState())) {
            xtw.writeStartElement(ELEMENT_DATA_STATE);
            xtw.writeCharacters(dataStore.getDataState());
            xtw.writeEndElement();
        }
        xtw.writeEndElement();
    }
}
Also used : DataStore(org.activiti.bpmn.model.DataStore)

Example 2 with DataStore

use of org.activiti.bpmn.model.DataStore in project Activiti by Activiti.

the class DataStoreConverterTest method validateModel.

private void validateModel(BpmnModel model) {
    assertEquals(1, model.getDataStores().size());
    DataStore dataStore = model.getDataStore("DataStore_1");
    assertNotNull(dataStore);
    assertEquals("DataStore_1", dataStore.getId());
    assertEquals("test", dataStore.getDataState());
    assertEquals("Test Database", dataStore.getName());
    assertEquals("test", dataStore.getItemSubjectRef());
    FlowElement refElement = model.getFlowElement("DataStoreReference_1");
    assertNotNull(refElement);
    assertTrue(refElement instanceof DataStoreReference);
    assertEquals(1, model.getPools().size());
    Pool pool = model.getPools().get(0);
    assertEquals("pool1", pool.getId());
}
Also used : DataStoreReference(org.activiti.bpmn.model.DataStoreReference) FlowElement(org.activiti.bpmn.model.FlowElement) DataStore(org.activiti.bpmn.model.DataStore) Pool(org.activiti.bpmn.model.Pool)

Example 3 with DataStore

use of org.activiti.bpmn.model.DataStore in project Activiti by Activiti.

the class DataStoreParser method parse.

public void parse(XMLStreamReader xtr, BpmnModel model) throws Exception {
    String id = xtr.getAttributeValue(null, ATTRIBUTE_ID);
    if (StringUtils.isNotEmpty(id)) {
        DataStore dataStore = new DataStore();
        dataStore.setId(xtr.getAttributeValue(null, ATTRIBUTE_ID));
        String name = xtr.getAttributeValue(null, ATTRIBUTE_NAME);
        if (StringUtils.isNotEmpty(name)) {
            dataStore.setName(name);
        }
        String itemSubjectRef = xtr.getAttributeValue(null, ATTRIBUTE_ITEM_SUBJECT_REF);
        if (StringUtils.isNotEmpty(itemSubjectRef)) {
            dataStore.setItemSubjectRef(itemSubjectRef);
        }
        BpmnXMLUtil.addXMLLocation(dataStore, xtr);
        model.addDataStore(dataStore.getId(), dataStore);
        BpmnXMLUtil.parseChildElements(ELEMENT_DATA_STORE, dataStore, xtr, model);
    }
}
Also used : DataStore(org.activiti.bpmn.model.DataStore)

Example 4 with DataStore

use of org.activiti.bpmn.model.DataStore in project Activiti by Activiti.

the class MessageFlowConverterTest method validateModel.

private void validateModel(BpmnModel model) {
    assertEquals(1, model.getDataStores().size());
    DataStore dataStore = model.getDataStore("DATASTORE_1");
    assertNotNull(dataStore);
    assertEquals("DATASTORE_1", dataStore.getId());
    assertEquals("test", dataStore.getName());
    assertEquals("ITEM_1", dataStore.getItemSubjectRef());
    MessageFlow messageFlow = model.getMessageFlow("MESSAGEFLOW_1");
    assertNotNull(messageFlow);
    assertEquals("test 1", messageFlow.getName());
    assertEquals("task1", messageFlow.getSourceRef());
    assertEquals("task2", messageFlow.getTargetRef());
    messageFlow = model.getMessageFlow("MESSAGEFLOW_2");
    assertNotNull(messageFlow);
    assertEquals("test 2", messageFlow.getName());
    assertEquals("task2", messageFlow.getSourceRef());
    assertEquals("task3", messageFlow.getTargetRef());
    assertEquals(2, model.getPools().size());
    Pool pool = model.getPools().get(0);
    assertEquals("participant1", pool.getId());
    assertEquals("Participant 1", pool.getName());
    assertEquals("PROCESS_1", pool.getProcessRef());
    pool = model.getPools().get(1);
    assertEquals("participant2", pool.getId());
    assertEquals("Participant 2", pool.getName());
    assertEquals("PROCESS_2", pool.getProcessRef());
}
Also used : DataStore(org.activiti.bpmn.model.DataStore) Pool(org.activiti.bpmn.model.Pool) MessageFlow(org.activiti.bpmn.model.MessageFlow)

Aggregations

DataStore (org.activiti.bpmn.model.DataStore)4 Pool (org.activiti.bpmn.model.Pool)2 DataStoreReference (org.activiti.bpmn.model.DataStoreReference)1 FlowElement (org.activiti.bpmn.model.FlowElement)1 MessageFlow (org.activiti.bpmn.model.MessageFlow)1