Package org.apache.lenya.cms.workflow

Examples of org.apache.lenya.cms.workflow.WorkflowFactory


            log.debug("Checking workflow of document [" + document + "].");
        }

        boolean canFire = true;

        WorkflowFactory factory = WorkflowFactory.newInstance();
        if (factory.hasWorkflow(document)) {
            try {
                Situation situation = getSituation();

                SynchronizedWorkflowInstances instance;
                try {
                    instance = factory.buildSynchronizedInstance(document);
                } catch (WorkflowException e) {
                    throw new ExecutionException(e);
                }
                Event event = getExecutableEvent(instance, situation);
               
View Full Code Here


     * Returns the workflow situation.
     * @return A situation.
     * @throws ParameterException when something went wrong.
     */
    protected Situation getSituation() throws ParameterException {
        WorkflowFactory workflowFactory = WorkflowFactory.newInstance();
        String userId = getParameters().getParameter(PARAMETER_USER_ID);
        String machineIp = getParameters().getParameter(PARAMETER_IP_ADDRESS);
        Situation situation = workflowFactory.buildSituation(getRoleIDs(), userId, machineIp);
        return situation;
    }
View Full Code Here

        if (log.isDebugEnabled()) {
            log.debug("Trying to execute workflow on document [" + document.getId() + "].");
        }

        WorkflowFactory factory = WorkflowFactory.newInstance();
        if (factory.hasWorkflow(document)) {
            try {
                String userId = getParameters().getParameter(PARAMETER_USER_ID);
                String machineIp = getParameters().getParameter(PARAMETER_IP_ADDRESS);

                SynchronizedWorkflowInstances instance;
                try {
                    instance = factory.buildSynchronizedInstance(document);
                } catch (WorkflowException e) {
                    throw new ExecutionException(e);
                }
                Situation situation = factory.buildSituation(getRoleIDs(), userId, machineIp);

                Event event = getExecutableEvent(instance, situation);

                assert event != null;
View Full Code Here

   
        try {
            PageEnvelope envelope = PageEnvelopeFactory.getInstance().getPageEnvelope(objectModel);
            Document document = envelope.getDocument();

            WorkflowFactory factory = WorkflowFactory.newInstance();
            if (factory.hasWorkflow(document)) {
                WorkflowInstance instance = factory.buildInstance(document);
                if (name.equals(STATE)) {
                    value = instance.getCurrentState().toString();
                }
                else if (name.startsWith(VARIABLE_PREFIX)) {
                    String variableName = name.substring(VARIABLE_PREFIX.length());
View Full Code Here

      String destUrl = builder.buildCanonicalUrl(publication, getSecarea(), destDocumentid, language);


      Document document;
      Document newdocument;
      WorkflowFactory factory = WorkflowFactory.newInstance();
     
      log("init workflow history");
      try {
        document = builder.buildDocument(publication, srcUrl);
        newdocument = builder.buildDocument(publication, destUrl);
      } catch (DocumentBuildException e) {
        throw new BuildException(e);
      }
      try {
        if (factory.hasWorkflow(document)) {
          String[] roles = new String[0];
          Situation situation =
            WorkflowFactory.newInstance().buildSituation(roles, getUserId(), getMachineIp());
          WorkflowFactory.initHistory(document, newdocument, situation);
        }
View Full Code Here

      String newurl =
        builder.buildCanonicalUrl(publication, secarea, destDocumentid, language);

      Document document;
      Document newDocument;
      WorkflowFactory factory = WorkflowFactory.newInstance();

      log("move workflow history");
      try {
        document = builder.buildDocument(publication, url);
        newDocument = builder.buildDocument(publication, newurl);
      } catch (DocumentBuildException e) {
        throw new BuildException(e);
      }
      try {
        if (factory.hasWorkflow(document)) {
          WorkflowFactory.moveHistory(document, newDocument);
        }
      } catch (WorkflowException e) {
        throw new BuildException(e);
      }
View Full Code Here

      log("url for the source : "+srcUrl);
      log("url for the destination : "+destUrl);

      Document srcDoc;
      Document destDoc;
      WorkflowFactory factory = WorkflowFactory.newInstance();
     
      log("init workflow history");
      try {
        srcDoc = builder.buildDocument(publication, srcUrl);
        destDoc = builder.buildDocument(publication, destUrl);
      } catch (DocumentBuildException e) {
        throw new BuildException(e);
      }

      log("move workflow history of "+srcDoc.getFile().getAbsolutePath()+" to " + destDoc.getFile().getAbsolutePath());
      try {
        if (factory.hasWorkflow(srcDoc)) {
          log("has workflow");
          WorkflowFactory.moveHistory(srcDoc, destDoc);
          log("workflow moved");
        }
      } catch (WorkflowException e) {
View Full Code Here

        String[] roleIds = new String[roles.length];
        for (int i = 0; i < roles.length; i++) {
            roleIds[i] = roles[i].getId();
        }

        WorkflowFactory factory = WorkflowFactory.newInstance();
        Situation situation = factory.buildSituation(roleIds, userId, ipAddress);
        return situation;
    }
View Full Code Here

        } catch (Exception e) {
            throw new ProcessingException(e);
        }

        Document document = envelope.getDocument();
        WorkflowFactory factory = WorkflowFactory.newInstance();

        setHasWorkflow(factory.hasWorkflow(document));

        if (hasWorkflow()) {
            Situation situation = null;

            try {
                setInstance(factory.buildSynchronizedInstance(document));
                situation = WorkflowHelper.buildSituation(objectModel);
            } catch (Exception e) {
                throw new ProcessingException(e);
            }
View Full Code Here

        Publication publication = envelope.getPublication();
        DocumentBuilder builder = publication.getDocumentBuilder();
        String url = builder.buildCanonicalUrl(publication, area, documentId, language);
        Document document = builder.buildDocument(publication, url);

        WorkflowFactory factory = WorkflowFactory.newInstance();

        if (factory.hasWorkflow(document)) {

            if (getLogger().isDebugEnabled()) {
                getLogger().debug("    Invoking workflow event");
            }

            SynchronizedWorkflowInstances instance = factory.buildSynchronizedInstance(document);
            Situation situation = WorkflowHelper.buildSituation(objectModel);
            Event[] events = instance.getExecutableEvents(situation);
            Event event = null;

            for (int i = 0; i < events.length; i++) {
View Full Code Here

TOP

Related Classes of org.apache.lenya.cms.workflow.WorkflowFactory

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.