Package com.opensymphony.workflow.loader

Examples of com.opensymphony.workflow.loader.WorkflowDescriptor


   * inputs on the current workflow instance.
   */
  public List getAvailableActionDescriptors(final Map inputs) {
    return (List) this.execute(new OsWorkflowCallback() {
      public Object doWithWorkflow(Workflow workflow) throws WorkflowException {
        WorkflowDescriptor descriptor = workflow.getWorkflowDescriptor(OsWorkflowTemplate.this.workflowName);

        int[] availableActions = workflow.getAvailableActions(getInstanceId(), inputs);
        List actionDescriptors = new ArrayList(availableActions.length);

        for (int i = 0; i < availableActions.length; i++) {
          actionDescriptors.add(descriptor.getAction(availableActions[i]));
        }

        return actionDescriptors;
      }
    });
View Full Code Here


  /**
   * Converts a <code>List</code> of <code>Step</code>s to a <code>List</code> of <code>StepDescriptor</code>s.
   */
  private List convertStepsToStepDescriptors(List steps, Workflow workflow) {
    WorkflowDescriptor descriptor = workflow.getWorkflowDescriptor(OsWorkflowTemplate.this.workflowName);

    List stepDescriptors = new ArrayList();

    for (int i = 0; i < steps.size(); i++) {
      Step step = (Step) steps.get(i);
      stepDescriptors.add(descriptor.getStep(step.getStepId()));
    }

    return Collections.unmodifiableList(stepDescriptors);
  }
View Full Code Here

  /**
   * Gets a <code>WorkflowDescriptor</code> by name.
   */
  public WorkflowDescriptor getWorkflow(String name) throws FactoryException {
    WorkflowDescriptor wd = (WorkflowDescriptor) this.workflows.get(name);

    if (wd == null) {
      throw new FactoryException("Unknown workflow name [" + name + "].");
    }

View Full Code Here

   * Loads a <code>WorkflowDescriptor</code> from the specified location
   * using the <code>WorkflowLoader</code> class.
   */
  protected WorkflowDescriptor loadWorkflowDescriptor(String resourceLocation, String name) {
    Resource resource = this.resourceLoader.getResource(resourceLocation);
    WorkflowDescriptor workflowDescriptor = null;
    try {
      workflowDescriptor = this.invokeLoader(resource);
    }
    catch (IOException ex) {
      throw new FatalBeanException("Unable to load workflow resource [" + resourceLocation + "].", ex);
View Full Code Here

    String[] names = bean.getWorkflowNames();
    Arrays.sort(names);
    assertTrue(Arrays.binarySearch(names, "foo") > -1);
    assertTrue(Arrays.binarySearch(names, "bar") > -1);

    WorkflowDescriptor wd = bean.getWorkflow("foo");
    assertNotNull("Workflow descriptor should not be null", wd);

  }
View Full Code Here

      workflowName = workflow.getWorkflowName(workflowId);
      CacheController.cacheObject("workflowNameCache", key, workflowName);
    }

    String keyDescriptor = "workflowDescriptor_" + workflowId;
    WorkflowDescriptor workflowDescriptorTemp = (WorkflowDescriptor)CacheController.getCachedObject("workflowNameCache", keyDescriptor);
    if(workflowDescriptorTemp == null)
    {
      workflowDescriptorTemp = workflow.getWorkflowDescriptor(workflowName);
      workflowDescriptor = workflowDescriptorTemp;
      CacheController.cacheObject("workflowNameCache", keyDescriptor, workflowDescriptorTemp);
View Full Code Here

        {
            String encoding = CmsPropertyHandler.getWorkflowEncoding();
            if(encoding == null || encoding.length() == 0 || encoding.equalsIgnoreCase("@workflowEncoding@"))
                encoding = "UTF-8";
           
            WorkflowDescriptor workflowDescriptor = (WorkflowDescriptor)CacheController.getCachedObject("workflowCache", "workflowDescriptor_" + c.workflowDefinitionVO.getName());
            if(workflowDescriptor == null)
            {
              if(logger.isInfoEnabled())
                logger.info("No cached workflow descriptor - reading it...");
              workflowDescriptor = WorkflowLoader.load(new ByteArrayInputStream(c.workflowDefinitionVO.getValue().getBytes(encoding)) , validate);
View Full Code Here

     
      Workflow workflow = workflowInit; //new BasicWorkflow(infoGluePrincipal.getName());
     
      int[] actions = workflow.getAvailableActions(id, null);
      logger.info("actions:" + actions.length);
      WorkflowDescriptor wd = workflow.getWorkflowDescriptor(workflow.getWorkflowName(id));

      for (int i = 0; i < actions.length; i++)
      {
        int availableActionId = actions[i];
        String name = wd.getAction(availableActionId).getName();
        logger.info("Action:" + availableActionId + ":" + name);
       
        //workflow.doAction(id, availableActionId, Collections.EMPTY_MAP);
      }
      Map map = new HashMap();
      map.put("userName", "Mattias");
      workflow.doAction(id, 1, map);

      actions = workflow.getAvailableActions(id, null);
      logger.info("actions:" + actions.length);
      wd = workflow.getWorkflowDescriptor(workflow.getWorkflowName(id));

      for (int i = 0; i < actions.length; i++)
      {
        int availableActionId = actions[i];
        String name = wd.getAction(availableActionId).getName();
        logger.info("Action:" + availableActionId + ":" + name);
       
        //workflow.doAction(id, availableActionId, Collections.EMPTY_MAP);
      }
View Full Code Here

TOP

Related Classes of com.opensymphony.workflow.loader.WorkflowDescriptor

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.