Package org.apache.oodt.cas.workflow.structs

Examples of org.apache.oodt.cas.workflow.structs.WorkflowCondition


        return null;
    }

    private boolean satisfied(List conditionList, String taskId) {
        for (Iterator i = conditionList.iterator(); i.hasNext();) {
            WorkflowCondition c = (WorkflowCondition) i.next();
            WorkflowConditionInstance cInst = null;

            // see if we've already cached this condition instance
            if (CONDITION_CACHE.get(taskId) != null) {
                HashMap conditionMap = (HashMap) CONDITION_CACHE.get(taskId);

                /*
                 * okay we have some conditions cached for this task, see if we
                 * have the one we need
                 */
                if (conditionMap.get(c.getConditionId()) != null) {
                    cInst = (WorkflowConditionInstance) conditionMap.get(c
                            .getConditionId());
                }
                /* if not, then go ahead and create it and cache it */
                else {
                    cInst = GenericWorkflowObjectFactory
                            .getConditionObjectFromClassName(c
                                    .getConditionInstanceClassName());
                    conditionMap.put(c.getConditionId(), cInst);
                }
            }
            /* no conditions cached yet, so set everything up */
            else {
                HashMap conditionMap = new HashMap();
                cInst = GenericWorkflowObjectFactory
                        .getConditionObjectFromClassName(c
                                .getConditionInstanceClassName());
                conditionMap.put(c.getConditionId(), cInst);
                CONDITION_CACHE.put(taskId, conditionMap);
            }

            // actually perform the evaluation
            if (!cInst.evaluate(workflowInst.getSharedContext(), c.getTaskConfig())) {
                return false;
            }
        }

        return true;
View Full Code Here


        if (conditions == null) {
            return wConditions;
        }

        for (Iterator i = conditions.iterator(); i.hasNext();) {
            WorkflowCondition c = (WorkflowCondition) i.next();
            Hashtable condition = getXmlRpcWorkflowCondition(c);
            wConditions.add(condition);
        }

        return wConditions;
View Full Code Here

     *            The Hashtable to turn into a real WorkflowCondition.
     * @return a {@link WorkflowCondition} from an XML-RPC {@link Hashtable}.
     */
    public static WorkflowCondition getWorkflowConditionFromXmlRpc(
            Hashtable cond) {
        WorkflowCondition condition = new WorkflowCondition();
        condition.setConditionInstanceClassName((String) cond.get("class"));
        condition.setConditionId((String) cond.get("id"));
        condition.setConditionName((String) cond.get("name"));
        condition.setOrder(Integer.valueOf((String) cond.get("order"))
                .intValue());
        return condition;
    }
View Full Code Here

    public static List getWorkflowConditionsFromXmlRpc(Vector conds) {
        List conditions = new Vector();

        for (Iterator i = conds.iterator(); i.hasNext();) {
            Hashtable cond = (Hashtable) i.next();
            WorkflowCondition condition = getWorkflowConditionFromXmlRpc(cond);
            conditions.add(condition);
        }

        return conditions;
    }
View Full Code Here

      String taskId = wInst.getCurrentTaskId();
      WorkflowTask task = getTaskById(wInst.getWorkflow(), taskId);
      List conditionList = task.getConditions();
     
        for (Iterator i = conditionList.iterator(); i.hasNext();) {
            WorkflowCondition c = (WorkflowCondition) i.next();
            WorkflowConditionInstance cInst = null;

            // see if we've already cached this condition instance
            if (engine.CONDITION_CACHE.get(taskId) != null) {
                HashMap conditionMap = (HashMap) engine.CONDITION_CACHE.get(taskId);

                /*
                 * okay we have some conditions cached for this task, see if we
                 * have the one we need
                 */
                if (conditionMap.get(c.getConditionId()) != null) {
                    cInst = (WorkflowConditionInstance) conditionMap.get(c
                            .getConditionId());
                }
                /* if not, then go ahead and create it and cache it */
                else {
                    cInst = GenericWorkflowObjectFactory
                            .getConditionObjectFromClassName(c
                                    .getConditionInstanceClassName());
                    conditionMap.put(c.getConditionId(), cInst);
                }
            }
            /* no conditions cached yet, so set everything up */
            else {
                HashMap conditionMap = new HashMap();
                cInst = GenericWorkflowObjectFactory
                        .getConditionObjectFromClassName(c
                                .getConditionInstanceClassName());
                conditionMap.put(c.getConditionId(), cInst);
                engine.CONDITION_CACHE.put(taskId, conditionMap);
            }

            // actually perform the evaluation
            if (!cInst.evaluate(wInst.getSharedContext(), c.getTaskConfig())) {
                return false;
            }
        }

        return true;
View Full Code Here

                        if (conditionElemList != null
                                && conditionElemList.getLength() > 0) {
                            for (int j = 0; j < conditionElemList.getLength(); j++) {
                                Element conditionElem = (Element) conditionElemList
                                        .item(j);
                                WorkflowCondition condition = XmlStructFactory
                                        .getWorkflowCondition(conditionElem);
                                if (condition != null) {
                                    conditionMap.put(
                                            condition.getConditionId(),
                                            condition);
                                }
                            }

                        }
View Full Code Here

  public static List copyConditions(List conditionList){
    if(conditionList != null){
      List newConditionList = new Vector(conditionList.size());
     
      for(Iterator i = conditionList.iterator(); i.hasNext(); ){
        WorkflowCondition c = (WorkflowCondition)i.next();
        WorkflowCondition newCondition = copyCondition(c);
        newConditionList.add(newCondition);
      }
     
      return newConditionList;
    }
View Full Code Here

    }
    else return null;
  }
 
  public static WorkflowCondition copyCondition(WorkflowCondition c){
    WorkflowCondition newCondition = new WorkflowCondition();
    newCondition.setConditionName(c.getConditionName());
    newCondition.setOrder(c.getOrder());
    newCondition.setConditionInstanceClassName(c.getConditionInstanceClassName());
    return newCondition;
  }
View Full Code Here

        return null;
    }

    private boolean satisfied(List conditionList, String taskId) {
        for (Iterator i = conditionList.iterator(); i.hasNext();) {
            WorkflowCondition c = (WorkflowCondition) i.next();
            WorkflowConditionInstance cInst = null;

            // see if we've already cached this condition instance
            if (CONDITION_CACHE.get(taskId) != null) {
                HashMap conditionMap = (HashMap) CONDITION_CACHE.get(taskId);

                /*
                 * okay we have some conditions cached for this task, see if we
                 * have the one we need
                 */
                if (conditionMap.get(c.getConditionId()) != null) {
                    cInst = (WorkflowConditionInstance) conditionMap.get(c
                            .getConditionId());
                }
                /* if not, then go ahead and create it and cache it */
                else {
                    cInst = GenericWorkflowObjectFactory
                            .getConditionObjectFromClassName(c
                                    .getConditionInstanceClassName());
                    conditionMap.put(c.getConditionId(), cInst);
                }
            }
            /* no conditions cached yet, so set everything up */
            else {
                HashMap conditionMap = new HashMap();
                cInst = GenericWorkflowObjectFactory
                        .getConditionObjectFromClassName(c
                                .getConditionInstanceClassName());
                conditionMap.put(c.getConditionId(), cInst);
                CONDITION_CACHE.put(taskId, conditionMap);
            }

            // actually perform the evaluation
            if (!cInst.evaluate(workflowInst.getSharedContext(), c.getTaskConfig())) {
                return false;
            }
        }

        return true;
View Full Code Here

    private void addConditionsToDoc(String taskId, List conditionList,
            Document doc) {
        if (conditionList != null && conditionList.size() > 0) {
            for (Iterator i = conditionList.iterator(); i.hasNext();) {
                WorkflowCondition cond = (WorkflowCondition) i.next();
                doc.add(new Field(taskId + "_condition_name", cond
                        .getConditionName(), Field.Store.YES, Field.Index.NO));
                doc.add(new Field(taskId + "_condition_id", cond
                        .getConditionId(), Field.Store.YES,
                        Field.Index.UN_TOKENIZED));
                doc.add(new Field(taskId + "_condition_class", cond
                        .getConditionInstanceClassName(), Field.Store.YES,
                        Field.Index.NO));
                doc.add(new Field(taskId + "_condition_order", String
                        .valueOf(cond.getOrder()), Field.Store.YES,
                        Field.Index.NO));
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.workflow.structs.WorkflowCondition

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.