Package pl.net.bluesoft.rnd.processtool.model

Examples of pl.net.bluesoft.rnd.processtool.model.ProcessInstance


    }

    @Override
    protected Component getTaskItem(final TaskTableItem tti) {
        ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
        ProcessInstance pi = tti.getTask().getProcessInstance();
        TaskItemProviderBase tip = getTaskItemProvider(ctx, pi);
        TaskItemProviderParams params = getTaskItemProviderParams(ctx, tti);
        return tip.getTaskPane(params);
    }
View Full Code Here


    /** Metoda wylicza date wygasniecia procesu. W przypadku podprocesow, siega
     * do atrubutow procesu głównego
     */
    public static Date getDeadlineDate(BpmTask task)
    {
        ProcessInstance process = task.getProcessInstance();
       
        Set<ProcessDeadline> deadlines = process.findAttributesByClass(ProcessDeadline.class);
        for (ProcessDeadline pd : deadlines) {
            if (pd.getTaskName().equalsIgnoreCase(task.getTaskName())) {
                return pd.getDueDate();
            }
        }
View Full Code Here

     */
    public ProcessInstance createSubprocessInstance(ProcessDefinitionConfig config, ProcessToolContext ctx,
      ProcessInstance parentProcessInstance, String source, String id)
    {

      ProcessInstance newSubprocessInstance = createProcessInstance(config, null, ctx, null, null, source, id, parentProcessInstance.getCreator());
     
      /* Corelate parent process with it's new child process */
      newSubprocessInstance.setParent(parentProcessInstance);   
      parentProcessInstance.getChildren().add(newSubprocessInstance);
     
     
      /* Map parent process owners to subprocess */
      newSubprocessInstance.getOwners().addAll(parentProcessInstance.getOwners());
     
      /* Inform about parent process halt */
        broadcastEvent(ctx, new BpmEvent(Type.PROCESS_HALTED, parentProcessInstance, parentProcessInstance.getCreator()));
     
      return newSubprocessInstance;
View Full Code Here

      long start = System.currentTimeMillis();
        if (!config.getEnabled()) {
            throw new IllegalArgumentException("Process definition has been disabled!");
        }
       
        ProcessInstance newProcessInstance = new ProcessInstance();
        newProcessInstance.setDefinition(config);
        newProcessInstance.setCreator(creator);
        newProcessInstance.addOwner(creator.getLogin());
        newProcessInstance.setDefinitionName(config.getBpmDefinitionKey());
        newProcessInstance.setCreateDate(new Date());
        newProcessInstance.setExternalKey(externalKey);
        newProcessInstance.setDescription(description);
        newProcessInstance.setKeyword(keyword);
        newProcessInstance.setStatus(ProcessStatus.NEW);

        {
            ProcessInstanceSimpleAttribute attr = new ProcessInstanceSimpleAttribute();
            attr.setKey("creator");
            attr.setValue(creator.getLogin());
            newProcessInstance.addAttribute(attr);

            attr = new ProcessInstanceSimpleAttribute();
            attr.setKey("creatorName");
            attr.setValue(creator.getRealName());
            newProcessInstance.addAttribute(attr);
        }
        ProcessInstanceSimpleAttribute attr = new ProcessInstanceSimpleAttribute();
        attr.setKey("source");
        attr.setValue(source);
        newProcessInstance.addAttribute(attr);

        ctx.getProcessInstanceDAO().saveProcessInstance(newProcessInstance);

        if(internalId == null)
          newProcessInstance = startProcessInstance(config, externalKey, ctx, newProcessInstance);
        else
          newProcessInstance.setInternalId(internalId);

        creator = findOrCreateUser(creator, ctx);

        ProcessInstanceLog log = new ProcessInstanceLog();
        log.setState(null);
        log.setEntryDate(Calendar.getInstance());
        log.setEventI18NKey("process.log.process-started");
        log.setUser(creator);
        log.setLogType(ProcessInstanceLog.LOG_TYPE_START_PROCESS);
        log.setOwnProcessInstance(newProcessInstance);
        newProcessInstance.getRootProcessInstance().addProcessLog(log);
        List<BpmTask> findProcessTasks = findProcessTasks(newProcessInstance, ctx);
        String taskName = findProcessTasks.get(0).getTaskName();


            newProcessInstance.setState(taskName);
        ctx.getProcessInstanceDAO().saveProcessInstance(newProcessInstance);

        Collection<IEvent> events = new ArrayList<IEvent>();
        events.add(new BpmEvent(Type.NEW_PROCESS, newProcessInstance, creator));
View Full Code Here

    /* Every row is one queue element with jbpm task as first column and process instance as second */
       for(Object[] resultRow: queueResults)
       {
        
         HistoryTaskInstanceImpl taskInstance = (HistoryTaskInstanceImpl)resultRow[0];
         ProcessInstance processInstance = (ProcessInstance)resultRow[1];
        
         /* Map process and jbpm task to system's bpm task */
         BpmTask task = taskFactory.create(taskInstance, processInstance);
        
         result.add(task);
View Full Code Here

  @Override
  public String invoke(BpmStep step, Map<String, String> params) throws Exception {
    try {
     
      ProcessInstance processInstance = step.getProcessInstance();
      // GET PARAMETERS FOR REPORT
      reportName = (String) params.get("reportName");
      subFolder = (String) params.get("subFolder");
      outputFileName = (String) params.get("outputFileName");
      rootFolderPath = (String) params.get("rootFolderPath");
View Full Code Here

public class HandleSubstitutionAcceptance implements ProcessToolProcessStep {
    private final static Logger logger = Logger.getLogger(HandleSubstitutionAcceptance.class.getName());

    @Override
    public String invoke(BpmStep step, Map params) throws Exception {
        ProcessInstance processInstance = step.getProcessInstance();
        try {
            ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
            UserSubstitution userSubstitution = new UserSubstitution();
            userSubstitution.setUser(processInstance.getCreator());
            userSubstitution.setDateFrom(Formats.parseShortDate(processInstance.getSimpleAttributeValue("dateFrom")));
            userSubstitution.setDateTo(Formats.parseShortDate(processInstance.getSimpleAttributeValue("dateTo")));
            String substituteUserLogin = processInstance.getSimpleAttributeValue("userSubstitute");
            UserData substituteUser = ctx.getUserDataDAO().loadUserByLogin(substituteUserLogin);
            if (substituteUser == null) {
                substituteUser = LiferayBridge.getLiferayUser(substituteUserLogin,
                        processInstance.getCreator().getCompanyId());
                ctx.getUserDataDAO().saveOrUpdate(substituteUser);
                if (substituteUser == null) {
                    logger.warning("Unable to determine application user by login: " + substituteUserLogin);
                    return STATUS_ERROR;
                }
View Full Code Here

    private BeanItemContainer<ProcessComment> bic = new BeanItemContainer<ProcessComment>(ProcessComment.class);

    @Override
  public void loadData(BpmTask task) {
        ProcessInstance pi = task.getProcessInstance().getRootProcessInstance();

        if (mode.equalsIgnoreCase(MODE_SMART)) {
            if (!"true".equalsIgnoreCase(pi.getSimpleAttributeValue("commentAdded", "false"))) {
                showContent = false;
            }
        }

        bic.removeAllItems();
    ProcessComments comments = pi.findAttributeByClass(ProcessComments.class);
        if (comments != null) {
            List<ProcessComment> lst = new ArrayList<ProcessComment>(comments.getComments());
            Collections.sort(lst, new Comparator<ProcessComment>() {
                @Override
                public int compare(ProcessComment o1, ProcessComment o2) {
View Full Code Here

  }

  @Override
  public void saveData(BpmTask task) {
    boolean found = false;
        ProcessInstance pi = task.getProcessInstance();
    for (ProcessInstanceUserAssignment assign : getAttributes(ProcessInstanceUserAssignment.class, pi)) {
      if ((roleInProcess == null && assign.getRole() == null) || (assign.getRole() != null && assign.getRole().equals(roleInProcess))) {
        found = true;
        if (selectedUser == null) {
                    pi.removeAttribute(assign);
        } else {
                    assign.setBpmLogin(selectedUser.getBpmLogin());
          assign.setUserLogin(selectedUser.getLogin());
          assign.setUserDescription(selectedUser.getDescription());
        }
      }
    }
    if (!found && selectedUser != null) {
      ProcessInstanceUserAssignment assign = new ProcessInstanceUserAssignment();
      assign.setUserLogin(selectedUser.getLogin());
      assign.setUserDescription(selectedUser.getDescription());
      assign.setBpmLogin(selectedUser.getBpmLogin());
      assign.setRole(roleInProcess);
      assign.setKey(roleInProcess);
            pi.addAttribute(assign);
    }
  }
View Full Code Here

    }
  }

  @Override
  public void loadData(BpmTask task) {
        ProcessInstance processInstance = task.getProcessInstance();
    for (ProcessInstanceUserAssignment assign : getAttributes(ProcessInstanceUserAssignment.class, processInstance)) {
      if ((roleInProcess == null && assign.getRole() == null) || (assign.getRole() != null && assign.getRole().equals(roleInProcess))) {
        selectedUser = new UserData();
        selectedUser.setLogin(assign.getUserLogin());
        selectedUser.setDescription(assign.getUserDescription());
View Full Code Here

TOP

Related Classes of pl.net.bluesoft.rnd.processtool.model.ProcessInstance

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.