Search in sources :

Example 1 with SimpleStructureDefinition

use of org.activiti.engine.impl.bpmn.data.SimpleStructureDefinition in project Activiti by Activiti.

the class WSDLImporter method createDefaultStructures.

private void createDefaultStructures(Element rootTypes) {
    NodeList complexTypes = rootTypes.getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "complexType");
    for (int i = 0; i < complexTypes.getLength(); i++) {
        Element element = (Element) complexTypes.item(i);
        String structureName = this.namespace + element.getAttribute("name");
        SimpleStructureDefinition structure = new SimpleStructureDefinition(structureName);
        this.structures.put(structure.getId(), structure);
    }
}
Also used : SimpleStructureDefinition(org.activiti.engine.impl.bpmn.data.SimpleStructureDefinition) NodeList(org.w3c.dom.NodeList) Element(org.w3c.dom.Element)

Example 2 with SimpleStructureDefinition

use of org.activiti.engine.impl.bpmn.data.SimpleStructureDefinition in project Activiti by Activiti.

the class WSDLImporterTest method assertStructure.

private void assertStructure(StructureDefinition structure, String structureId, String[] parameters, Class<?>[] classes) {
    SimpleStructureDefinition simpleStructure = (SimpleStructureDefinition) structure;
    assertEquals(structureId, simpleStructure.getId());
    for (int i = 0; i < simpleStructure.getFieldSize(); i++) {
        assertEquals(parameters[i], simpleStructure.getFieldNameAt(i));
        assertEquals(classes[i], simpleStructure.getFieldTypeAt(i));
    }
}
Also used : SimpleStructureDefinition(org.activiti.engine.impl.bpmn.data.SimpleStructureDefinition)

Example 3 with SimpleStructureDefinition

use of org.activiti.engine.impl.bpmn.data.SimpleStructureDefinition 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);
    }
}
Also used : StructureDefinition(org.activiti.engine.impl.bpmn.data.StructureDefinition) SimpleStructureDefinition(org.activiti.engine.impl.bpmn.data.SimpleStructureDefinition) PrimitiveStructureDefinition(org.activiti.engine.impl.bpmn.data.PrimitiveStructureDefinition) JDefinedClass(com.sun.codemodel.JDefinedClass) SimpleStructureDefinition(org.activiti.engine.impl.bpmn.data.SimpleStructureDefinition) QName(javax.xml.namespace.QName) PrimitiveStructureDefinition(org.activiti.engine.impl.bpmn.data.PrimitiveStructureDefinition) JDefinedClass(com.sun.codemodel.JDefinedClass) JClass(com.sun.codemodel.JClass) JType(com.sun.codemodel.JType)

Example 4 with SimpleStructureDefinition

use of org.activiti.engine.impl.bpmn.data.SimpleStructureDefinition in project Activiti by Activiti.

the class WSDLImporter method importStructure.

private void importStructure(Mapping mapping) {
    QName qname = mapping.getElement();
    JDefinedClass theClass = (JDefinedClass) mapping.getType().getTypeClass();
    SimpleStructureDefinition structure = (SimpleStructureDefinition) this.structures.get(this.namespace + qname.getLocalPart());
    Map<String, JFieldVar> fields = theClass.fields();
    int index = 0;
    for (Entry<String, JFieldVar> entry : fields.entrySet()) {
        Class<?> fieldClass = ReflectUtil.loadClass(entry.getValue().type().boxify().fullName());
        structure.setFieldName(index, entry.getKey(), fieldClass);
        index++;
    }
}
Also used : JDefinedClass(com.sun.codemodel.JDefinedClass) SimpleStructureDefinition(org.activiti.engine.impl.bpmn.data.SimpleStructureDefinition) JFieldVar(com.sun.codemodel.JFieldVar) QName(javax.xml.namespace.QName)

Aggregations

SimpleStructureDefinition (org.activiti.engine.impl.bpmn.data.SimpleStructureDefinition)4 JDefinedClass (com.sun.codemodel.JDefinedClass)2 QName (javax.xml.namespace.QName)2 JClass (com.sun.codemodel.JClass)1 JFieldVar (com.sun.codemodel.JFieldVar)1 JType (com.sun.codemodel.JType)1 PrimitiveStructureDefinition (org.activiti.engine.impl.bpmn.data.PrimitiveStructureDefinition)1 StructureDefinition (org.activiti.engine.impl.bpmn.data.StructureDefinition)1 Element (org.w3c.dom.Element)1 NodeList (org.w3c.dom.NodeList)1