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

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


     *
     * @see org.apache.oodt.cas.workflow.instrepo.WorkflowInstanceRepository#updateWorkflowInstance(org.apache.oodt.cas.workflow.structs.WorkflowInstance)
     */
    public synchronized void updateWorkflowInstance(WorkflowInstance wInst)
            throws InstanceRepositoryException {
        WorkflowInstance inst = (WorkflowInstance) workflowInstMap.get(wInst
                .getId());

        if (inst == null) {
            LOG
                    .log(
View Full Code Here


            throws InstanceRepositoryException {
        List instances = new Vector();

        for (Iterator i = workflowInstMap.keySet().iterator(); i.hasNext();) {
            String workflowInstId = (String) i.next();
            WorkflowInstance inst = (WorkflowInstance) workflowInstMap
                    .get(workflowInstId);
            if (inst.getStatus().equals(status)) {
                instances.add(inst);
            }
        }

        return instances;
View Full Code Here

        // first sort insts by startDateTime
        List allInsts = Arrays.asList(this.workflowInstMap.keySet().toArray());
        Collections.sort(allInsts, new Comparator() {

            public int compare(Object o1, Object o2) {
                WorkflowInstance inst1 = (WorkflowInstance) o1;
                WorkflowInstance inst2 = (WorkflowInstance) o2;

                return inst1.getStartDateTimeIsoStr().compareTo(
                        inst2.getStartDateTimeIsoStr());
            }

        });

        int startNum = (pageNum - 1) * pageSize;
        if (startNum > allInsts.size()) {
            startNum = 0;
        }

        List instIds = new Vector(pageSize);

        for (int i = startNum; i < Math.min(allInsts.size(),
                (startNum + pageSize)); i++) {
            WorkflowInstance wInst = (WorkflowInstance)allInsts.get(i);
            instIds.add(wInst.getId());
        }

        return instIds;
    }
View Full Code Here

                && this.workflowInstMap.keySet() != null
                && this.workflowInstMap.keySet().size() > 0) {
            for (Iterator i = this.workflowInstMap.keySet().iterator(); i
                    .hasNext();) {
                String wInstId = (String) i.next();
                WorkflowInstance inst = (WorkflowInstance) this.workflowInstMap
                        .get(wInstId);
                if (inst.getStatus().equals(status)) {
                    cnt++;
                }
            }
        }
View Full Code Here

   public WorkflowInstance getWorkflowInstanceById(String wInstId)
         throws Exception {
      lastMethodCallDetails = new MethodCallDetails(
            "getWorkflowInstanceById",
            Lists.newArrayList((Object) wInstId));
      WorkflowInstance wInst = new WorkflowInstance();
      wInst.setStatus("Running");
      wInst.setId("TestId");
      wInst.setWorkflow(workflowRepo.getWorkflowById(
            MockWorkflowRepository.WORKFLOW1_ID));
      wInst.setCurrentTaskId(MockWorkflowRepository.TASK1_ID);
      return wInst;
   }
View Full Code Here

  private static final int stdPgSz = 20;

  public TestXmlRpcWorkflowManagerClient() {

    testWrkInst = new WorkflowInstance();
    testWrkFlw = new Workflow();
    testTask = new WorkflowTask();
    testCond = new WorkflowCondition();
    Metadata sharedContext = new Metadata();
View Full Code Here

    }
    String testWrkInstId = testWrkInst.getId();
    assertNotNull(testWrkInstId);

    // get workflow instance from instance id
    WorkflowInstance WInst = null;
    try {
      WInst = repo.getWorkflowInstanceById(testWrkInstId);
    } catch (InstanceRepositoryException e) {
      fail(e.getMessage());
    }

    assertNotNull(WInst);

    // get Metadata for the workflow instance
    Metadata met = null;
    met = WInst.getSharedContext();
    assertNotNull(met);

    assertNotNull(met.getHashtable());
    assertEquals(2, met.getHashtable().keySet().size());
    assertNotNull(met.getAllMetadata("key1"));
View Full Code Here

    private WorkflowCondition testCond;
   
    private String tmpDirPath = null;

    public TestLuceneWorkflowInstanceRepository() {
        testInst = new WorkflowInstance();
        testWkflw = new Workflow();
        testTask = new WorkflowTask();
        testCond = new WorkflowCondition();
        testWkflw.setName("test.workflow");
        testWkflw.setId("test.id");
        List tasks = new Vector();
        List conds = new Vector();

        testCond.setConditionId("test.cond.id");
        testCond.setConditionInstanceClassName("test.class");
        testCond.setConditionName("test.cond.name");
        testCond.setOrder(1);
        conds.add(testCond);

        testTask.setTaskConfig(new WorkflowTaskConfiguration());
        testTask.setTaskId("test.task.id");
        testTask.setConditions(conds);
        testTask.setOrder(1);
        testTask.setTaskInstanceClassName("test.class");
        testTask.setTaskName("test.task.name");
        tasks.add(testTask);
        testWkflw.setTasks(tasks);

        testInst = new WorkflowInstance();
        testInst.setCurrentTaskId("test.task");
        testInst.setStatus(STARTED);
        testInst.setWorkflow(testWkflw);

        Metadata sharedContext = new Metadata();
View Full Code Here

        assertNotNull(wInsts);
        assertEquals(1, wInsts.size());

        // make sure that we can look up that workflow inst by its id
        WorkflowInstance foundInst = null;
        try {
            foundInst = repo.getWorkflowInstanceById(wInstId);
        } catch (InstanceRepositoryException e) {
            fail(e.getMessage());
        }

        assertNotNull(foundInst);
        assertEquals(foundInst.getId(), wInstId);
        assertNotNull(foundInst.getSharedContext());
        assertNotNull(foundInst.getSharedContext().getHashtable());
        assertEquals(2, foundInst.getSharedContext().getHashtable().keySet()
                .size());
        assertNotNull(foundInst.getSharedContext().getAllMetadata("TestKey1"));
        assertEquals(2, foundInst.getSharedContext().getAllMetadata("TestKey1")
                .size());

        boolean gotVal1 = false, gotVal2 = false;

        for (Iterator i = foundInst.getSharedContext().getAllMetadata(
                "TestKey1").iterator(); i.hasNext();) {
            String val = (String) i.next();
            if (val.equals("TestVal1")) {
                gotVal1 = true;
            } else if (val.equals("TestVal2")) {
                gotVal2 = true;
            }
        }

        assert (gotVal1 && gotVal2);

        assertNotNull(foundInst.getSharedContext().getMetadata("TestKey2"));
        assertEquals("TestVal3", foundInst.getSharedContext().getMetadata(
                "TestKey2"));
    }
View Full Code Here

            // this means that this workflow was killed, so
            // gracefully exit
            break;
          }

          WorkflowInstance updatedInst = null;
          try {
            updatedInst = instanceRepository
                .getWorkflowInstanceById(workflowInst.getId());
            workflowInst = updatedInst;
          } catch (InstanceRepositoryException e) {
View Full Code Here

TOP

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

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.