Package pl.net.bluesoft.rnd.processtool

Examples of pl.net.bluesoft.rnd.processtool.ProcessToolContext$Util


        return b;
    }

    private void openHistoryInstance(ProcessInstanceLog log, String notFoundMessage, boolean finalTask) {
        getHistorySelection().update(table.getPageLength(), filterExpression, isBaseUserOnly, (DateRange) dateRangeField.getValue(), log);
        ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
        ProcessInstance ownPi = null;
        if(log.getOwnProcessInstance() != null)
          ownPi = ctx.getProcessInstanceDAO().getProcessInstance(log.getOwnProcessInstance().getId());
        else
          ownPi = ctx.getProcessInstanceDAO().getProcessInstanceByInternalId(log.getExecutionId());
        log.setOwnProcessInstance(ownPi);
        BpmTask task = finalTask ? bpmSession.getPastEndTask(log, ctx) : bpmSession.getPastOrActualTask(log, ctx);
        if (task != null) {
            viewCallback.displayProcessData(task, true);
        }
View Full Code Here


    @AutoWiredProperty
    private String bundleResource;

  @Override
  public String invoke(BpmStep step, Map<String, String> params) throws Exception {
        ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
        DroolsUtils.DroolsResource resource;
        if (Strings.hasText(bundleResource)) {
            InputStream ruleStream = ctx.getRegistry().loadResource(bundleResource, ruleUrl);
            String fullRuleUrl = bundleResource.replace(".", "/") + "/" + ruleUrl;
            resource = new DroolsUtils.DroolsResource(fullRuleUrl, ruleStream);
        }
        else {
            if (ruleUrl.startsWith("/")) {
                ruleUrl = ctx.getSetting("drools.rules.baseurl") + ruleUrl;
            }
            resource = new DroolsUtils.DroolsResource(ruleUrl);
        }
        ProcessInstance processInstance = step.getProcessInstance();
View Full Code Here

   
    @Override
    public String invoke(BpmStep step, Map<String, String> params) throws Exception
    {
        ProcessInstance processInstance = step.getProcessInstance();
        ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();

        List<String> taskNames = Strings.hasText(taskName) ? Arrays.asList(taskName.split(",")) : step.getOutgoingTransitions();
       
       

        Date dueDate = extractDate("dueDate", processInstance, params);
        if (dueDate == null) {
            Date baseDate = extractDate("baseDate", processInstance, params);
            if (!Strings.hasText(value)) {
                throw new ProcessToolException("Unable to calculate due date");
            }
           
            Calendar cal = Calendar.getInstance();
            cal.setTime(baseDate != null ? baseDate : new Date());
           
            if(useWorkingDays())
            {
            int nv = Integer.valueOf(Integer.valueOf(value));
            nv = getWeekOffset(cal.getTime(),nv);
            cal.add(Calendar.DAY_OF_YEAR, nv);
           
            dueDate = cal.getTime();
             
            }
            else
            {
                cal.add("min".equals(unit) ? Calendar.MINUTE : Calendar.DAY_OF_YEAR, Integer.valueOf(value));
                cal.set(Calendar.HOUR, 0);
                cal.set(Calendar.SECOND, 0);
                if (!"min".equals(unit)) {
                    cal.set(Calendar.MINUTE, 0);
                }
                dueDate = cal.getTime();
            }
        }

        for (String tn : taskNames)
        {
            String attrKey = "deadline_" + tn;
            ProcessDeadline pid = null;
            for (ProcessInstanceAttribute attr : processInstance.getProcessAttributes()) {
                if (attr.getKey() == null) {
                    logger.info("Attribute key is null! Process instance: " + processInstance.getInternalId());
                }
                if (attrKey.equals(attr.getKey())) {
                    pid = (ProcessDeadline) attr;
                    break;
                }
            }
            if (pid == null) {
                pid = new ProcessDeadline();
                pid.setKey("deadline_" + tn);
                pid.setProcessInstance(processInstance);
                processInstance.getProcessAttributes().add(pid);
            }
            pid.setProfileName(profileName);
            pid.setNotifyUsersWithLogin(notifyUsersWithLogin);
            pid.setNotifyUsersWithRole(notifyUsersWithRole);
            pid.setSkipAssignee("true".equalsIgnoreCase(skipAssignee));
            pid.setTemplateName(templateName);
            pid.setTaskName(tn);
            pid.setAlreadyNotified(false);
            pid.setDueDate(dueDate);
        }

        ctx.getProcessInstanceDAO().saveProcessInstance(processInstance);

        return STATUS_OK;
    }
View Full Code Here

        ProcessStatus status = pi.getStatus() != null ? pi.getStatus() : ProcessStatus.UNKNOWN;
        return getMessage("process.instance.status." + status.name().toLowerCase());
    }

    private Component getProcessCurrentTasksView(ProcessInstance pi) {
        ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
        List<BpmTask> tasks = bpmSession.findProcessTasks(pi, ctx);
        taskCount = tasks.size();
        if (tasks.isEmpty()) {
            return VaadinUtility.boldLabel(getMessagePrefixed("pi.currentTasks.empty"));
        }
        VerticalLayout vl = new VerticalLayout();
        vl.setWidth("100%");
        vl.setSpacing(false);
        vl.setMargin(false);
        for (BpmTask task : tasks) {
            ProcessStateConfiguration state = ctx.getProcessDefinitionDAO().getProcessStateConfiguration(task);
            vl.addComponent(createTaskComponent(task, state));
        }
        return vl;
    }
View Full Code Here

TOP

Related Classes of pl.net.bluesoft.rnd.processtool.ProcessToolContext$Util

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.