Package org.apache.lenya.workflow

Examples of org.apache.lenya.workflow.WorkflowException


     * @throws WorkflowException if no variable with the given name exists.
     */
    public BooleanVariableImpl getVariable(String name)
        throws WorkflowException {
        if (!variables.containsKey(name)) {
            throw new WorkflowException("Workflow does not contain the variable '" + name + "'!");
        }

        return (BooleanVariableImpl) variables.get(name);
    }
View Full Code Here


                    workflowId);
            historyElement.appendChild(initialVersionElement);

            DocumentHelper.writeDocument(helper.getDocument(), file);
        } catch (Exception e) {
            throw new WorkflowException(e);
        }
    }
View Full Code Here

        NamespaceHelper helper;
        try {
            Document document = DocumentHelper.readDocument(getHistoryFile());
            helper = new NamespaceHelper(Workflow.NAMESPACE, Workflow.DEFAULT_PREFIX, document);
        } catch (Exception e) {
            throw new WorkflowException(e);
        }
        return helper;
    }
View Full Code Here

     */
    protected String getWorkflowId(NamespaceHelper helper) throws WorkflowException {
        String workflowId = helper.getDocument().getDocumentElement().getAttribute(
                WORKFLOW_ATTRIBUTE);
        if (workflowId == null) {
            throw new WorkflowException("The attribute '" + WORKFLOW_ATTRIBUTE + "' is missing!");
        }
        if ("".equals(workflowId)) {
            throw new WorkflowException("The workflow ID must not be empty!");
        }
        return workflowId;
    }
View Full Code Here

     * @throws WorkflowException if something goes wrong.
     */
    public WorkflowInstanceImpl getInstance() throws WorkflowException {
        if (this.instance == null) {
            if (!isInitialized()) {
                throw new WorkflowException(
                        "The workflow history has not been initialized: The file ["
                                + getHistoryFile() + "] is missing.");
            }

            WorkflowInstanceImpl instance = createInstance();
            NamespaceHelper helper = getNamespaceHelper();

            String workflowId = getWorkflowId(helper);
            if (null == workflowId) {
                throw new WorkflowException("No workflow attribute set in history document!");
            }

            instance.setWorkflow(workflowId);

            restoreState(instance, helper);
View Full Code Here

            saveVariables(helper);

            DocumentHelper.writeDocument(xmlDocument, getHistoryFile());
        } catch (Exception e) {
            throw new WorkflowException(e);
        }
    }
View Full Code Here

                    parent.appendChild(element);
                }

                element.setAttribute(VALUE_ATTRIBUTE, Boolean.toString(value));
            } catch (TransformerException e) {
                throw new WorkflowException(e);
            }
        }
    }
View Full Code Here

            destinationChannel.transferFrom(sourceChannel, 0, sourceChannel.size());
            File directory = historyFile.getParentFile();
            boolean deleted = historyFile.delete();
            if (!deleted) {
                throw new WorkflowException("The old history file could not be deleted!");
            }
            if (directory.exists() && directory.isDirectory() && directory.listFiles().length == 0) {
                directory.delete();
            }
        } catch (IOException e) {
            throw new WorkflowException(e);
        } finally {
            try {
                if (sourceStream != null)
                    sourceStream.close();
                if (destinationStream != null)
                    destinationStream.close();
            } catch (IOException e) {
                throw new WorkflowException(e);
            }
        }
    }
View Full Code Here

     * @throws WorkflowException when something went wrong.
     */
    protected Version restoreVersion(NamespaceHelper helper, Element element)
            throws WorkflowException {
        if (!element.getLocalName().equals(VERSION_ELEMENT)) {
            throw new WorkflowException("Invalid history XML!");
        }

        Event event = null;
        String eventId = element.getAttribute(EVENT_ATTRIBUTE);
        if (eventId != null && !"".equals(eventId)) {
View Full Code Here

     * @throws WorkflowException when something went wrong.
     */
    public void delete() throws WorkflowException {
        System.out.println("Deleting file [" + getHistoryFile() + "]");
        if (!isInitialized()) {
            throw new WorkflowException("The workflow history is not initialized!");
        }

        boolean deleted = getHistoryFile().delete();

        if (!deleted) {
            throw new WorkflowException("The workflow history could not be deleted!");
        }

    }
View Full Code Here

TOP

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

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.