Package de.danet.an.workflow.api

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


      return true;
  }
  String subFlowId = subFlowElem.getAttributeValue("Id");
  // check if this subflow is defined.
  if (!processMap.keySet().contains(subFlowId)) {
      eh.add (new PrioritizedMessage
        (PrioritizedMessage.Priority.ERROR,
         bundleBase + "#procdef.activity.subflow.notfound",
         new Object[] {activityId, subFlowId, processId}));
      return false;
  }
  // check if the formal params of the called process in the type of
  // OUT and INOUT reference the datafields or formal params in the
  // calling process.
  // find out all the actual parameters of the calling process.
  List actualParams = new ArrayList();
  Iterator actualParamsIt
      = actualParamsPath.selectNodes(subFlowElem).iterator();
  while(actualParamsIt.hasNext()) {
      String apm = ((Element)actualParamsIt.next()).getText();
      actualParams.add(apm);
  }
  // Map of id and its mode
  Map callerFpMap = new HashMap();
  List formalParamsList = formalParamsPath.selectNodes(process);
  Iterator formalParamsIt = formalParamsList.iterator();
  while (formalParamsIt.hasNext()) {
      Element fm = (Element)formalParamsIt.next();
      String fmId = fm.getAttributeValue("Id");
      callerFpMap.put(fmId, fm.getAttributeValue("Mode"));
  }
  // find out all the formal parameters of the called process.
  Element subFlowProc = (Element)processMap.get(subFlowId);
  List subFlowFormalParams = formalParamsPath.selectNodes(subFlowProc);
  if (subFlowFormalParams.size() != actualParams.size()){
      eh.add (new PrioritizedMessage
        (PrioritizedMessage.Priority.ERROR, bundleBase
         + "#procdef.activity.subflow.params.notmatched",
         new Object[] {activityId, subFlowId, processId}));
      return false;
  }
  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
            + "#procdef.subflow.params.invalidXML",
            new Object[]{subFlowId, actParam, activityId,
             processId, res}));
      return false;
View Full Code Here


          (dtb.getAttributeValue("Type")))) {
      return true;
        }
    }
      }
      eh.add (new PrioritizedMessage
        (PrioritizedMessage.Priority.ERROR,
         bundleBase + "#procdef.performer.notfound",
         new Object[]{performer, id, processId}));
  }
  return faultless;
View Full Code Here

      partiIdList.add (pd.getAttributeValue("Id"));
  }
  String duplicate = findDuplicate(partiIdList);
  if (duplicate != null) {
      String[] errdatas = {duplicate};
      eh.add (new PrioritizedMessage
        (PrioritizedMessage.Priority.ERROR,
         bundleBase + "#procdef.participant.ununique", errdatas));
  }
  return partiIdList;
    }
View Full Code Here

    String errKey1 = "#procdef.transition.activityid.notfound";
    if (isIncludedInActivitySet) {
        errKey1
      ="#procdef.activityset.transition.activityid.notfound";
    }
    eh.add (new PrioritizedMessage
      (PrioritizedMessage.Priority.ERROR,
       bundleBase + errKey1,
       new Object[]{errTransition, transitionId, processId,
              actSetElemId}));
      }
  }
  String duplicate = findDuplicate(transitionIds);
  String[] errdatas = {duplicate, processId, actSetElemId};
  if (duplicate != null) {
      faultless = false;
      String errKey = "#procdef.transition.ununique";
      if (isIncludedInActivitySet) {
    errKey = "#procdef.activityset.transition.ununique";
      }
      eh.add (new PrioritizedMessage
        (PrioritizedMessage.Priority.ERROR,
         bundleBase + errKey, errdatas));
  }
  int activityCount = activityIds.size();
  // Validate loop activities
  if (activityCount > 0) {
      activityIds.removeAll(transitionTos);
      if (activityIds.size() == 0) {
    faultless = false;
    eh.add (new PrioritizedMessage
      (PrioritizedMessage.Priority.WARN,
       bundleBase +"#procdef.transition.noentry", errdatas));
      }
  }
  return faultless;
View Full Code Here

      validateApplDef(eh, appIdList, appl, null);
  }
  String duplicate = findDuplicate(appIdList);
  if (duplicate != null) {
      String[] errdatas = {duplicate};
      eh.add (new PrioritizedMessage
        (PrioritizedMessage.Priority.ERROR,
         bundleBase + "#procdef.application.ununique",
         errdatas));
  }

  // process level definitons
  List processes = processes(doc);
  for (Iterator i = processes.iterator(); i.hasNext();) {
      Element proc = (Element)i.next();
      String procId = proc.getAttributeValue("Id");
            // some versions of jaxen return an immutable list
      List procApplList = new ArrayList(procApplPath.selectNodes(proc));
      procApplList.addAll(applList);
      appIdList = new ArrayList();
      for (Iterator itr = procApplList.iterator(); itr.hasNext();) {
    Element appl = (Element)itr.next();
    validateApplDef(eh, appIdList, appl, procId);
      }
      duplicate = findDuplicate(appIdList);
      if (duplicate != null) {
    String[] errdatas = {duplicate};
    eh.add (new PrioritizedMessage
      (PrioritizedMessage.Priority.ERROR,
       bundleBase + "#procdef.application.ununique",
       errdatas));
      }
  }
View Full Code Here

    private void validateApplDef (CollectingErrorHandler eh, List appIdList,
                                  Element appl, String procId)
        throws JaxenException {
        String tac = toolAgentClassPath.stringValueOf(appl);
        if (tac == null || tac.length() == 0) {
            eh.add (new PrioritizedMessage
                    (PrioritizedMessage.Priority.ERROR, bundleBase
                            + "#procdef.application.toolAgentClass",
                            new String[] { appl.getAttributeValue("Id") }));
        }
        try {
            ApplicationDefinition ad = new ApplicationDefinition ();
            subtreeToSAX (appl, ad.saxInitializer());
            applicationDefs.put
                (procId == null
                 ? (Object)ad.id() : new PSK (procId, ad.id()), ad);
            appIdList.add (ad.id());
            List indexedParams = indexedParamsPath.selectNodes (appl);
            if (indexedParams.size () > 0) {
                String[] errdatas = {ad.id()};
                eh.add (new PrioritizedMessage
                        (PrioritizedMessage.Priority.WARN, bundleBase
                                + "#procdef.application.indexedParameter",
                                new String[] { ad.id() }));
            }
        } catch (IllegalArgumentException ex) {
            eh.add (new PrioritizedMessage
                    (PrioritizedMessage.Priority.ERROR, ex.getMessage()));
        }
    }
View Full Code Here

    if (val == null) {
        val = extendedAttr.getTextTrim();
    }
    if (!val.equals("AUTOMATIC") && !val.equals("MANUAL")
                    && !val.equals("COMPLETED")) {
        eh.add (new PrioritizedMessage
          (PrioritizedMessage.Priority.ERROR,
           bundleBase
           + "#procdef.extendedattr.value.notallowed",
           new String[] { extendedAttrName, val }));
    }
      } else if (extendedAttrName.equals("AuditEventSelection")) {
    String val = extendedAttr.getAttributeValue("Value");
    if (val == null) {
        val = extendedAttr.getTextTrim();
    }
    if (!val.equals("AllEvents") && !val.equals("StateEventsOnly")
        && !val.equals("ProcessClosedEventsOnly")
        && !val.equals("NoEvents")) {
        eh.add (new PrioritizedMessage
          (PrioritizedMessage.Priority.ERROR, bundleBase
           + "#procdef.extendedattr.value.notallowed",
           new String[] { extendedAttrName, val }));
    }
    if (process == null) {
        eh.add (new PrioritizedMessage
          (PrioritizedMessage.Priority.WARN,
           bundleBase + "#package.nonstandard.auditing"));
    } else {
        eh.add (new PrioritizedMessage
          (PrioritizedMessage.Priority.WARN,
           bundleBase + "#process.nonstandard.auditing",
           new String[] { process.getAttributeValue("Id") }));
    }
      } else if (extendedAttrName.equals("StoreAuditEvents")) {
    String val = extendedAttr.getAttributeValue("Value");
    if (val == null) {
        val = extendedAttr.getTextTrim();
    }
    if (!val.equalsIgnoreCase("true")) {
        if (process == null) {
      eh.add (new PrioritizedMessage
        (PrioritizedMessage.Priority.WARN,
         bundleBase + "#package.nonstandard.logging"));
        } else {
      eh.add (new PrioritizedMessage
        (PrioritizedMessage.Priority.WARN,
         bundleBase + "#process.nonstandard.logging",
         new String[]
         { process.getAttributeValue("Id") }));
        }
View Full Code Here

      }
      ExtExecutionObjectLocal.Priority.fromInt
    (Integer.parseInt(priorityStr.trim()));
  } catch (Exception e) {
      String[] errdatas = {errorText, priorityStr, processId};
      eh.add (new PrioritizedMessage
    (PrioritizedMessage.Priority.ERROR,
     bundleBase + "#" + errorKey, errdatas));
  }
    }
View Full Code Here

      try {
    procdataMap.put
        (id, new ProcData
         (XPDLUtil.extractValue (dte, ve), dte));
      } catch (IllegalArgumentException e) {
    eh.add (new PrioritizedMessage
      (PrioritizedMessage.Priority.ERROR,
       bundleBase + "#procdef.data.cannotInit",
       new Object[] { id, e.getMessage () }));
    continue;
      }
View Full Code Here

  String type = script.getAttributeValue("Type");
  String version = script.getAttributeValue("Version");
  if (version == null) {
      if (!type.equals(javascript) && !type.equals(ecmascript)) {
    String[] errdatas = {type};
    eh.add (new PrioritizedMessage
         (PrioritizedMessage.Priority.ERROR, bundleBase
          + "#package.script.type.unsupported", errdatas));
      }
      return;
  } else {
      if ((type.equals(javascript) && (version.equals(jsversion)))
    || (type.equals(ecmascript) && (version.equals(esversion)))) {
    return;
      } else {
    String[] errdts = {type, version};
    eh.add (new PrioritizedMessage
         (PrioritizedMessage.Priority.ERROR, bundleBase
          + "#package.script.version.unsupported", errdts));
      }
  }
    }
View Full Code Here

TOP

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

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.