Package de.danet.an.workflow.omgcore

Examples of de.danet.an.workflow.omgcore.ProcessDataInfo


      invalidData = true;   
  }
  data.put("packageIntegerData", new Integer("5"));

  proc.setProcessContext(data);
  ProcessDataInfo ctxInfo = mgr.contextSignature();
  // Fetch data to check modifications
  data = proc.processContext();
  assertTrue(((Long)data.get("packageIntegerData")).intValue() == 5);

  procDir.removeProcess(proc);
View Full Code Here


  if (!workflowState().equals (State.OPEN)) {
      throw new UpdateNotAllowedException
    ("Process is not in state open.");
  }
  // verify first to avoid partial change.
  ProcessDataInfo sig = getPaProcessDef().contextSignature ();
  for (Iterator i = newValues.keySet().iterator(); i.hasNext();) {
      String name = (String)i.next();
      Object type = sig.get (name);
      if (type == null) {
    throw new InvalidDataException ("No such data field: " + name);
      }
      Object v = newValues.get(name);
      if (v == null) {
    continue;
      }
            if ((type instanceof ExternalReference)
                && XPDLUtil.isJavaType((ExternalReference)type)) {
                Class vc = null;
                try {
                    vc = XPDLUtil.getJavaType((ExternalReference)type);
                } catch (ClassNotFoundException e) {
                    throw (InvalidDataException)
                        (new InvalidDataException
                         ("Required Java class no longer available: "
                          + e.getMessage())).initCause(e);
                }
                if (vc.isAssignableFrom(v.getClass())) {
                    continue;
                } else {
                    throw new InvalidDataException
                        ("Context entry " + name + " is "
                         + v.getClass().getName() + " must be instance of "
                         + vc.getName());
                }
            }
      if ((type instanceof SAXEventBuffer)
    || (type instanceof ExternalReference)
    || type.equals(org.w3c.dom.Element.class)) {
    boolean elemList = false;
    if (v instanceof List) {
        if (((List)v).size() == 0) {
      elemList = true;
        } else {
      Iterator ti = ((List)v).iterator ();
      if (ti.next() instanceof Element) {
          elemList = true;
      }
        }
    }
    if (! ((v instanceof Element)
           || (v instanceof Document)
           || elemList
           || (v instanceof org.w3c.dom.Element)
           || (v instanceof org.w3c.dom.DocumentFragment)
           || (v instanceof org.w3c.dom.Document)
           || (v instanceof SAXEventBuffer))) {
        throw new InvalidDataException
      ("Not a usable XML representation: " + name);
    }
    continue;
      }
      if (type instanceof Class) {
    Class vc = v.getClass();
    if (v instanceof Float) {
        vc = Double.class;
    } else if (v instanceof Integer) {
        vc = Long.class;
    }
    if (type == Participant.class) {
        type = String.class;
    }
    if (! ((Class)type).isAssignableFrom (vc)) {
        throw new InvalidDataException
      ("Values for data field \"" + name
       + "\" must be of type " + ((Class)type).getName ()
       + " (is " + v.getClass().getName () + ")");
    }
    continue;
      }
      throw new InvalidDataException
    ("Invalid type for data field \"" + name
     + "\": " + ((Class)type).getName ());
  }
  // now do changes
  DOMBuilder builder = null;
  ProcessData oldValues = new DefaultProcessData();
  for (Iterator i = (new ArrayList (newValues.keySet())).iterator();
       i.hasNext();) {
      String name = (String)i.next();
      oldValues.put(name, getPaProcessData().get(name));
      Object v = newValues.get(name);
            if (logger.isDebugEnabled ()) {
                logger.debug ("Setting context data item " + name + " = " + v);
            }
            Object type = sig.get (name);
            if ((type instanceof ExternalReference)
                && XPDLUtil.isJavaType((ExternalReference)type)) {
                // accept literally
            } else if (v instanceof Float) {
    v = new Double (((Float)v).doubleValue ());
View Full Code Here

     * are available.
     * @ejb.interface-method view-type="remote"
     */
    public ProcessData result ()
        throws ResultNotAvailableException {
        ProcessDataInfo resSig = processDefinition().resultSignature();
        ProcessData procCtx = getPaProcessData();
        ProcessData resData = new DefaultProcessData();
        for (Iterator i = resSig.keySet().iterator(); i.hasNext();) {
            String key = (String)i.next();
            resData.put(key, procCtx.get(key));
        }
  return resData;
    }
View Full Code Here

        Name nameAttribute = env.createName("name");
        complexType.addAttribute(nameAttribute, "ContextDataType");
        Name mixedAttribute = env.createName("mixed");
        complexType.addAttribute(mixedAttribute, "true");

        ProcessDataInfo context = pd.contextSignature();
        if (context.isEmpty()) {
            return;
        }

        SOAPElement sequence = complexType.addChildElement("sequence", "xsd");
        appendProcessDataInfoSchema(env, sequence, context);
View Full Code Here

        Name nameAttribute = env.createName("name");
        complexType.addAttribute(nameAttribute, "ResultDataType");
        Name mixedAttribute = env.createName("mixed");
        complexType.addAttribute(mixedAttribute, "true");

        ProcessDataInfo result = pd.resultSignature();
        if (result.isEmpty()) {
            return;
        }

        SOAPElement sequence = complexType.addChildElement("sequence", "xsd");
        appendProcessDataInfoSchema(env, sequence, result);
View Full Code Here

     * @throws ParseException
     */
    private ProcessData getProcessData(ProcessDefinition procdef,
            SOAPElement contextData) throws RemoteException, SOAPException,
            ParseException {
        ProcessDataInfo info = procdef.contextSignature();
        ProcessData procData = new DefaultProcessData();

        for (Iterator pdi = contextData.getChildElements(); pdi.hasNext();) {
            SOAPElement current = (SOAPElement) pdi.next();
            String pdname = current.getLocalName();
            Object type = info.get(pdname);
            if (type == null) {
                throw new SOAPException("process does not contain a variable "
                        + "with name " + pdname);
            }
            String pdvalue = XMLUtil.getFirstLevelTextContent(current);
View Full Code Here

TOP

Related Classes of de.danet.an.workflow.omgcore.ProcessDataInfo

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.