use of org.kie.workbench.common.dmn.api.definition.v1_1.Definitions in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testMarshallUserTaskAssignments.
@Test
public void testMarshallUserTaskAssignments() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_USERTASKASSIGNMENTS);
// JBPMBpmn2ResourceImpl resource = tested.marshallToBpmn2Resource(diagram);
String result = tested.marshall(diagram);
assertDiagram(result, 1, 7, 7);
DefinitionsConverter definitionsConverter = new DefinitionsConverter(diagram.getGraph());
Definitions definitions = definitionsConverter.toDefinitions();
assertNotNull(definitions);
Process process = getProcess(definitions);
assertNotNull(process);
org.eclipse.bpmn2.UserTask userTask = (org.eclipse.bpmn2.UserTask) getNamedFlowElement(process, org.eclipse.bpmn2.UserTask.class, "Self Evaluation");
assertNotNull(userTask);
DataInput dataInput = (DataInput) getDataInput(userTask, "reason");
// this fails because of type
validateDataInputOrOutput(dataInput, "_reasonInputX", "com.test.Reason", "_reasonInputXItem");
DataOutput dataOutput = (DataOutput) getDataOutput(userTask, "performance");
validateDataInputOrOutput(dataOutput, "_performanceOutputX", "Object", "_performanceOutputXItem");
ItemAwareElement sourceRef = getDataInputAssociationSourceRef(userTask, "reason");
assertNotNull(sourceRef);
ItemAwareElement targetRef = getDataInputAssociationTargetRef(userTask, "_reasonInputX");
assertNotNull(targetRef);
sourceRef = getDataOutputAssociationSourceRef(userTask, "_performanceOutputX");
assertNotNull(sourceRef);
targetRef = getDataOutputAssociationTargetRef(userTask, "performance");
assertNotNull(targetRef);
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Definitions in project kie-wb-common by kiegroup.
the class BPMNDirectDiagramMarshallerTest method testMarshallProcessProperties.
@Test
public void testMarshallProcessProperties() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_PROCESSPROPERTIES);
String result = tested.marshall(diagram);
assertDiagram(result, 1, 3, 2);
Definitions definitions = new DefinitionsConverter(diagram.getGraph()).toDefinitions();
assertNotNull(definitions);
Process process = getProcess(definitions);
assertNotNull(process);
assertEquals("JDLProj.BPSimple", process.getId());
assertEquals("BPSimple", process.getName());
assertTrue(process.isIsExecutable());
assertEquals("true", getProcessPropertyValue(process, "adHoc"));
assertEquals("org.jbpm", getProcessPropertyValue(process, "packageName"));
assertEquals("1.0", getProcessPropertyValue(process, "version"));
assertNotNull(process.getDocumentation());
assertFalse(process.getDocumentation().isEmpty());
assertEquals("<![CDATA[This is a\nsimple\nprocess]]>", process.getDocumentation().get(0).getText());
assertEquals("<![CDATA[This is the\nProcess\nInstance\nDescription]]>", getProcessExtensionValue(process, "customDescription"));
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Definitions in project kie-wb-common by kiegroup.
the class BPMNDiagramMarshallerTest method testMarshallProcessProperties.
@Test
public void testMarshallProcessProperties() throws Exception {
Diagram<Graph, Metadata> diagram = unmarshall(BPMN_PROCESSPROPERTIES);
JBPMBpmn2ResourceImpl resource = tested.marshallToBpmn2Resource(diagram);
String result = tested.marshall(diagram);
assertDiagram(result, 1, 3, 2);
Definitions definitions = (Definitions) resource.getContents().get(0);
assertNotNull(definitions);
Process process = getProcess(definitions);
assertNotNull(process);
assertEquals("JDLProj.BPSimple", process.getId());
assertEquals("BPSimple", process.getName());
assertTrue(process.isIsExecutable());
assertEquals("true", getProcessPropertyValue(process, "adHoc"));
assertEquals("org.jbpm", getProcessPropertyValue(process, "packageName"));
assertEquals("1.0", getProcessPropertyValue(process, "version"));
assertNotNull(process.getDocumentation());
assertFalse(process.getDocumentation().isEmpty());
assertEquals("<![CDATA[This is a\nsimple\nprocess]]>", process.getDocumentation().get(0).getText());
assertEquals("<![CDATA[This is the\nProcess\nInstance\nDescription]]>", getProcessExtensionValue(process, "customDescription"));
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Definitions in project kie-wb-common by kiegroup.
the class BPMNFormModelGeneratorImpl method generateTaskFormModels.
@Override
public List<TaskFormModel> generateTaskFormModels(Definitions source, Path path) {
Process process = getProcess(source);
final ClassLoader projectClassLoader = projectClassLoaderHelper.getModuleClassLoader(moduleService.resolveModule(path));
if (process != null) {
ProcessTaskFormsGenerationResult result = readUserTaskFormVariables(process);
return result.getAllTaskFormVariables().stream().filter(taskFormVariables -> {
if (!taskFormVariables.isValid()) {
logger.warn(generateErrorMessage(taskFormVariables));
return false;
}
return true;
}).map(taskFormVariables -> taskFormVariables.toFormModel(variable -> createModelProperty(variable, projectClassLoader))).collect(Collectors.toList());
}
return Collections.emptyList();
}
use of org.kie.workbench.common.dmn.api.definition.v1_1.Definitions in project kie-wb-common by kiegroup.
the class DefinitionsConverter method toDefinitions.
public Definitions toDefinitions() {
Definitions definitions = bpmn2.createDefinitions();
DefinitionsPropertyWriter p = propertyWriterFactory.of(definitions);
ProcessPropertyWriter pp = processConverter.convertProcess();
p.setProcess(pp.getProcess());
p.setDiagram(pp.getBpmnDiagram());
p.setRelationship(pp.getRelationship());
p.addAllRootElements(pp.getRootElements());
p.addAllRootElements(pp.getItemDefinitions());
return definitions;
}
Aggregations