Package org.apache.lenya.workflow

Examples of org.apache.lenya.workflow.Version


     * @return A version.
     * @throws WorkflowException if an error occurs.
     */
    protected Version createNewVersion(Workflowable workflowable, Workflow workflow, String event,
            String destination) throws WorkflowException {
        Version latestVersion = workflowable.getLatestVersion();
        Version newVersion = new VersionImpl(event, destination);
        String[] variableNames = workflow.getVariableNames();
        for (int i = 0; i < variableNames.length; i++) {
            String name = variableNames[i];
            boolean value;
            if (latestVersion == null) {
                value = workflow.getInitialValue(name);
            } else {
                value = latestVersion.getValue(name);
            }
            newVersion.setValue(name, value);
        }
        return newVersion;
    }
View Full Code Here


     * @return A list of transitions.
     * @throws WorkflowException if an error occurs.
     */
    protected List getFiringTransitions(Workflowable workflowable, Workflow workflow, String event)
            throws WorkflowException {
        Version lastVersion = workflowable.getLatestVersion();

        String currentState;
        if (lastVersion == null) {
            currentState = workflow.getInitialState();
        } else {
            currentState = lastVersion.getState();
        }

        Transition[] transitions = workflow.getLeavingTransitions(currentState);
        List firingTransitions = new ArrayList();

View Full Code Here

    protected boolean canNotifySubmitter() {
       
        boolean shallNotifySubmitter = false;
        Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager, getSession(),
                getLogger(), getSourceDocument());
        Version versions[] = workflowable.getVersions();
       
        // consider the case that there was no submit transition
        if (versions.length > 0) {
            Version version = versions[versions.length - 1];
   
            // we check if the document has been submitted, otherwise we do nothing
            if (version.getEvent().equals("submit")) {
                shallNotifySubmitter = true;
            }
        }
        return shallNotifySubmitter;
    }
View Full Code Here

            return;
        }

        Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager, getSession(),
                getLogger(), authoringDocument);
        Version versions[] = workflowable.getVersions();
       
        // obtain submitted version
        Version version = versions[versions.length - 2];
       
        String userId = version.getUserId();
        User user = PolicyUtil.getUser(this.manager, authoringDocument.getCanonicalWebappURL(),
                userId, getLogger());

        Identifiable[] recipients = { user };
View Full Code Here

        if (!(docEvent.getDescriptor() instanceof WorkflowEventDescriptor)) {
            return;
        }

        WorkflowEventDescriptor descriptor = (WorkflowEventDescriptor) docEvent.getDescriptor();
        Version version = descriptor.getVersion();
    }
View Full Code Here

        User sender = getSession().getIdentity().getUser();

        String reason = getParameterAsString(PARAM_REJECT_REASON);
        Workflowable workflowable = WorkflowUtil.getWorkflowable(this.manager, getSession(),
                getLogger(), authoringDocument);
        Version versions[] = workflowable.getVersions();
        // current version is reject, want originating submit
        Version version = versions[versions.length - 2];

        // we assume that the document has been submitted, otherwise we do
        // nothing
        if (version.getEvent().equals("submit")) {

            String userId = version.getUserId();
            User user = PolicyUtil.getUser(this.manager, authoringDocument.getCanonicalWebappURL(),
                    userId, getLogger());

            Identifiable[] recipients = { user };
View Full Code Here

                    String string = versionStrings[i];
                    int spaceIndex = string.indexOf(" ");
                    String numberString = string.substring(0, spaceIndex);
                    int number = Integer.parseInt(numberString);
                    String versionString = string.substring(spaceIndex + 1);
                    Version version = decodeVersion(versionString);
                    number2version.put(new Integer(number), version);
                }
               
                int number = 0;
                for (Iterator i = number2version.keySet().iterator(); i.hasNext(); ) {
                    Version version = (Version) number2version.get(i.next());
                    this.versions[number] = version;
                    number++;
                }
               
                if (checkedIn) {
View Full Code Here

    /**
     * @see org.apache.lenya.workflow.Workflowable#getLatestVersion()
     */
    public Version getLatestVersion() {
        Version version = null;
        Version[] versions = getVersions();
        if (versions.length > 0) {
            version = versions[versions.length - 1];
        }
        return version;
View Full Code Here

     * @see org.apache.lenya.workflow.Condition#isComplied(org.apache.lenya.workflow.Workflow,
     *      org.apache.lenya.workflow.Workflowable)
     */
    public boolean isComplied(Workflow workflow, Workflowable workflowable)
            throws WorkflowException {
        Version latestVersion = workflowable.getLatestVersion();
        boolean value = false;
        if (latestVersion == null) {
            value = workflow.getInitialValue(getVariableName());
        } else {
            value = latestVersion.getValue(getVariableName());
        }

        if (getLogger().isDebugEnabled()) {
            getLogger().debug("Checking boolean variable condition");
            getLogger().debug("    Condition value: [" + getValue() + "]");
View Full Code Here

                String[] nameValue = steps[1].split("=");
                variables.put(nameValue[0], nameValue[1]);
            }
        }

        Version version = new LenyaVersion(event, state);
        for (Iterator i = variables.keySet().iterator(); i.hasNext();) {
            String name = (String) i.next();
            String value = (String) variables.get(name);
            version.setUserId(user);
            version.setDate(date);
            version.setIPAddress(machine);
            version.setValue(name, Boolean.valueOf(value).booleanValue());
        }
        return version;
    }
View Full Code Here

TOP

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

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.