Examples of Definitions


Examples of org.jbpm.bpmn2.core.Definitions

  }

  public Object end(final String uri, final String localName,
                final ExtensibleXmlParser parser) throws SAXException {
    final Element element = parser.endElementBuilder();
    Definitions definitions = (Definitions) parser.getCurrent();
        String namespace = element.getAttribute("targetNamespace");
        List<Process> processes = ((ProcessBuildData) parser.getData()).getProcesses();
        for (Process process : processes) {
            RuleFlowProcess ruleFlowProcess = (RuleFlowProcess)process;
            ruleFlowProcess.setMetaData("TargetNamespace", namespace);
        }
        definitions.setTargetNamespace(namespace);
        return definitions;
  }
View Full Code Here

Examples of org.jbpm.bpmn2.core.Definitions

     
      visitEscalations(process.getNodes(), xmlDump, new ArrayList<String>());
      visitErrors(process.getNodes(), xmlDump, new ArrayList<String>());
        
      //data stores
      Definitions def = (Definitions) process.getMetaData().get("Definitions");
      if (def != null && def.getDataStores() != null) {
        for (DataStore dataStore : def.getDataStores()) {
          visitDataStore(dataStore, xmlDump);
        }
      }
     
      // the process itself
    xmlDump.append("  <process processType=\"Private\" isExecutable=\"true\" ");
        if (process.getId() != null) {
            xmlDump.append("id=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(process.getId()) + "\" ");
        }
        if (process.getName() != null) {
            xmlDump.append("name=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(process.getName()) + "\" ");
        }
        String packageName = process.getPackageName();
        if (packageName != null && !"org.drools.bpmn2".equals(packageName)) {
            xmlDump.append("tns:packageName=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(packageName) + "\" ");
        }
        if (((org.jbpm.workflow.core.WorkflowProcess) process).isDynamic()) {
          xmlDump.append("tns:adHoc=\"true\" ");
        }
        String version = process.getVersion();
        if (version != null && !"".equals(version)) {
            xmlDump.append("tns:version=\"" + XmlBPMNProcessDumper.replaceIllegalCharsAttribute(version) + "\" ");
        }
        // TODO: package, version
        xmlDump.append(">" + EOL + EOL);
        visitHeader(process, xmlDump, metaDataType);
        visitNodes(process, xmlDump, metaDataType);
        visitConnections(process.getNodes(), xmlDump, metaDataType);
        if (def != null && def.getAssociations() != null) {
          for (Association association : def.getAssociations()) {
            visitAssociation(association, xmlDump);
          }
        }
        xmlDump.append("  </process>" + EOL + EOL);
        if (metaDataType == META_DATA_USING_DI) {
View Full Code Here

Examples of org.jbpm.bpmn2.core.Definitions

        dataType = new ObjectDataType(itemDefinition.getStructureRef());
      }
    }
    store.setType(dataType);
   
    Definitions parent = (Definitions) parser.getParent();
    List<DataStore> dataStores = parent.getDataStores();
    if (dataStores == null) {
      dataStores = new ArrayList<DataStore>();
      parent.setDataStores(dataStores);
    }
    dataStores.add(store);
    return store;
  }
View Full Code Here

Examples of org.jbpm.bpmn2.core.Definitions

    public void testDataStore() throws Exception {
        KnowledgeBase kbase = createKnowledgeBase("BPMN2-DataStore.xml");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        ProcessInstance processInstance = ksession.startProcess("Evaluation");
        Definitions def = (Definitions) processInstance.getProcess().getMetaData().get("Definitions");
        assertNotNull(def.getDataStores());
        assertTrue(def.getDataStores().size() == 1);
        DataStore dataStore = def.getDataStores().get(0);
        assertEquals("employee", dataStore.getId());
        assertEquals("employeeStore", dataStore.getName());
        assertEquals(String.class.getCanonicalName(), ((ObjectDataType) dataStore.getType()).getClassName());
    }
View Full Code Here

Examples of org.jbpm.bpmn2.core.Definitions

    public void testAssociation() throws Exception {
      KnowledgeBase kbase = createKnowledgeBase("BPMN2-Association.xml");
    StatefulKnowledgeSession ksession = createKnowledgeSession(kbase);
        ProcessInstance processInstance = ksession.startProcess("Evaluation");
        Definitions def = (Definitions) processInstance.getProcess().getMetaData().get("Definitions");
        assertNotNull(def.getAssociations());
        assertTrue(def.getAssociations().size() == 1);
        Association assoc = def.getAssociations().get(0);
        assertEquals("_1234", assoc.getId());
        assertEquals("_1", assoc.getSourceRef());
        assertEquals("_2", assoc.getTargetRef());
    }
View Full Code Here

Examples of org.jbpm.bpmn2.core.Definitions

    association.setId(attrs.getValue("id"));
    association.setSourceRef(attrs.getValue("sourceRef"));
    association.setTargetRef(attrs.getValue("targetRef"));
   
    Process parent = (Process) parser.getParent();
    Definitions definitions = (Definitions)
      parent.getMetaData().get("Definitions");
   
    // FIXME for now associations are stored under the definitions node
    // we will move them under process and subprocesses when it becomes possible ?
    List<Association> associations = definitions.getAssociations();
    if (associations == null) {
      associations = new ArrayList<Association>();
      definitions.setAssociations(associations);
    }
    associations.add(association);
   
    return association;
  }
View Full Code Here

Examples of org.jibx.ws.wsdl.model.Definitions

    private Definitions buildWSDL(ServiceCustom service, Map ptypemap, Map classelems, Map elemschemas, Map classtypes,
        Map typeschemas) {
       
        // initialize root object of definition
        String wns = service.getWsdlNamespace();
        Definitions def = new Definitions(service.getPortTypeName(), service.getBindingName(), service.getServiceName(),
            service.getPortName(), "tns", wns);
        def.setServiceLocation(service.getServiceAddress());
       
        // add service documentation if available
        IClassLocator locator = m_generationParameters.getLocator();
        IClass info = locator.getClassInfo(service.getClassName());
        if (info != null) {
            List nodes = m_generationParameters.getWsdlCustom().getFormatter(service).docToNodes(info.getJavaDoc());
            def.setPortTypeDocumentation(nodes);
        }
       
        // find or create the schema element and namespace
        String sns = service.getNamespace();
        SchemaHolder holder = m_schemaGenerator.findSchema(sns);
        SchemaElement schema = holder.getSchema();
       
        // process messages and operations used by service
        ArrayList ops = service.getOperations();
        Map fltmap = new HashMap();
        Set imports = new InsertionOrderedSet();
        Map typemap = new HashMap(ptypemap);
        for (int i = 0; i < ops.size(); i++) {
           
            // get information for operation
            OperationCustom odef = (OperationCustom)ops.get(i);
            String oname = odef.getOperationName();
            Operation op = new Operation(oname);
            op.setDocumentation(odef.getDocumentation());
            op.setSoapAction(odef.getSoapAction());
           
            // generate input message information
            Message rqmsg = new Message(odef.getRequestMessageName(), wns);
            op.addInputMessage(rqmsg);
            def.addMessage(rqmsg);
            QName rqelem = null;
            if (m_generationParameters.isDocLit()) {
               
                // check if input parameter defined for method
                ArrayList parms = odef.getParameters();
                if (parms.size() > 0) {
                   
                    // check for existing element definition matching the parameter type
                    ValueCustom parm = (ValueCustom)parms.get(0);
                    rqelem = (QName)classelems.get(parm.getWorkingType());
                    if (rqelem == null) {
                       
                        // create new element for parameter
                        ElementElement pelem = buildValueElement(parm, ptypemap, typeschemas, holder);
                        schema.getTopLevelChildren().add(pelem);
                        rqelem = pelem.getQName();
                       
                    } else {
                       
                        // import and use existing element definition
                        imports.add(elemschemas.get(rqelem));
                        addSchemaReference(rqelem, elemschemas, holder);
                       
                    }
                }
               
            } else {
               
                // construct a sequence for wrapped method parameters
                SequenceElement seq = new SequenceElement();
                ArrayList parms = odef.getParameters();
                for (int j = 0; j < parms.size(); j++) {
                    ValueCustom parm = (ValueCustom)parms.get(j);
                    String type = parm.getWorkingType();
                    ElementElement pelem;
                    if (!typemap.containsKey(type)) {
                       
                        // add predefined mapping type to known types and require schema import
                        QName tname = (QName)classtypes.get(type);
                        if (tname != null) {
                            typemap.put(type, tname);
                            imports.add(typeschemas.get(tname));
                        }
                       
                    }
                    pelem = buildValueElement(parm, ptypemap, typeschemas, holder);
                    seq.getParticleList().add(pelem);
                }
               
                // add corresponding schema definition to schema
                ComplexTypeElement tdef = new ComplexTypeElement();
                tdef.setContentDefinition(seq);
                ElementElement elem = new ElementElement();
                String wname = odef.getRequestWrapperName();
                elem.setName(wname);
                elem.setTypeDefinition(tdef);
                schema.getTopLevelChildren().add(elem);
                rqelem = new QName(sns, wname);
               
            }
           
            // add part definition to message (if present)
            if (rqelem != null) {
                MessagePart part = new MessagePart("part", rqelem);
                rqmsg.getParts().add(part);
                def.addNamespace(rqelem.getUri());
            }
           
            // generate output message information
            Message rsmsg = new Message(odef.getResponseMessageName(), wns);
            op.addOutputMessage(rsmsg);
            def.addMessage(rsmsg);
            ValueCustom rtrn = odef.getReturn();
            QName rselem = null;
            if (m_generationParameters.isDocLit()) {
               
                // check if return value defined for method
                if (!"void".equals(rtrn.getWorkingType())) {
                   
                    // check for existing element definition matching the return type
                    rselem = (QName)classelems.get(rtrn.getWorkingType());
                    if (rselem == null) {
                       
                        // create new element for return
                        ElementElement relem = buildValueElement(rtrn, ptypemap, typeschemas, holder);
                        schema.getTopLevelChildren().add(relem);
                        rselem = relem.getQName();
                       
                    } else {
                       
                        // import and use existing element definition
                        imports.add(elemschemas.get(rselem));
                        addSchemaReference(rqelem, elemschemas, holder);
                       
                    }
                }
               
            } else {
               
                // add corresponding schema definition to schema
                SequenceElement seq = new SequenceElement();
                if (!"void".equals(rtrn.getWorkingType())) {
                    ElementElement relem = buildValueElement(rtrn, ptypemap, typeschemas, holder);
                    seq.getParticleList().add(relem);
                }
                ComplexTypeElement tdef = new ComplexTypeElement();
                tdef.setContentDefinition(seq);
                ElementElement elem = new ElementElement();
                String wname = odef.getResponseWrapperName();
                elem.setName(wname);
                elem.setTypeDefinition(tdef);
                schema.getTopLevelChildren().add(elem);
                rselem = new QName(sns, wname);
               
            }
           
            // add part definition to message (if present)
            if (rselem != null) {
                MessagePart part = new MessagePart("part", rselem);
                rsmsg.getParts().add(part);
                def.addNamespace(rselem.getUri());
            }
           
            // process fault message(s) for operation
            ArrayList thrws = odef.getThrows();
            WsdlCustom wsdlcustom = m_generationParameters.getWsdlCustom();
            for (int j = 0; j < thrws.size(); j++) {
                ThrowsCustom thrw = (ThrowsCustom)thrws.get(j);
                String type = thrw.getType();
                Message fmsg = (Message)fltmap.get(type);
                if (fmsg == null) {
                   
                    // first time for this throwable, create the message
                    FaultCustom fault = wsdlcustom.forceFaultCustomization(type);
                    QName fqname = new QName(sns, fault.getElementName());
                    MessagePart part = new MessagePart("fault", fqname);
                    fmsg = new Message(fault.getFaultName(), wns);
                    fmsg.getParts().add(part);
                    def.addMessage(fmsg);
                    def.addNamespace(sns);
                   
                    // make sure the corresponding mapping exists
                    BindingMappingDetail detail = m_bindingGenerator.getMappingDetail(fault.getDataType());
                    if (detail == null) {
                        throw new IllegalStateException("No mapping found for type " + type);
                    }
                   
                    // record that the fault has been defined
                    fltmap.put(type, fmsg);
                }
               
                // add fault to operation definition
                op.addFaultMessage(fmsg);
            }
           
            // add operation to list of definitions
            def.addOperation(op);
           
        }
       
        // include embedded schema for message definitions only if needed
        if (holder.getReferences().size() > 0 || schema.getChildCount() > 0) {
            def.getSchemas().add(schema);
        }
        return def;
    }
View Full Code Here

Examples of org.jibx.ws.wsdl.model.Definitions

               
                // write the schemas and WSDLS
                SchemaGen.writeSchemas(parms.getGeneratePath(), inst.m_uriSchemaMap.values());
                WsdlWriter writer = new WsdlWriter();
                for (Iterator iter = wsdls.iterator(); iter.hasNext();) {
                    Definitions def = (Definitions)iter.next();
                    File file = new File(parms.getGeneratePath(), def.getServiceName() + ".wsdl");
                    writer.writeWSDL(def, new FileOutputStream(file));
                }
               
                // find existing schemas referenced (directly or indirectly) from WSDL schemas
                final Set needschemas = new HashSet();
                SchemaVisitor visitor = new SchemaVisitor() {
                   
                    private int m_existsDepth;
                   
                    public void exit(SchemaElement node) {
                        if (exists.contains(node)) {
                            m_existsDepth--;
                        }
                    }

                    public boolean visit(SchemaBase node) {
                        return false;
                    }

                    public boolean visit(SchemaElement node) {
                        if (exists.contains(node)) {
                            m_existsDepth++;
                        }
                        return true;
                    }

                    public boolean visit(SchemaLocationBase node) {
                        SchemaElement schema = node.getReferencedSchema();
                        if (needschemas.contains(schema)) {
                            return false;
                        } else {
                            if (m_existsDepth > 0 || exists.contains(schema)) {
                                needschemas.add(schema);
                            }
                            return true;
                        }
                    }
                   
                };
                for (int i = 0; i < wsdls.size(); i++) {
                    Definitions def = (Definitions)wsdls.get(i);
                    ArrayList schemas = def.getSchemas();
                    for (int j = 0; j < schemas.size(); j++) {
                        wlkr.walkChildren((SchemaBase)schemas.get(0), visitor);
                    }
                }
               
View Full Code Here

Examples of org.opensolaris.opengrok.analysis.Definitions

            try {
                Document doc = docs.get(ii);
                String filename = doc.get(QueryBuilder.PATH);

                Genre genre = Genre.get(doc.get(QueryBuilder.T));
                Definitions tags = null;
                IndexableField tagsField = doc.getField(QueryBuilder.TAGS);
                if (tagsField != null) {
                    tags = Definitions.deserialize(tagsField.binaryValue().bytes);
                }
                int nhits = docs.size();
View Full Code Here

Examples of org.watermint.sourcecolon.org.opensolaris.opengrok.analysis.Definitions

                out.write("\">");
                out.write(rpath.substring(rpath.lastIndexOf('/') + 1)); // htmlize ???
                out.write("</a></td><td>");
                if (sh.sourceContext != null) {
                    Genre genre = Genre.get(doc.get("t"));
                    Definitions tags = null;
                    Fieldable tagsField = doc.getFieldable("tags");
                    if (tagsField != null) {
                        tags = Definitions.deserialize(tagsField.getBinaryValue());
                    }
                    if (Genre.XREFABLE == genre && sh.summerizer != null) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.