Examples of WorkflowManager


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, Session session, Logger logger,
            Document document, String event) throws WorkflowException {
        WorkflowManager wfManager = null;
        try {
            wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);
            Workflowable workflowable = getWorkflowable(manager, session, logger, document);
            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

     *            set to <code>false</code>, non-supporting documents are ignored.
     * @throws WorkflowException if the event could not be invoked in the current situation.
     */
    public static void invoke(ServiceManager manager, Session session, Logger logger,
            Document document, String event, boolean force) throws WorkflowException {
        WorkflowManager wfManager = null;
        try {
            wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);
            Workflowable workflowable = getWorkflowable(manager, session, logger, document);
            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

     * @throws WorkflowException if <code>force</code> is set to <code>true</code> and a
     *             document does not support the workflow event.
     */
    public static void invoke(ServiceManager manager, Session session, 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(manager,
                        session,
                        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, Session session, Logger logger,
            Document document, String event) throws WorkflowException {
        WorkflowManager wfManager = null;
        try {
            wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);
            Workflowable workflowable = new DocumentWorkflowable(manager, session, 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, Session session, 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(manager,
                        session,
                        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, Session session, Logger logger,
            Document document) throws WorkflowException {
        WorkflowManager wfManager = null;
        try {
            wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);
            Workflowable workflowable = new DocumentWorkflowable(manager, session, 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

     * @return A workflow schema.
     * @throws WorkflowException if an error occurs.
     */
    public static Workflow getWorkflowSchema(ServiceManager manager, Session session,
            Logger logger, Document document) throws WorkflowException {
        WorkflowManager wfManager = null;
        try {
            wfManager = (WorkflowManager) manager.lookup(WorkflowManager.ROLE);
            Workflowable workflowable = getWorkflowable(manager, session, logger, document);
            if (wfManager.hasWorkflow(workflowable)) {
                return wfManager.getWorkflowSchema(workflowable);
            } else {
                throw new WorkflowException("The document [" + document + "] has no workflow!");
            }
        } catch (ServiceException e) {
            throw new WorkflowException(e);
View Full Code Here

Examples of org.apache.lenya.workflow.WorkflowManager

    public void setup(SourceResolver _resolver, Map _objectModel, String src, Parameters _parameters)
            throws ProcessingException, SAXException, IOException {

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

        WorkflowManager workflowManager = null;

        try {
            Request request = ObjectModelHelper.getRequest(_objectModel);
            Session session = RepositoryUtil.getSession(this.manager, request);
            DocumentFactory map = DocumentUtil.createDocumentFactory(this.manager, session);

            String webappUrl = ServletHelper.getWebappURI(request);
            Document document = null;
            if (map.isDocument(webappUrl)) {
                document = map.getFromURL(webappUrl);
                ResourceType doctype = document.getResourceType();
                if (document.getPublication().getWorkflowSchema(doctype) != null) {
                    setHasWorkflow(true);
                    workflowManager = (WorkflowManager) this.manager.lookup(WorkflowManager.ROLE);
                } else {
                    setHasWorkflow(false);
                }
            } else {
                setHasWorkflow(false);
            }

            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

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

Examples of org.apache.lenya.workflow.WorkflowManager

     * @see org.apache.lenya.cms.usecase.AbstractUsecase#initParameters()
     */
    protected void initParameters() {
        super.initParameters();

        WorkflowManager resolver = null;
        try {
            // read parameters from Dublin Core meta-data
            MetaData dc = getSourceDocument().getMetaDataManager().getDublinCoreMetaData();
            setParameter(DublinCore.ELEMENT_TITLE, dc.getFirstValue(DublinCore.ELEMENT_TITLE));
            setParameter(DublinCore.ELEMENT_DESCRIPTION, dc
                    .getFirstValue(DublinCore.ELEMENT_DESCRIPTION));

            // read parameters from document attributes
            setParameter("languages", getSourceDocument().getLanguages());
            setParameter("lastmodified", getSourceDocument().getLastModified());
            setParameter("resourcetype", getSourceDocument().getResourceType());

            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());
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.