Package de.danet.an.workflow.api

Examples of de.danet.an.workflow.api.FormalParameter


     * @throws Exception
     *         Test failed.
     */
    public void testInvokeString() throws Exception {
        FormalParameter[] fps = new FormalParameter[5];
        fps[0] = new FormalParameter("JndiName", "0", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[1] = new FormalParameter("HomeClass", "1", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[2] = new FormalParameter("Method", "2", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[3] = new FormalParameter("Name", "3", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[4] = new FormalParameter("Result", "3", FormalParameter.Mode.OUT,
                FP_TYPE_STRING);
       
        Map act = new java.util.HashMap();
        act.put(fps[0].id(), "java:ejb/WfMOpenTestEJB");
        act.put(fps[1].id(), TestHome.class.getName());
View Full Code Here


     * @throws Exception
     *         Test failed.
     */
    public void testInvokeLong() throws Exception {
        FormalParameter[] fps = new FormalParameter[6];
        fps[0] = new FormalParameter("JndiName", "0", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[1] = new FormalParameter("HomeClass", "1", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[2] = new FormalParameter("Method", "2", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[3] = new FormalParameter("Num1", "3", FormalParameter.Mode.IN,
                FP_TYPE_INT);
        fps[4] = new FormalParameter("Num2", "4", FormalParameter.Mode.IN,
                FP_TYPE_INT);
        fps[5] = new FormalParameter("Result", "5", FormalParameter.Mode.OUT,
                FP_TYPE_INT);
       
        Map act = new java.util.HashMap();
        act.put(fps[0].id(), "java:ejb/WfMOpenTestEJB");
        act.put(fps[1].id(), TestHome.class.getName());
View Full Code Here

     * @throws Exception
     *         Test failed.
     */
    public void testInvokeDouble() throws Exception {
        FormalParameter[] fps = new FormalParameter[5];
        fps[0] = new FormalParameter("JndiName", "0", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[1] = new FormalParameter("HomeClass", "1", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[2] = new FormalParameter("Method", "2", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[3] = new FormalParameter("Value", "3", FormalParameter.Mode.IN,
                FP_TYPE_FLOAT);
        fps[4] = new FormalParameter("Result", "4", FormalParameter.Mode.OUT,
                FP_TYPE_INT);
       
        Map act = new java.util.HashMap();
        act.put(fps[0].id(), "java:ejb/WfMOpenTestEJB");
        act.put(fps[1].id(), TestHome.class.getName());
View Full Code Here

     * @throws Exception
     *         Test failed.
     */
    public void testInvokeXml() throws Exception {
        FormalParameter[] fps = new FormalParameter[5];
        fps[0] = new FormalParameter("JndiName", "0", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[1] = new FormalParameter("HomeClass", "1", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[2] = new FormalParameter("Method", "2", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[3] = new FormalParameter("Value", "3", FormalParameter.Mode.IN,
                FP_TYPE_SCHEMA_SAX);
        fps[4] = new FormalParameter("Result", "4", FormalParameter.Mode.OUT,
                FP_TYPE_INT);
       
        SAXEventBufferImpl sax = new SAXEventBufferImpl();
        sax.startDocument();
        AttributesImpl attrs = new AttributesImpl();
View Full Code Here

     * @throws Exception
     *         Test failed.
     */
    public void testInvokeBoolean() throws Exception {
        FormalParameter[] fps = new FormalParameter[5];
        fps[0] = new FormalParameter("JndiName", "0", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[1] = new FormalParameter("HomeClass", "1", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[2] = new FormalParameter("Method", "2", FormalParameter.Mode.IN,
                FP_TYPE_STRING);
        fps[3] = new FormalParameter("Value", "3", FormalParameter.Mode.IN,
                FP_TYPE_BOOL);
        fps[4] = new FormalParameter("Result", "4", FormalParameter.Mode.OUT,
                FP_TYPE_STRING);
       
        Map act = new java.util.HashMap();
        act.put(fps[0].id(), "java:ejb/WfMOpenTestEJB");
        act.put(fps[1].id(), TestHome.class.getName());
View Full Code Here

                Document doc = DocumentBuilderFactory.newInstance()
                    .newDocumentBuilder().newDocument();
                instance = doc.createElementNS("", "ActualParameters");
                instance.setAttributeNS(XMLUtil.XMLNS_NS, "xmlns", "");
                for (int i = 0; i < formalParameters.length; i++) {
                    FormalParameter fp = formalParameters[i];
                    Element param = doc.createElementNS("", "ActualParameter");
                    param.setAttribute("name", fp.id());
                    Object value = actualParameters.get(fp.id());
                    if (value == null) {
                        // do nothing
                    } else if (value instanceof SAXEventBuffer) {
                        appendActualParameter(param, (SAXEventBuffer)value);
                    } else {
View Full Code Here

            try {
                Document doc = DocumentBuilderFactory.newInstance()
                    .newDocumentBuilder().newDocument();
                binds = doc.createDocumentFragment();
                for (int i = 0; i < formalParameters.length; i++) {
                    FormalParameter fp = formalParameters[i];
                    Element binding
                        = doc.createElementNS(XMLUtil.XMLNS_XFORMS, "bind");
                    binding.setAttribute("id", applicationId + ":" + fp.id());
                    binding.setAttribute
                        ("nodeset", "ActualParameter[@name='" + fp.id() + "']");
                    if (fp.mode() == FormalParameter.Mode.IN) {
                        binding.setAttribute ("readonly", "true()");
                    }
                    if (fp.type().equals(Date.class)) {
                        binding.setAttribute ("type", "date");
                    }
                    binds.appendChild(binding);
                }
            } catch (ParserConfigurationException e) {
View Full Code Here

                || !((Element)child).getNodeName().equals("ActualParameter")) {
                continue;
            }
            Element param = (Element)child;
            String name = param.getAttribute("name");
            FormalParameter fp = null;
            for (int i = 0; i < formalParameters.length; i++) {
                if (formalParameters[i].id().equals(name)) {
                    fp = formalParameters[i];
                    break;
                }
            }
            if (fp == null || fp.mode().equals(FormalParameter.Mode.IN)) {
                continue;
            }
            if (XPDLUtil.isXMLType(fp.type())) {
                SAXEventBufferImpl saxVal = new SAXEventBufferImpl();
                try {
                    Transformer t
                        = SAXTransformerFactory.newInstance().newTransformer();
                    t.transform(new DOMSource(param),
                                new SAXResult(new ChildrenOnlyFiler(saxVal)));
                } catch (TransformerConfigurationException e) {
                    logger.error(e.getMessage(), e);
                } catch (TransformerFactoryConfigurationError e) {
                    logger.error(e.getMessage(), e);
                } catch (TransformerException e) {
                    logger.error(e.getMessage(), e);
                }
                res.put(fp.id(), saxVal);
            } else {
                StringBuffer content = new StringBuffer();
                for (Node pChild = param.getFirstChild(); pChild != null;
                     pChild = pChild.getNextSibling()) {
                    if (pChild.getNodeType() == Node.TEXT_NODE
                        || pChild.getNodeType() == Node.CDATA_SECTION_NODE) {
                        content.append(pChild.getNodeValue());
                    }
                }
                if (fp.type().equals(String.class)) {
                    res.put(fp.id(), content.toString());
                } else if (fp.type().equals(Boolean.class)) {
                    res.put(fp.id(), (new Boolean(content.toString())));
                } else if (fp.type().equals(Long.class)) {
                    res.put(fp.id(), Long.valueOf(content.toString()));
                } else if (fp.type().equals(Double.class)) {
                    res.put(fp.id(), Double.valueOf(content.toString()));
                } else if (fp.type().equals(Date.class)) {
                    // Convert date to datetime
                    if (content.indexOf("T") < 0) {
                        content.append("T00:00:00");
                    }
                    try {
                        res.put (fp.id(),
                                 XMLUtil.parseXsdDateTime(content.toString()));
                    } catch (ParseException e) {
                        logger.error ("Cannot parse XSD datetime: "
                                      + content.toString());
                    }
View Full Code Here

    }
    if (fpMode != FormalParameter.Mode.IN) {
        resultSignature.put (fpId, dtc);
    }
    contextSignature.put (fpId, dtc);
    fps.add (new FormalParameter
       (fpId, Integer.toString(fpIdx++), fpMode, dtc));
      } else if (loc.equals ("FormalParameters")) {
    formalParams = (FormalParameter[])
        fps.toArray(new FormalParameter[fps.size()]);
      }
View Full Code Here

  }
  int index = 0;
  for (Iterator formParamIter = subFlowFormalParams.iterator();
       formParamIter.hasNext(); index ++) {
      Element fpElem = (Element)formParamIter.next();
      FormalParameter fp = new FormalParameter
    (fpElem.getAttributeValue("Id"), Integer.toString(index),
     FormalParameter.Mode.fromString
     (fpElem.getAttributeValue("Mode")),
     XPDLUtil.extractDataType
     (fpElem.getChild("DataType", xpdlns)));
      String actParam = ((String)actualParams.get(index)).trim();
      if (callerFpMap.containsKey(actParam)) {
    // check the mode of the formal parameter of the calling
    // process
    String callerParamMode = (String)callerFpMap.get(actParam);
    if (callerParamMode.indexOf(fp.mode().toString()) == -1){
        eh.add (new PrioritizedMessage
          (PrioritizedMessage.Priority.ERROR, bundleBase
           + "#procdef.activity.subflow.parammode.notmatched",
           new Object [] {
        subFlowId, actParam, callerParamMode,
        fp.mode().toString(), activityId,
        processId}));
        return false;
    }
      }
      if (procdataMap.containsKey(actParam)) {
                boolean compat = true;
                if (fp.mode().equals(FormalParameter.Mode.IN)
                    || fp.mode().equals(FormalParameter.Mode.INOUT)) {
                    compat = typeCompatible
                        (fp.type(), XPDLUtil.extractDataType
                         (((ProcData)procdataMap.get(actParam)).dataType));
                }
                if (fp.mode().equals(FormalParameter.Mode.OUT)
                    || fp.mode().equals(FormalParameter.Mode.INOUT)) {
                    compat = compat && typeCompatible
                        (XPDLUtil.extractDataType
                         (((ProcData)procdataMap.get(actParam)).dataType),
                         fp.type());
                }
    if (!compat) {
        String[] errDatas = {subFlowId, activityId, processId};
        eh.add (new PrioritizedMessage
          (PrioritizedMessage.Priority.ERROR, bundleBase
           + "#procdef.activity.subflow"
           + ".paramdatatype.notmatched", errDatas));
        return false;
    }
      } else {
    if (fp.mode() != FormalParameter.Mode.IN) {
        eh.add
      (new PrioritizedMessage
       (PrioritizedMessage.Priority.ERROR, bundleBase
        + "#procdef.activity.subflow.datanotfound",
        new Object[] {subFlowId, actParam, activityId,
          processId}));
        return false;
    }
    if (XPDLUtil.isXMLType (fp.type())) {
        String res = notXMLOrValid (actParam);
        if (res != null) {
      eh.add
          (new PrioritizedMessage
           (PrioritizedMessage.Priority.ERROR, bundleBase
View Full Code Here

TOP

Related Classes of de.danet.an.workflow.api.FormalParameter

Copyright © 2018 www.massapicom. 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.