Package org.apache.lenya.cms.workflow

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


        DocumentBuilder builder = publication.getDocumentBuilder();
        if (builder.isDocument(publication, url)) {

          Document document = builder.buildDocument(publication, url);
          WorkflowFactory factory = WorkflowFactory.newInstance();

          if (factory.hasWorkflow(document)) {
            SynchronizedWorkflowInstances instance =
              factory.buildSynchronizedInstance(document);

            authorized = false;

            Situation situation = WorkflowHelper.buildSituation(request);
            Event[] events = instance.getExecutableEvents(situation);
View Full Code Here


    if (eventName == null) {
      log.debug("No workflow event.");
    } else {
      log.debug("Workflow event: [" + eventName + "]");
      // check for workflow instance first (task can initialize the workflow history)
      WorkflowFactory factory = WorkflowFactory.newInstance();
      try {
        document = publication.getDocumentBuilder().buildDocument(publication, webappUrl);
      } catch (DocumentBuildException e) {
        throw new ExecutionException(e);
      }
      doTransition = factory.hasWorkflow(document);
    }
  }
View Full Code Here

   */
  public void invokeTransition() throws ExecutionException {
    if (doTransition) {

      try {
        WorkflowFactory factory = WorkflowFactory.newInstance();
        SynchronizedWorkflowInstances instance =
          factory.buildSynchronizedInstance(document);
        Situation situation =
          factory.buildSituation(getRoleIDs(), getUserId(), getMachineIp());

        Event event = null;
        Event[] events = instance.getExecutableEvents(situation);

        log.debug("Resolved executable events.");
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

            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

      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

        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 = factory.buildSituation(objectModel);
            Event[] events = instance.getExecutableEvents(situation);
            Event event = null;

            for (int i = 0; i < events.length; i++) {
                if (events[i].getName().equals(eventName)) {
View Full Code Here

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

        boolean canFire = true;

        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);
               
                if (event == null) {
                    canFire = false;
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.