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

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


        }

    }

    public Hashtable getFirstPage() {
        WorkflowInstancePage page = engine.getInstanceRepository()
                .getFirstPage();
        if (page != null) {
            populateWorkflows(page.getPageWorkflows());
            return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
        } else
            return XmlRpcStructFactory
                    .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
                            .blankPage());
View Full Code Here


    }

    public Hashtable getNextPage(Hashtable currentPage) {
        // first unpack current page
        WorkflowInstancePage currPage = XmlRpcStructFactory
                .getWorkflowInstancePageFromXmlRpc(currentPage);
        WorkflowInstancePage page = engine.getInstanceRepository().getNextPage(
                currPage);
        if (page != null) {
            populateWorkflows(page.getPageWorkflows());
            return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
        } else
            return XmlRpcStructFactory
                    .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
                            .blankPage());
View Full Code Here

                            .blankPage());
    }

    public Hashtable getPrevPage(Hashtable currentPage) {
        // first unpack current page
        WorkflowInstancePage currPage = XmlRpcStructFactory
                .getWorkflowInstancePageFromXmlRpc(currentPage);
        WorkflowInstancePage page = engine.getInstanceRepository().getPrevPage(
                currPage);
        if (page != null) {
            populateWorkflows(page.getPageWorkflows());
            return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
        } else
            return XmlRpcStructFactory
                    .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
                            .blankPage());
View Full Code Here

                    .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
                            .blankPage());
    }

    public Hashtable getLastPage() {
        WorkflowInstancePage page = engine.getInstanceRepository()
                .getLastPage();
        if (page != null) {
            populateWorkflows(page.getPageWorkflows());
            return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
        } else
            return XmlRpcStructFactory
                    .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
                            .blankPage());
View Full Code Here

                            .blankPage());
    }

    public Hashtable paginateWorkflowInstances(int pageNum, String status)
            throws InstanceRepositoryException {
        WorkflowInstancePage page = engine.getInstanceRepository()
                .getPagedWorkflows(pageNum, status);
        if (page != null) {
            populateWorkflows(page.getPageWorkflows());
            return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
        } else
            return XmlRpcStructFactory
                    .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
                            .blankPage());
View Full Code Here

    }

    public Hashtable paginateWorkflowInstances(int pageNum)
            throws InstanceRepositoryException {
        WorkflowInstancePage page = engine.getInstanceRepository()
                .getPagedWorkflows(pageNum);
        if (page != null) {
            populateWorkflows(page.getPageWorkflows());
            return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
        } else
            return XmlRpcStructFactory
                    .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
                            .blankPage());
View Full Code Here

        else if (operation.equals("--getFirstPage")) {
            XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
                    new URL(url));

            WorkflowInstancePage page = null;
            String status = null;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--status")) {
                    status = args[++i];
                }
            }

            try {
                if (status != null && !status.equals("")) {
                    page = client.paginateWorkflowInstances(1, status);
                } else {
                    page = client.getFirstPage();
                }

                System.out.println("Page: [num=" + page.getPageNum() + ","
                        + "pageSize=" + page.getPageSize() + ",totalPages="
                        + page.getTotalPages() + "]");
                if (page.getPageWorkflows() != null
                        && page.getPageWorkflows().size() > 0) {
                    for (Iterator i = page.getPageWorkflows().iterator(); i
                            .hasNext();) {
                        WorkflowInstance inst = (WorkflowInstance) i.next();
                        System.out
                                .println("Instance: [id="
                                        + inst.getId()
                                        + ", status="
                                        + inst.getStatus()
                                        + ", currentTask="
                                        + inst.getCurrentTaskId()
                                        + ", workflow="
                                        + inst.getWorkflow().getName()
                                        + ",wallClockTime="
                                        + client
                                                .getWorkflowWallClockMinutes(inst
                                                        .getId())
                                        + ",currentTaskWallClockTime="
                                        + client
                                                .getWorkflowCurrentTaskWallClockMinutes(inst
                                                        .getId()) + "]");
                    }
                }

            } catch (Exception e) {
                throw new RuntimeException(e);
            }

        } else if (operation.equals("--getLastPage")) {
            XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
                    new URL(url));

            WorkflowInstancePage page = null;
            String status = null;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--status")) {
                    status = args[++i];
                }
            }

            try {
                if (status != null && !status.equals("")) {
                    WorkflowInstancePage firstPage = client
                            .paginateWorkflowInstances(1, status);
                    page = client.paginateWorkflowInstances(firstPage
                            .getTotalPages(), status);
                } else {
                    page = client.getLastPage();
                }

                System.out.println("Page: [num=" + page.getPageNum() + ","
                        + "pageSize=" + page.getPageSize() + ",totalPages="
                        + page.getTotalPages() + "]");
                if (page.getPageWorkflows() != null
                        && page.getPageWorkflows().size() > 0) {
                    for (Iterator i = page.getPageWorkflows().iterator(); i
                            .hasNext();) {
                        WorkflowInstance inst = (WorkflowInstance) i.next();
                        System.out
                                .println("Instance: [id="
                                        + inst.getId()
                                        + ", status="
                                        + inst.getStatus()
                                        + ", currentTask="
                                        + inst.getCurrentTaskId()
                                        + ", workflow="
                                        + inst.getWorkflow().getName()
                                        + ",wallClockTime="
                                        + client
                                                .getWorkflowWallClockMinutes(inst
                                                        .getId())
                                        + ",currentTaskWallClockTime="
                                        + client
                                                .getWorkflowCurrentTaskWallClockMinutes(inst
                                                        .getId()) + "]");
                    }
                }

            } catch (Exception e) {
                throw new RuntimeException(e);
            }

        } else if (operation.equals("--getNextPage")) {
            XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
                    new URL(url));

            WorkflowInstancePage page = null;
            String status = null;
            int pageNum = -1;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--status")) {
                    status = args[++i];
                } else if (args[i].equals("--pageNum")) {
                    pageNum = Integer.parseInt(args[++i]);
                }
            }

            if (pageNum == -1) {
                System.err.println(getNextPageOperation);
                System.exit(1);
            }

            try {
                if (status != null && !status.equals("")) {
                    page = client
                            .paginateWorkflowInstances(pageNum + 1, status);
                } else {
                    page = client.paginateWorkflowInstances(pageNum + 1);
                }

                System.out.println("Page: [num=" + page.getPageNum() + ","
                        + "pageSize=" + page.getPageSize() + ",totalPages="
                        + page.getTotalPages() + "]");
                if (page.getPageWorkflows() != null
                        && page.getPageWorkflows().size() > 0) {
                    for (Iterator i = page.getPageWorkflows().iterator(); i
                            .hasNext();) {
                        WorkflowInstance inst = (WorkflowInstance) i.next();
                        System.out
                                .println("Instance: [id="
                                        + inst.getId()
                                        + ", status="
                                        + inst.getStatus()
                                        + ", currentTask="
                                        + inst.getCurrentTaskId()
                                        + ", workflow="
                                        + inst.getWorkflow().getName()
                                        + ",wallClockTime="
                                        + client
                                                .getWorkflowWallClockMinutes(inst
                                                        .getId())
                                        + ",currentTaskWallClockTime="
                                        + client
                                                .getWorkflowCurrentTaskWallClockMinutes(inst
                                                        .getId()) + "]");
                    }
                }

            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        } else if (operation.equals("--getPrevPage")) {
            XmlRpcWorkflowManagerClient client = new XmlRpcWorkflowManagerClient(
                    new URL(url));

            WorkflowInstancePage page = null;
            String status = null;
            int pageNum = -1;

            for (int i = 4; i < args.length; i++) {
                if (args[i].equals("--status")) {
                    status = args[++i];
                } else if (args[i].equals("--pageNum")) {
                    pageNum = Integer.parseInt(args[++i]);
                }
            }

            if (pageNum == -1) {
                System.err.println(getPrevPageOperation);
                System.exit(1);
            }

            try {
                if (status != null && !status.equals("")) {
                    page = client
                            .paginateWorkflowInstances(pageNum - 1, status);
                } else {
                    page = client.paginateWorkflowInstances(pageNum - 1);
                }

                System.out.println("Page: [num=" + page.getPageNum() + ","
                        + "pageSize=" + page.getPageSize() + ",totalPages="
                        + page.getTotalPages() + "]");
                if (page.getPageWorkflows() != null
                        && page.getPageWorkflows().size() > 0) {
                    for (Iterator i = page.getPageWorkflows().iterator(); i
                            .hasNext();) {
                        WorkflowInstance inst = (WorkflowInstance) i.next();
                        System.out
                                .println("Instance: [id="
                                        + inst.getId()
View Full Code Here

     * @return The {@link WorkflowInstancePage} that this XML-RPC
     *         {@link Hashtable} provided represents.
     */
    public static WorkflowInstancePage getWorkflowInstancePageFromXmlRpc(
            Hashtable pageHash) {
        WorkflowInstancePage page = new WorkflowInstancePage();
        page.setPageNum(Integer.parseInt((String) pageHash.get("pageNum")));
        page.setPageSize(Integer.parseInt((String) pageHash.get("pageSize")));
        page.setTotalPages(Integer
                .parseInt((String) pageHash.get("totalPages")));
        page.setPageWorkflows(getWorkflowInstancesFromXmlRpc((Vector) pageHash
                .get("pageWorkflows")));

        return page;

    }
View Full Code Here

     * (non-Javadoc)
     *
     * @see org.apache.oodt.cas.workflow.util.Pagination#getFirstPage()
     */
    public WorkflowInstancePage getFirstPage() {
        WorkflowInstancePage firstPage = null;

        try {
            firstPage = getPagedWorkflows(1);
        } catch (Exception e) {
            e.printStackTrace();
View Full Code Here

     * (non-Javadoc)
     *
     * @see org.apache.oodt.cas.workflow.util.Pagination#getLastPage()
     */
    public WorkflowInstancePage getLastPage() {
        WorkflowInstancePage lastPage = null;
        WorkflowInstancePage firstPage = getFirstPage();

        try {
            lastPage = getPagedWorkflows(firstPage.getTotalPages());
        } catch (Exception e) {
            LOG.log(Level.WARNING, "Exception getting last page: Message: "
                    + e.getMessage());
        }

View Full Code Here

TOP

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

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.