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

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


            List workflowTasks = new Vector(taskList.getLength());

            for (int i = 0; i < taskList.getLength(); i++) {
                Element taskElement = (Element) taskList.item(i);

                WorkflowTask t = (WorkflowTask) tasks.get(taskElement
                        .getAttribute("id"));

                if (t != null) {
                    WorkflowTask workflowTask = new WorkflowTask();
                    workflowTask.setTaskInstanceClassName(t
                            .getTaskInstanceClassName());
                    workflowTask.setConditions(t.getConditions());
                    workflowTask.setTaskId(t.getTaskId());
                    workflowTask.setTaskConfig(t.getTaskConfig());
                    workflowTask.setTaskName(t.getTaskName());
                    workflowTask.setOrder(i + 1);
                    workflowTask.setRequiredMetFields(t.getRequiredMetFields());
                    workflowTasks.add(workflowTask);
                }
            }
            workflow.setTasks(workflowTasks);
        }
View Full Code Here


     */
    public static WorkflowTask getWorkflowTask(Node node, HashMap conditions) {
        Element taskNode = (Element) node;

        String taskClassName = taskNode.getAttribute("class");
        WorkflowTask task = new WorkflowTask();
        task.setTaskInstanceClassName(taskClassName);

        task.setTaskId(taskNode.getAttribute("id"));
        task.setTaskName(taskNode.getAttribute("name"));

        // get the list of condition IDs for this task and then get the
        // conditions for them
        Element conditionRoot = getFirstElement("conditions", taskNode);
        if (conditionRoot != null) {
            NodeList conditionNodes = conditionRoot
                    .getElementsByTagName("condition");

            if (conditionNodes != null && conditionNodes.getLength() > 0) {
                List conditionList = new Vector(conditionNodes.getLength());

                for (int i = 0; i < conditionNodes.getLength(); i++) {
                    Element conditionNode = (Element) conditionNodes.item(i);
                    WorkflowCondition condition = (WorkflowCondition) conditions
                            .get(conditionNode.getAttribute("id"));

                    if (condition != null) {
                        WorkflowCondition workflowCondition = new WorkflowCondition();
                        workflowCondition
                                .setConditionInstanceClassName(condition
                                        .getConditionInstanceClassName());
                        workflowCondition.setConditionId(condition
                                .getConditionId());
                        workflowCondition.setConditionName(condition
                                .getConditionName());
                        workflowCondition.setOrder(i + 1);
                        workflowCondition.setCondConfig(condition.getTaskConfig());
                        conditionList.add(workflowCondition);
                    }
                }

                task.setConditions(conditionList);
            }

        }

        Element reqMetFieldsElem = getFirstElement("requiredMetFields",
                taskNode);
        if (reqMetFieldsElem != null) {
            task.setRequiredMetFields(getRequiredMetFields(reqMetFieldsElem));
        }

        // load its configuration
        Element configElement = getFirstElement("configuration", taskNode);
        if (configElement != null) {
            task.setTaskConfig(new WorkflowTaskConfiguration(getConfiguration(configElement)));
        }

        return task;
    }
View Full Code Here

     
      Vector workflowQueue = engine.getWorkflowQueue();
     
      for(int i=0;i<workflowQueue.size();i++){
        WorkflowInstance wInst = (WorkflowInstance)workflowQueue.get(i)
        WorkflowTask task = getTaskById(wInst.getWorkflow(),wInst.getCurrentTaskId());
     
        //check required metadata on current task
        if (!checkTaskRequiredMetadata(task, wInst.getSharedContext())) {
                  wInst.setStatus(METADATA_MISSING);
                  try{
                    engine.persistWorkflowInstance(wInst);
                  } catch (EngineException e){
                  }
                  break;
        }
       
        //check preconditions on current task
        if (task.getConditions() != null) {
                  if(!satisfied(wInst)) {

                      /*LOG.log(Level.FINEST, "Pre-conditions for task: "
                              + task.getTaskName() + " unsatisfied.");*/
                 
View Full Code Here

        return true;
    }
 
  private boolean satisfied(WorkflowInstance wInst) {
      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;
View Full Code Here

    public static WorkflowTask getWorkflowTask(ResultSet rs, boolean setOrder)
            throws SQLException {
        String taskClassName = rs.getString("workflow_task_class");

        if (taskClassName != null) {
            WorkflowTask task = new WorkflowTask();
            task.setTaskInstanceClassName(taskClassName);
            task.setTaskId(String.valueOf(rs.getInt("workflow_task_id")));
            task.setTaskName(rs.getString("workflow_task_name"));
            if (setOrder) {
                task.setOrder(rs.getInt("task_order"));
            }
            return task;
        } else
            return null;
    }
View Full Code Here

        return true;
    }

    private boolean satisfied(WorkflowInstance wInst) {
      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;
View Full Code Here

     * @see org.apache.oodt.cas.workflow.repository.WorkflowRepository#getConditionsByTaskName(java.lang.String)
     */
    public List getConditionsByTaskName(String taskName)
            throws RepositoryException {
        for (Iterator i = taskMap.values().iterator(); i.hasNext();) {
            WorkflowTask t = (WorkflowTask) i.next();
            if (t.getTaskName().equals(taskName)) {
                return t.getConditions();
            }
        }

        return null;
    }
View Full Code Here

     * (non-Javadoc)
     *
     * @see org.apache.oodt.cas.workflow.repository.WorkflowRepository#getConditionsByTaskId(java.lang.String)
     */
    public List getConditionsByTaskId(String taskId) throws RepositoryException {
        WorkflowTask t = (WorkflowTask) taskMap.get(taskId);
        if (t != null) {
            return t.getConditions();
        } else
            return null;
    }
View Full Code Here

     *
     * @see org.apache.oodt.cas.workflow.repository.WorkflowRepository#getConfigurationByTaskId(java.lang.String)
     */
    public WorkflowTaskConfiguration getConfigurationByTaskId(String taskId)
            throws RepositoryException {
        WorkflowTask task = (WorkflowTask) taskMap.get(taskId);
        return task.getTaskConfig();
    }
View Full Code Here

                        + w.getName() + "]");

                System.out.println("Tasks: ");

                for (Iterator j = w.getTasks().iterator(); j.hasNext();) {
                    WorkflowTask task = (WorkflowTask) j.next();

                    System.out.println("Task: [class="
                            + task.getTaskInstanceClassName() + ", id="
                            + task.getTaskId() + ", name=" + task.getTaskName()
                            + ", order=" + task.getOrder() + ",reqMetFields="
                            + task.getRequiredMetFields() + "]");
                    System.out.println("Configuration: ");

                    for (Iterator k = task.getTaskConfig().getProperties()
                            .keySet().iterator(); k.hasNext();) {
                        String key = (String) k.next();
                        String value = (String) task.getTaskConfig()
                                .getProperties().get(key);

                        System.out.println("[name=" + key + ", value=" + value
                                + "]");
                    }

                    System.out.println("Conditions: ");

                    for (Iterator k = task.getConditions().iterator(); k
                            .hasNext();) {
                        WorkflowCondition condition = (WorkflowCondition) k
                                .next();
                        System.out.println("Condition: ["
                                + condition.getClass().getName() + ", id="
View Full Code Here

TOP

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

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.