Examples of WorkflowManager


Examples of org.apache.lenya.workflow.WorkflowManager

            throws ProcessingException, SAXException, IOException {

        super.setup(_resolver, _objectModel, src, _parameters);

        PageEnvelope envelope = null;
        WorkflowManager workflowManager = null;

        try {
            DocumentIdentityMap map = new DocumentIdentityMap(this.manager, getLogger());
            envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(map, _objectModel);

            Document document = envelope.getDocument();
            if (document == null) {
                setHasWorkflow(false);
            } else {
                DocumentType doctype = document.getResourceType();
                if (document.getPublication().getWorkflowSchema(doctype) != null) {
                    setHasWorkflow(true);
                    workflowManager = (WorkflowManager) this.manager.lookup(WorkflowManager.ROLE);
                } else {
                    setHasWorkflow(false);
                }
            }

            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

Examples of org.apache.lenya.workflow.WorkflowManager

    /**
     * @see org.apache.lenya.cms.cocoon.flow.FlowHelper#getSituation(org.apache.cocoon.components.flow.javascript.fom.FOM_Cocoon)
     */
    public Situation getSituation(FOM_Cocoon cocoon) throws AccessControlException {
        Situation situation;
        WorkflowManager wfManager = null;
        try {
            wfManager = (WorkflowManager) this.manager.lookup(WorkflowManager.ROLE);
            situation = wfManager.getSituation();
        } catch (ServiceException e) {
            throw new RuntimeException(e);
        } finally {
            this.manager.release(wfManager);
        }
View Full Code Here

Examples of org.apache.lenya.workflow.WorkflowManager

     * @param event The name of the event.
     * @throws WorkflowException if the event could not be invoked in the current situation.
     */
    public static void invoke(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);
            wfManager.invoke(workflowable, event);
        } catch (ServiceException e) {
            throw new WorkflowException(e);
        } finally {
            if (wfManager != null) {
                manager.release(wfManager);
View Full Code Here

Examples of org.apache.lenya.workflow.WorkflowManager

    public static void invoke(ServiceManager manager,
            Logger logger,
            Document document,
            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) {
                manager.release(wfManager);
View Full Code Here

Examples of org.apache.lenya.workflow.WorkflowManager

    public static void invoke(ServiceManager manager,
            Logger logger,
            DocumentSet documentSet,
            String event,
            boolean force) throws WorkflowException {
        WorkflowManager wfManager = null;
        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);
        } finally {
View Full Code Here

Examples of org.apache.lenya.workflow.WorkflowManager

     * @return A boolean value.
     * @throws WorkflowException
     */
    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) {
                manager.release(wfManager);
View Full Code Here

Examples of org.apache.lenya.workflow.WorkflowManager

     * @return if an error occurs.
     * @throws WorkflowException
     */
    public static boolean canInvoke(ServiceManager manager, Logger logger, DocumentSet documents, String event)
            throws WorkflowException {
        WorkflowManager wfManager = null;
        try {
            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) {
            throw new WorkflowException(e);
View Full Code Here

Examples of org.apache.lenya.workflow.WorkflowManager

     * @return A boolean value.
     * @throws WorkflowException if an error occurs.
     */
    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) {
                manager.release(wfManager);
View Full Code Here

Examples of org.apache.lenya.workflow.WorkflowManager

     */
    public Object getAttribute(String name, Configuration modeConf, Map objectModel)
            throws ConfigurationException {

        Object value = null;
        WorkflowManager wfManager = null;

        try {
            PageEnvelope envelope = getEnvelope(objectModel, name);
            Document document = envelope.getDocument();
            if (document != null) {
                wfManager = (WorkflowManager) this.manager.lookup(WorkflowManager.ROLE);
                DocumentWorkflowable workflowable = new DocumentWorkflowable(document,
                        getLogger());
                if (wfManager.hasWorkflow(workflowable)) {

                    Version latestVersion = workflowable.getLatestVersion();

                    if (name.equals(STATE)) {
                        if (latestVersion == null) {
                            Workflow workflow = wfManager.getWorkflowSchema(workflowable);
                            value = workflow.getInitialState();
                        } else {
                            value = latestVersion.getState();
                        }
                    } else if (name.startsWith(VARIABLE_PREFIX)) {
                        String variableName = name.substring(VARIABLE_PREFIX.length());
                        Workflow workflow = wfManager.getWorkflowSchema(workflowable);
                        String[] variableNames = workflow.getVariableNames();
                        if (Arrays.asList(variableNames).contains(variableName)) {
                            if (latestVersion == null) {
                                value = Boolean.valueOf(workflow.getInitialValue(variableName));
                            } else {
View Full Code Here

Examples of org.apache.lenya.workflow.WorkflowManager

     * @see org.apache.lenya.cms.usecase.AbstractUsecase#doExecute()
     */
    protected void doExecute() throws Exception {
        super.doExecute();
        SourceResolver resolver = null;
        WorkflowManager wfManager = null;

        try {
            resolver = (SourceResolver) this.manager.lookup(SourceResolver.ROLE);

            Document doc = getSourceDocument();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.