use of org.activiti.engine.impl.bpmn.data.StructureDefinition in project Activiti by Activiti.
the class BpmnParse method createItemDefinitions.
protected void createItemDefinitions() {
for (org.activiti.bpmn.model.ItemDefinition itemDefinitionElement : bpmnModel.getItemDefinitions().values()) {
StructureDefinition structure = null;
try {
// it is a class
Class<?> classStructure = ReflectUtil.loadClass(itemDefinitionElement.getStructureRef());
structure = new ClassStructureDefinition(classStructure);
} catch (ActivitiException e) {
// it is a reference to a different structure
structure = this.structures.get(itemDefinitionElement.getStructureRef());
}
ItemDefinition itemDefinition = new ItemDefinition(itemDefinitionElement.getId(), structure);
if (StringUtils.isNotEmpty(itemDefinitionElement.getItemKind())) {
itemDefinition.setItemKind(ItemKind.valueOf(itemDefinitionElement.getItemKind()));
}
itemDefinitions.put(itemDefinition.getId(), itemDefinition);
}
}
use of org.activiti.engine.impl.bpmn.data.StructureDefinition in project Activiti by Activiti.
the class WSDLImporterTest method testImportCounterWithImport.
@Test
public void testImportCounterWithImport() throws Exception {
URL url = ReflectUtil.getResource("org/activiti/engine/impl/webservice/counterWithImport.wsdl");
importer.importFrom(url.toString());
List<WSService> services = new ArrayList<WSService>(importer.getServices());
assertEquals(1, services.size());
WSService service = services.get(0);
assertEquals("Counter", service.getName());
assertEquals("http://localhost:63081/webservicemock", service.getLocation());
List<StructureDefinition> structures = sortStructures();
List<WSOperation> operations = sortOperations();
assertEquals(7, operations.size());
this.assertOperation(operations.get(0), "getCount", service);
this.assertOperation(operations.get(1), "inc", service);
this.assertOperation(operations.get(2), "noNameResult", service);
this.assertOperation(operations.get(3), "prettyPrintCount", service);
this.assertOperation(operations.get(4), "reservedWordAsName", service);
this.assertOperation(operations.get(5), "reset", service);
this.assertOperation(operations.get(6), "setTo", service);
assertEquals(14, structures.size());
this.assertStructure(structures.get(0), "getCount", new String[] {}, new Class<?>[] {});
this.assertStructure(structures.get(1), "getCountResponse", new String[] { "count" }, new Class<?>[] { Integer.class });
this.assertStructure(structures.get(2), "inc", new String[] {}, new Class<?>[] {});
this.assertStructure(structures.get(3), "incResponse", new String[] {}, new Class<?>[] {});
this.assertStructure(structures.get(4), "noNameResult", new String[] { "prefix", "suffix" }, new Class<?>[] { String.class, String.class });
this.assertStructure(structures.get(5), "noNameResultResponse", new String[] { "return" }, new Class<?>[] { String.class });
this.assertStructure(structures.get(6), "prettyPrintCount", new String[] { "prefix", "suffix" }, new Class<?>[] { String.class, String.class });
this.assertStructure(structures.get(7), "prettyPrintCountResponse", new String[] { "prettyPrint" }, new Class<?>[] { String.class });
this.assertStructure(structures.get(8), "reservedWordAsName", new String[] { "prefix", "suffix" }, new Class<?>[] { String.class, String.class });
this.assertStructure(structures.get(9), "reservedWordAsNameResponse", new String[] { "static" }, new Class<?>[] { String.class });
this.assertStructure(structures.get(10), "reset", new String[] {}, new Class<?>[] {});
this.assertStructure(structures.get(11), "resetResponse", new String[] {}, new Class<?>[] {});
this.assertStructure(structures.get(12), "setTo", new String[] { "value" }, new Class<?>[] { Integer.class });
this.assertStructure(structures.get(13), "setToResponse", new String[] {}, new Class<?>[] {});
}
use of org.activiti.engine.impl.bpmn.data.StructureDefinition in project Activiti by Activiti.
the class WSDLImporterTest method testImportInheritedElement.
@Test
public void testImportInheritedElement() throws Exception {
URL url = ReflectUtil.getResource("org/activiti/engine/impl/webservice/inherited-elements-in-types.wsdl");
assertNotNull(url);
importer.importFrom(url.toString());
List<StructureDefinition> structures = sortStructures();
assertEquals(1, structures.size());
final Object structureTypeInst = ReflectUtil.instantiate("org.activiti.webservice.counter.StructureType");
final Class<? extends Object> structureType = structureTypeInst.getClass();
this.assertStructure(structures.get(0), "inheritedRequest", new String[] { "rootElt", "inheritedElt", "newSimpleElt", "newStructuredElt" }, new Class<?>[] { Short.class, Integer.class, String.class, structureType });
assertEquals(2, structureType.getDeclaredFields().length);
assertNotNull(structureType.getDeclaredField("booleanElt"));
assertNotNull(structureType.getDeclaredField("dateElt"));
assertEquals(1, structureType.getSuperclass().getDeclaredFields().length);
assertNotNull(structureType.getSuperclass().getDeclaredField("rootElt"));
}
use of org.activiti.engine.impl.bpmn.data.StructureDefinition in project Activiti by Activiti.
the class WSDLImporterTest method testImportCounter.
@Test
public void testImportCounter() throws Exception {
URL url = ReflectUtil.getResource("org/activiti/engine/impl/webservice/counter.wsdl");
importer.importFrom(url.toString());
List<WSService> services = new ArrayList<WSService>(importer.getServices());
assertEquals(1, services.size());
WSService service = services.get(0);
assertEquals("Counter", service.getName());
assertEquals("http://localhost:63081/webservicemock", service.getLocation());
List<StructureDefinition> structures = sortStructures();
List<WSOperation> operations = sortOperations();
assertEquals(7, operations.size());
this.assertOperation(operations.get(0), "getCount", service);
this.assertOperation(operations.get(1), "inc", service);
this.assertOperation(operations.get(2), "noNameResult", service);
this.assertOperation(operations.get(3), "prettyPrintCount", service);
this.assertOperation(operations.get(4), "reservedWordAsName", service);
this.assertOperation(operations.get(5), "reset", service);
this.assertOperation(operations.get(6), "setTo", service);
assertEquals(14, structures.size());
this.assertStructure(structures.get(0), "getCount", new String[] {}, new Class<?>[] {});
this.assertStructure(structures.get(1), "getCountResponse", new String[] { "count" }, new Class<?>[] { Integer.class });
this.assertStructure(structures.get(2), "inc", new String[] {}, new Class<?>[] {});
this.assertStructure(structures.get(3), "incResponse", new String[] {}, new Class<?>[] {});
this.assertStructure(structures.get(4), "noNameResult", new String[] { "prefix", "suffix" }, new Class<?>[] { String.class, String.class });
this.assertStructure(structures.get(5), "noNameResultResponse", new String[] { "return" }, new Class<?>[] { String.class });
this.assertStructure(structures.get(6), "prettyPrintCount", new String[] { "prefix", "suffix" }, new Class<?>[] { String.class, String.class });
this.assertStructure(structures.get(7), "prettyPrintCountResponse", new String[] { "prettyPrint" }, new Class<?>[] { String.class });
this.assertStructure(structures.get(8), "reservedWordAsName", new String[] { "prefix", "suffix" }, new Class<?>[] { String.class, String.class });
this.assertStructure(structures.get(9), "reservedWordAsNameResponse", new String[] { "static" }, new Class<?>[] { String.class });
this.assertStructure(structures.get(10), "reset", new String[] {}, new Class<?>[] {});
this.assertStructure(structures.get(11), "resetResponse", new String[] {}, new Class<?>[] {});
this.assertStructure(structures.get(12), "setTo", new String[] { "value" }, new Class<?>[] { Integer.class });
this.assertStructure(structures.get(13), "setToResponse", new String[] {}, new Class<?>[] {});
}
use of org.activiti.engine.impl.bpmn.data.StructureDefinition in project Activiti by Activiti.
the class CxfWSDLImporter method importStructure.
protected void importStructure(Mapping mapping) {
QName qname = mapping.getElement();
final JType type = mapping.getType().getTypeClass();
if (type.isPrimitive()) {
final Class<?> primitiveClass = ReflectUtil.loadClass(type.boxify().fullName());
final StructureDefinition structure = new PrimitiveStructureDefinition(this.namespace + qname.getLocalPart(), primitiveClass);
this.structures.put(structure.getId(), structure);
} else if (type instanceof JDefinedClass) {
JDefinedClass theClass = (JDefinedClass) type;
SimpleStructureDefinition structure = new SimpleStructureDefinition(this.namespace + qname.getLocalPart());
this.structures.put(structure.getId(), structure);
importFields(theClass, structure);
} else {
final Class<?> referencedClass = ReflectUtil.loadClass(type.fullName());
final StructureDefinition structure = new PrimitiveStructureDefinition(this.namespace + qname.getLocalPart(), referencedClass);
this.structures.put(structure.getId(), structure);
}
}
Aggregations