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

   * @param cond
   *          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());
    condition
        .setTimeoutSeconds(Long.valueOf(cond.get("timeout") != null ? (String) cond
            .get("timeout") : "-1"));
    condition.setOptional(Boolean.valueOf((String) cond.get("optional")));
    condition
        .setCondConfig(getWorkflowConditionConfigurationFromXmlRpc((Hashtable) cond
            .get("configuration")));
    return condition;
  }
View Full Code Here

    List conditions = new Vector();

    if (conds != null && conds.size() > 0) {
      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

  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

      rs = statement.executeQuery(getConditionsSql);
      conditions = new Vector();

      while (rs.next()) {
        // get an instance of the class name
        WorkflowCondition condition = DbStructFactory.getWorkflowCondition(rs,
            true);
        conditions.add(condition);
      }

      if (conditions.size() == 0) {
View Full Code Here

      rs = statement.executeQuery(getConditionsSql);
      conditions = new Vector();

      while (rs.next()) {
        // get an instance of the class name
        WorkflowCondition condition = DbStructFactory.getWorkflowCondition(rs,
            true);
        conditions.add(condition);
      }

      if (conditions.size() == 0) {
View Full Code Here

      throws RepositoryException {
    Connection conn = null;
    Statement statement = null;
    ResultSet rs = null;

    WorkflowCondition condition = null;

    try {
      conn = dataSource.getConnection();
      statement = conn.createStatement();

      String getConditionsSql = "SELECT * FROM workflow_conditions WHERE workflow_condition_id = "
          + conditionId;

      LOG.log(Level.FINE, "getWorkflowConditionById: Executing: "
          + getConditionsSql);
      rs = statement.executeQuery(getConditionsSql);

      while (rs.next()) {
        // get an instance of the class name
        condition = DbStructFactory.getWorkflowCondition(rs, false);
        condition.setCondConfig(getConfigurationByConditionId(conditionId));
      }

    } catch (Exception e) {
      e.printStackTrace();
      LOG.log(Level.WARNING,
View Full Code Here

      rs = statement.executeQuery(getConditionsSql);
      conditions = new Vector<WorkflowCondition>();

      while (rs.next()) {
        // get an instance of the class name
        WorkflowCondition condition = DbStructFactory.getWorkflowCondition(rs,
            true);
        conditions.add(condition);
      }

      if (conditions.size() == 0) {
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.