Package org.apache.lenya.workflow

Examples of org.apache.lenya.workflow.Workflowable


            String event,
            boolean force) throws WorkflowException {
        WorkflowManager wfManager = null;
        try {
            wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);
            Workflowable workflowable = new DocumentWorkflowable(document, logger);
            wfManager.invoke(workflowable, event, force);
        } catch (ServiceException e) {
            throw new WorkflowException(e);
        } finally {
            if (wfManager != null) {
View Full Code Here


        try {
            wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);

            Document[] documents = documentSet.getDocuments();
            for (int i = 0; i < documents.length; i++) {
                Workflowable workflowable = new DocumentWorkflowable(documents[i], logger);
                wfManager.invoke(workflowable, event, force);
            }

        } catch (ServiceException e) {
            throw new WorkflowException(e);
View Full Code Here

    public static boolean canInvoke(ServiceManager manager, Logger logger, Document document, String event)
            throws WorkflowException {
        WorkflowManager wfManager = null;
        try {
            wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);
            Workflowable workflowable = new DocumentWorkflowable(document, logger);
            return wfManager.canInvoke(workflowable, event);
        } catch (ServiceException e) {
            throw new WorkflowException(e);
        } finally {
            if (wfManager != null) {
View Full Code Here

            wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);

            boolean canInvoke = true;
            Document[] documentArray = documents.getDocuments();
            for (int i = 0; i < documentArray.length; i++) {
                Workflowable workflowable = new DocumentWorkflowable(documentArray[i], logger);
                canInvoke = canInvoke && wfManager.canInvoke(workflowable, event);
            }
            return canInvoke;

        } catch (ServiceException e) {
View Full Code Here

    public static boolean hasWorkflow(ServiceManager manager, Logger logger, Document document)
            throws WorkflowException {
        WorkflowManager wfManager = null;
        try {
            wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);
            Workflowable workflowable = new DocumentWorkflowable(document, logger);
            return wfManager.hasWorkflow(workflowable);
        } catch (ServiceException e) {
            throw new WorkflowException(e);
        } finally {
            if (wfManager != null) {
View Full Code Here

                        .format(new Date(getSourceDocument().getLastModified()));
                setParameter(LASTMODIFIED, lastModified);
                boolean visible = doc.getLink().getNode().isVisible();
                setParameter(VISIBLE_IN_NAVIGATION, Boolean.valueOf(visible));

                Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager,
                        getSession(), getLogger(), doc);
                resolver = (WorkflowManager) this.manager.lookup(WorkflowManager.ROLE);
                if (resolver.hasWorkflow(workflowable)) {
                    Workflow workflow = resolver.getWorkflowSchema(workflowable);
                    String[] variableNames = workflow.getVariableNames();
                    Version latestVersion = workflowable.getLatestVersion();
                    Boolean isLive = null;
                    if (latestVersion != null) {
                        setParameter(STATE, latestVersion.getState());
                        if (Arrays.asList(variableNames).contains(WORKFLOW_VARIABLE_ISLIVE)) {
                            isLive = Boolean.valueOf(latestVersion
View Full Code Here

                Boolean canRollback = Boolean.valueOf(WorkflowUtil.canInvoke(this.manager,
                        getDocumentFactory().getSession(), getLogger(), sourceDoc, getEvent()));
                setParameter("canRollback", canRollback);

                if (WorkflowUtil.hasWorkflow(this.manager, getSession(), getLogger(), sourceDoc)) {
                    Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager,
                            getSession(), getLogger(), sourceDoc);
                    Version latestVersion = workflowable.getLatestVersion();
                    String state;
                    if (latestVersion != null) {
                        state = latestVersion.getState();
                    } else {
                        Workflow workflow = WorkflowUtil.getWorkflowSchema(this.manager,
View Full Code Here

 
    protected void doCheckPostconditions() throws Exception {
        super.doCheckPostconditions();

        Document doc = getTargetDocument(true);
        Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager, getSession(),
                getLogger(), doc);
        String state = workflowable.getLatestVersion().getState();
        if (!state.equals("authoring")) {
            addErrorMessage("The state is [" + state + "] instead of [authoring]!");
        }

    }
View Full Code Here

        for (int i = 0; i < sources.length; i++) {
            WorkflowUtil.invoke(this.manager, getSession(), getLogger(), sources[i], getEvent(),
                    true);
           
            if (this.getClass().getName().equals(Restore.class.getName())) {
                Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager, getSession(),
                        getLogger(), sources[i]);
                String state = workflowable.getLatestVersion().getState();
                if (!state.equals("authoring")) {
                    addErrorMessage("The state is [" + state + "] instead of [authoring]!");
                }
            }
           
View Full Code Here

TOP

Related Classes of org.apache.lenya.workflow.Workflowable

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.