Package org.apache.lenya.workflow

Examples of org.apache.lenya.workflow.Workflow


     */
    public boolean canInvoke(Workflowable workflowable, String event) {
        boolean canInvoke = true;
        try {
            if (hasWorkflow(workflowable)) {
                Workflow workflow = getWorkflowSchema(workflowable);
                WorkflowEngine engine = new WorkflowEngineImpl();
                canInvoke = engine.canInvoke(workflowable, workflow, event);
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
View Full Code Here


    public String getState() throws WorkflowException {
        String state;
        if (getWorkflowable().getVersions().length > 0) {
            state = getWorkflowable().getLatestVersion().getState();
        } else {
            Workflow workflow = getWorkflowSchema();
            state = workflow.getInitialState();
        }
        return state;
    }
View Full Code Here

    public String[] getStates() throws WorkflowException {
        return getWorkflowSchema().getStates();
    }

    protected Workflow getWorkflowSchema() throws WorkflowException {
        Workflow workflow = WorkflowUtil.getWorkflowSchema(this.manager, this.session, getLogger(),
                this.document);
        return workflow;
    }
View Full Code Here

     * @throws WorkflowException if an error occurs.
     */
    public boolean getValue(String variable) throws WorkflowException {
        Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager, this.session, getLogger(), this.document);
        if (workflowable.getVersions().length == 0) {
            Workflow workflow = WorkflowUtil.getWorkflowSchema(this.manager, this.session, getLogger(), this.document);
            return workflow.getInitialValue(variable);
        }
        else {
            return workflowable.getLatestVersion().getValue(variable);
        }
    }
View Full Code Here

            if (hasWorkflow()) {
                Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager,
                        session,
                        getLogger(),
                        document);
                Workflow workflow = workflowManager.getWorkflowSchema(workflowable);
                String[] events = workflow.getEvents();
                for (int i = 0; i < events.length; i++) {
                    if (workflowManager.canInvoke(workflowable, events[i])) {
                        this.executableEvents.add(events[i]);
                    }
                }
View Full Code Here

            Version latestVersion = workflowable.getLatestVersion();
            String state;
            if (latestVersion != null) {
                state = latestVersion.getState();
            } else {
                Workflow workflow = WorkflowUtil.getWorkflowSchema(this.manager,
                        getSession(), getLogger(), doc);
                state = workflow.getInitialState();
            }
            entry.setValue(KEY_WORKFLOW_STATE, state);
        } else {
            entry.setValue(KEY_WORKFLOW_STATE, "");
        }
View Full Code Here

            DocumentWorkflowable workflowable = new DocumentWorkflowable(getSourceDocument(),
                    getLogger());
            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(ISLIVE)) {
                        isLive = Boolean.valueOf(latestVersion.getValue(ISLIVE));
                    }
                } else {
                    setParameter(STATE, workflow.getInitialState());
                    if (Arrays.asList(variableNames).contains(ISLIVE)) {
                        isLive = Boolean.valueOf(workflow.getInitialValue(ISLIVE));
                    }
                }
                setParameter(ISLIVE, isLive);
            } else {
                setParameter(STATE, "");
View Full Code Here

                }
            }

            if (hasWorkflow()) {
                DocumentWorkflowable workflowable = new DocumentWorkflowable(document, getLogger());
                Workflow workflow = workflowManager.getWorkflowSchema(workflowable);
                String[] events = workflow.getEvents();
                for (int i = 0; i < events.length; i++) {
                    if (workflowManager.canInvoke(workflowable, events[i])) {
                        this.executableEvents.add(events[i]);
                    }
                }
View Full Code Here

    public void invoke(Workflowable workflowable, String event, boolean force)
            throws WorkflowException {
        if (hasWorkflow(workflowable)) {
            WorkflowEngine engine = new WorkflowEngineImpl();
            Situation situation = getSituation();
            Workflow workflow = getWorkflowSchema(workflowable);

            if (force && !engine.canInvoke(workflowable, workflow, situation, event)) {
                throw new WorkflowException("The event [" + event
                        + "] cannot be invoked on the document [" + workflowable
                        + "] in the situation [" + situation + "]");
View Full Code Here

     */
    public boolean canInvoke(Workflowable workflowable, String event) {
        boolean canInvoke = true;
        try {
            if (hasWorkflow(workflowable)) {
                Workflow workflow = getWorkflowSchema(workflowable);
                WorkflowEngine engine = new WorkflowEngineImpl();
                Situation situation = getSituation();
                canInvoke = engine.canInvoke(workflowable, workflow, situation, event);
            }
        } catch (Exception e) {
View Full Code Here

TOP

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

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.