Package com.dotmarketing.portlets.workflows.model

Examples of com.dotmarketing.portlets.workflows.model.WorkflowStep


    } catch (Exception e2) {
      Logger.error(this, "Could not load files : ", e2);
    }

    Contentlet contentlet;
    WorkflowStep wfStep;
    WorkflowScheme wfScheme = null;

    for (Versionable file : files) {

      if (file == null)
        continue;

      List<Integer> permissions = new ArrayList<Integer>();
      try {
        permissions = permissionAPI.getPermissionIdsFromRoles(
            (Permissionable) file, roles, user);
      } catch (DotDataException e) {
        Logger.error(this, "Could not load permissions : ", e);
      }

      List<WorkflowAction> wfActions = new ArrayList<WorkflowAction>();

      contentlet = null;
      if (file instanceof com.dotmarketing.portlets.fileassets.business.FileAsset)
        contentlet = (Contentlet) file;
      try {
        if (contentlet != null) {
          wfStep = APILocator.getWorkflowAPI().findStepByContentlet(
              contentlet);
          wfScheme = APILocator.getWorkflowAPI().findScheme(
              wfStep.getSchemeId());
          wfActions = APILocator.getWorkflowAPI()
              .findAvailableActions(contentlet, user);
        }
      } catch (Exception e) {
        Logger.error(this, "Could not load workflow actions : ", e);
View Full Code Here


                    try {
                        HibernateUtil.startTransaction();
                        List<WorkflowTask> tasks=wapi.findExpiredTasks();
                        for (WorkflowTask task : tasks) {
                            String stepId=task.getStatus();
                            WorkflowStep step=wapi.findStep(stepId);
                            String actionId=step.getEscalationAction();
                            WorkflowAction action=wapi.findAction(actionId, APILocator.getUserAPI().getSystemUser());
                           
                            Logger.info(this, "Task '"+task.getTitle()+"' " +
                                    "on contentlet id '"+task.getWebasset()+"' "+
                                "timeout on step '"+step.getName()+"' " +
                                "excecuting escalation action '"+action.getName()+"'");
                           
                            // find contentlet for default language
                            Contentlet def=APILocator.getContentletAPI().findContentletByIdentifier(task.getWebasset(), false,
                                    APILocator.getLanguageAPI().getDefaultLanguage().getId(),
View Full Code Here

        scheme.setName("Rest Mandatory Workflow "+salt);
        scheme.setDescription("testing rest save content");
        scheme.setCreationDate(new Date());
        APILocator.getWorkflowAPI().saveScheme(scheme);
       
        WorkflowStep step1=new WorkflowStep();
        step1.setCreationDate(new Date());
        step1.setEnableEscalation(false);
        step1.setMyOrder(1);
        step1.setName("Step 1");
        step1.setResolved(false);
        step1.setSchemeId(scheme.getId());
        APILocator.getWorkflowAPI().saveStep(step1);
       
        WorkflowStep step2=new WorkflowStep();
        step2.setCreationDate(new Date());
        step2.setEnableEscalation(false);
        step2.setMyOrder(2);
        step2.setName("Step 2");
        step2.setResolved(false);
        step2.setSchemeId(scheme.getId());
        APILocator.getWorkflowAPI().saveStep(step2);
       
        WorkflowStep step3=new WorkflowStep();
        step3.setCreationDate(new Date());
        step3.setEnableEscalation(false);
        step3.setMyOrder(3);
        step3.setName("Step 3");
        step3.setResolved(true);
        step3.setSchemeId(scheme.getId());
        APILocator.getWorkflowAPI().saveStep(step3);
       
        // Save as Draft Step1 -> Step1
        WorkflowAction saveDraft=new WorkflowAction();
        saveDraft.setId(UUIDGenerator.generateUuid());
        saveDraft.setName("Save as Draft");
        saveDraft.setOrder(1);
        saveDraft.setNextStep(step1.getId());
        saveDraft.setRequiresCheckout(true);
        saveDraft.setStepId(step1.getId());
        saveDraft.setNextAssign(APILocator.getRoleAPI().loadCMSAnonymousRole().getId());
        APILocator.getWorkflowAPI().saveAction(saveDraft,
                Arrays.asList(new Permission[] {
                        new Permission(
                                saveDraft.getPermissionType(),
                                saveDraft.getId(),
                                APILocator.getRoleAPI().loadCMSAnonymousRole().getId(),
                                PermissionAPI.PERMISSION_USE) }));
       
     // Save as Draft Step1 -> Step1
        WorkflowAction escalate=new WorkflowAction();
        escalate.setId(UUIDGenerator.generateUuid());
        escalate.setName("Save and Assign");
        escalate.setOrder(2);
        escalate.setNextStep(step1.getId());
        escalate.setRequiresCheckout(true);
        escalate.setStepId(step1.getId());
        escalate.setAssignable(true);
        escalate.setCommentable(true);
        escalate.setNextAssign(APILocator.getRoleAPI().loadCMSAnonymousRole().getId());
        APILocator.getWorkflowAPI().saveAction(escalate,
                Arrays.asList(new Permission[] {
                        new Permission(
                                escalate.getPermissionType(),
                                escalate.getId(),
                                APILocator.getRoleAPI().loadCMSAnonymousRole().getId(),
                                PermissionAPI.PERMISSION_USE) }));
       
        // Send for review Step1 -> Step2
        WorkflowAction sendReview=new WorkflowAction();
        sendReview.setId(UUIDGenerator.generateUuid());
        sendReview.setName("Send for review");
        sendReview.setOrder(3);
        sendReview.setNextStep(step2.getId());
        sendReview.setRequiresCheckout(false);
        sendReview.setStepId(step1.getId());
        sendReview.setNextAssign(APILocator.getRoleAPI().loadCMSAnonymousRole().getId());
        APILocator.getWorkflowAPI().saveAction(sendReview,
                Arrays.asList(new Permission[] {
                        new Permission(
                                sendReview.getPermissionType(),
                                sendReview.getId(),
                                APILocator.getRoleAPI().loadCMSAnonymousRole().getId(),
                                PermissionAPI.PERMISSION_USE) }));
       
        // reject Step2 -> Step1
        WorkflowAction reject=new WorkflowAction();
        reject.setId(UUIDGenerator.generateUuid());
        reject.setName("Reject");
        reject.setOrder(1);
        reject.setNextStep(step1.getId());
        reject.setRequiresCheckout(false);
        reject.setStepId(step2.getId());
        reject.setNextAssign(APILocator.getRoleAPI().loadCMSAnonymousRole().getId());
        APILocator.getWorkflowAPI().saveAction(reject,
                Arrays.asList(new Permission[] {
                        new Permission(
                                reject.getPermissionType(),
                                reject.getId(),
                                APILocator.getRoleAPI().loadCMSAnonymousRole().getId(),
                                PermissionAPI.PERMISSION_USE) }));
       
        // publish Step2 -> Step3
        WorkflowAction publish=new WorkflowAction();
        publish.setId(UUIDGenerator.generateUuid());
        publish.setName("Publish");
        publish.setOrder(2);
        publish.setNextStep(step3.getId());
        publish.setRequiresCheckout(false);
        publish.setStepId(step2.getId());
        publish.setNextAssign(APILocator.getRoleAPI().loadCMSAnonymousRole().getId());
        APILocator.getWorkflowAPI().saveAction(publish,
                Arrays.asList(new Permission[] {
View Full Code Here

    return scheme;
  }

  private WorkflowStep convertStep(Map<String, Object> row) throws IllegalAccessException, InvocationTargetException {
    final WorkflowStep step = new WorkflowStep();
    row.put("myOrder", row.get("my_order"));
    row.put("schemeId", row.get("scheme_id"));
    row.put("enableEscalation", row.get("escalation_enable"));
    row.put("escalationAction", row.get("escalation_action"));
    row.put("escalationTime", row.get("escalation_time"));
View Full Code Here

    String stepId = action.getStepId();
    final DotConnect db = new DotConnect();
    db.setSQL(sql.DELETE_ACTION);
    db.addParam(action.getId());
    db.loadResult();
    WorkflowStep proxy = new WorkflowStep();
    proxy.setId(action.getStepId());
    cache.removeActions(proxy);

    // update scheme mod date
    WorkflowStep step = findStep(stepId);
    WorkflowScheme scheme = findScheme(step.getSchemeId());
    saveScheme(scheme);
  }
View Full Code Here

    db.addParam(actionClass.getId());
    db.loadResult();

    // update scheme mod date
    WorkflowAction action = findAction(actionId);
    WorkflowStep step = findStep(action.getStepId());
    WorkflowScheme scheme = findScheme(step.getSchemeId());
    saveScheme(scheme);
  }
View Full Code Here

    final DotConnect db = new DotConnect();
    db.setSQL(sql.DELETE_ACTION_CLASS_BY_ACTION);
    db.addParam(action.getId());

    // update scheme mod date
    WorkflowStep step = findStep(actionId);
    WorkflowScheme scheme = findScheme(step.getSchemeId());
    saveScheme(scheme);
  }
View Full Code Here

    db.addParam(actionClass.getId());
    db.loadResult();

    // update scheme mod date
    WorkflowAction action = findAction(actionClass.getActionId());
    WorkflowStep step = findStep(action.getStepId());
    WorkflowScheme scheme = findScheme(step.getSchemeId());
    saveScheme(scheme);

  }
View Full Code Here

    db.addParam(showArchived);
    return this.convertListToObjects(db.loadObjectResults(), WorkflowScheme.class);
  }

  public WorkflowStep findStep(String id) throws DotDataException {
    WorkflowStep step = cache.getStep(id);
    if (step == null) {
      final DotConnect db = new DotConnect();
      db.setSQL(sql.SELECT_STEP);
      db.addParam(id);
      step = (WorkflowStep) this.convertListToObjects(db.loadObjectResults(), WorkflowStep.class).get(0);
View Full Code Here

    }
    return step;
  }

  public WorkflowStep findStepByContentlet(Contentlet contentlet) throws DotDataException {
    WorkflowStep step = cache.getStep(contentlet);
    final WorkflowScheme scheme = this.findSchemeForStruct(contentlet.getStructureInode());
    if ((step == null) || !step.getSchemeId().equals(scheme.getId())) {
      try {
        final DotConnect db = new DotConnect();
        db.setSQL(sql.SELECT_STEP_BY_CONTENTLET);
        db.addParam(contentlet.getIdentifier());
        step = (WorkflowStep) this.convertListToObjects(db.loadObjectResults(), WorkflowStep.class).get(0);
      } catch (final Exception e) {
        Logger.debug(this.getClass(), e.getMessage());
      }

      if (step == null) {
        try {
          step = this.findSteps(scheme).get(0);
        } catch (final Exception e) {
          throw new DotDataException("Unable to find workflow step for content id:" + contentlet.getIdentifier());
        }
      }

      // if the existing task belongs to another workflow schema, update
      // to the latest schema
      if (!step.getSchemeId().equals(scheme.getId())) {
        step = this.findSteps(scheme).get(0);
        final DotConnect db = new DotConnect();
        db.setSQL(sql.RESET_CONTENTLET_STEPS);
        db.addParam(step.getId());
        db.addParam(contentlet.getIdentifier());
        db.loadResult();

      }
      cache.addStep(contentlet, step);
View Full Code Here

TOP

Related Classes of com.dotmarketing.portlets.workflows.model.WorkflowStep

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.