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

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


        return doUpdateWorkflowInstance(wInst);
    }

    public synchronized boolean setWorkflowInstanceCurrentTaskEndDateTime(
            String wInstId, String endDateTimeIsoStr) {
        WorkflowInstance wInst = null;
        try {
            wInst = this.engine.getInstanceRepository()
                    .getWorkflowInstanceById(wInstId);
        } catch (InstanceRepositoryException e) {
            e.printStackTrace();
            return false;
        }
        wInst.setCurrentTaskEndDateTimeIsoStr(endDateTimeIsoStr);
        return doUpdateWorkflowInstance(wInst);
    }
View Full Code Here


    private WorkflowCondition testCond;
   
    private static final int defaultPgSz = 20;

    public TestLuceneWorkflowInstanceRepository() {
        testInst = new WorkflowInstance();
        testWkflw = new Workflow();
        testTask = new WorkflowTask();
        testCond = new WorkflowCondition();

        // check to see if catalog path exists: (it may b/c
        // the user may run many unit tests)
        // if it exists, blow it away
        if (new File(catalogPath).exists()) {
            try {
                FileUtils.deleteDirectory(new File(catalogPath));
            } catch (IOException e) {
                fail(e.getMessage());
            }
        }
        repo = new LuceneWorkflowInstanceRepository(catalogPath, defaultPgSz);
        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

        return doUpdateWorkflowInstance(wInst);
    }

    public synchronized boolean updateWorkflowInstanceStatus(
            String workflowInstanceId, String status) throws Exception {
        WorkflowInstance wInst = null;
        try {
            wInst = engine.getInstanceRepository().getWorkflowInstanceById(
                    workflowInstanceId);
        } catch (Exception e) {
            e.printStackTrace();
            throw e;
        }

        wInst.setStatus(status);
        return doUpdateWorkflowInstance(wInst);
    }
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

    }

    private void populateWorkflows(List wInsts) {
        if (wInsts != null && wInsts.size() > 0) {
            for (Iterator i = wInsts.iterator(); i.hasNext();) {
                WorkflowInstance wInst = (WorkflowInstance) i.next();
                wInst.setWorkflow(safeGetWorkflowById(wInst.getWorkflow()
                        .getId()));
            }
        }
    }
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

        return workflowInstance;
    }

    public static WorkflowInstance getWorkflowInstanceFromXmlRpc(
            Hashtable workflowInstance) {
        WorkflowInstance wInst = new WorkflowInstance();
        wInst
                .setCurrentTaskId((String) workflowInstance
                        .get("current_task_id"));
        wInst.setStatus((String) workflowInstance.get("status"));
        wInst.setId((String) workflowInstance.get("id"));
        wInst.setWorkflow(getWorkflowFromXmlRpc((Hashtable) workflowInstance
                .get("workflow")));
        wInst.setStartDateTimeIsoStr((String) workflowInstance
                .get("start_date_time"));
        wInst.setEndDateTimeIsoStr((String) workflowInstance
                .get("end_date_time"));
        wInst.setCurrentTaskStartDateTimeIsoStr((String) workflowInstance
                .get("current_task_start_date_time"));
        wInst.setCurrentTaskEndDateTimeIsoStr((String) workflowInstance
                .get("current_task_end_date_time"));
        if (workflowInstance.get("sharedContext") != null) {
            Metadata met = new Metadata();
            met.addMetadata((Hashtable) workflowInstance.get("sharedContext"));
            wInst.setSharedContext(met);
        } else
            wInst.setSharedContext(new Metadata());

        return wInst;
    }
View Full Code Here

        List wInsts = new Vector();

        if (instsVector != null && instsVector.size() > 0) {
            for (Iterator i = instsVector.iterator(); i.hasNext();) {
                Hashtable wInstHash = (Hashtable) i.next();
                WorkflowInstance inst = getWorkflowInstanceFromXmlRpc(wInstHash);
                wInsts.add(inst);
            }
        }

        return wInsts;
View Full Code Here

    public static Vector getXmlRpcWorkflowInstances(List wInsts) {
        Vector instsVector = new Vector();

        if (wInsts != null && wInsts.size() > 0) {
            for (Iterator i = wInsts.iterator(); i.hasNext();) {
                WorkflowInstance inst = (WorkflowInstance) i.next();
                instsVector.add(getXmlRpcWorkflowInstance(inst));
            }
        }

        return instsVector;
View Full Code Here

        if (wInstIds != null && wInstIds.size() > 0) {
            List workflowInstances = new Vector(wInstIds.size());

            for (Iterator i = wInstIds.iterator(); i.hasNext();) {
                String workflowInstId = (String) i.next();
                WorkflowInstance inst = getWorkflowInstanceById(workflowInstId);
                workflowInstances.add(inst);
            }

            retPage.setPageWorkflows(workflowInstances);
        }
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.