Package pl.net.bluesoft.rnd.processtool

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


            }
        } else {
            PortletSession session = ((PortletApplicationContext2) (getContext())).getPortletSession();
            bpmSession = (ProcessToolBpmSession) session.getAttribute("bpmSession", PortletSession.APPLICATION_SCOPE);
            if (bpmSession == null) {
                ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
                session.setAttribute("bpmSession",
                        bpmSession = ctx.getProcessToolSessionFactory().createSession(user, userRoles),
                        PortletSession.APPLICATION_SCOPE);
            }
            setUser(user);
           
        }
View Full Code Here


    @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;
                }
            }
            userSubstitution.setUserSubstitute(substituteUser);
            ctx.getUserSubstitutionDAO().saveOrUpdate(userSubstitution);
            logger.warning("Added substitution for user " + userSubstitution.getUser().getLogin());
            return STATUS_OK;
        }
        catch (Exception e) {
            logger.log(Level.SEVERE, e.getMessage(), e);
View Full Code Here

    if (application instanceof GenericVaadinPortlet2BpmApplication) {
      GenericVaadinPortlet2BpmApplication o = (GenericVaadinPortlet2BpmApplication) application;
      showKeys = o.showKeys();
    }

    ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
    ProcessDictionaryRegistry registry = ctx.getProcessDictionaryRegistry();

    List<ProcessDictionary> dictionaries = new ArrayList<ProcessDictionary>();

    for (ProcessDefinitionConfig definition : definitions) {
      ProcessDictionary dictProcess = registry.getSpecificOrDefaultProcessDictionary(definition, "db", dictionary, i18NSource.getLocale().toString());
View Full Code Here

     
      if(dialog==null){
        super.invokeBpmTransition();
      }
      else{
        ProcessToolContext ctx = getCurrentContext();
    String login = dialog.getAssigneeBean().getAssignee().getLogin();
    bpmSession.assignTaskToUser(ctx, task.getInternalTaskId(), login);
        callback.getWidgetContextSupport().updateTask(task);
        logger.info("Assigneed user: " + login);
      }
View Full Code Here

* @author mpawlak
*/
public class HelpUtility {
  public static Component helpIcon(final Application application, final I18NSource i18NSource, ContextHelp contextHelp, String dictionary, String key,
      Boolean showDebugKey, Component optionalComponent, Placement popupPlacement) {
    ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
    ProcessDictionaryRegistry processDictionaryRegistry = ctx.getProcessDictionaryRegistry();
    ProcessDictionary dict = processDictionaryRegistry.getSpecificOrDefaultGlobalDictionary("db", dictionary, i18NSource.getLocale().toString());

    return helpIcon(dict, application, i18NSource, contextHelp, key, showDebugKey, optionalComponent, popupPlacement);
  }
View Full Code Here

    private void saveComment() {
    if (skipAddingComment) {
      return;
    }
        ProcessToolContext ctx = getCurrentContext();
    ProcessComment pc = dialog.getProcessComment();
        pc.setAuthor(ctx.getUserDataDAO().loadOrCreateUserByLogin(loggedUser));
        pc.setAuthorSubstitute(substitutingUser != null ? ctx.getUserDataDAO().loadOrCreateUserByLogin(substitutingUser) : null);
        pc.setCreateTime(new Date());
        pc.setProcessState(task.getTaskName());
        ProcessInstance pi = task.getProcessInstance().getRootProcessInstance();
        ProcessComments comments = pi.findAttributeByClass(ProcessComments.class);
        if (comments == null) {
View Full Code Here

            logger.info("Event contained no persistent process instance. Omitting.");
            return;
        }
        String internalId = pi.getInternalId();
        logger.info("Processing deadlines for process: " + internalId);
        ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
        pi = ctx.getProcessInstanceDAO().getProcessInstance(pi.getId());
        if (pi == null) {
            throw new ProcessToolException("Unable to find process instance by internal id: " + internalId);
        }
        Set<ProcessDeadline> deadlines = pi.findAttributesByClass(ProcessDeadline.class);
        if (!deadlines.isEmpty()) {
            logger.info("Found deadline configurations for process: " + pi.getInternalId());
            ProcessToolBpmSession bpmSession = ctx.getProcessToolSessionFactory().createAutoSession();
            List<BpmTask> tasks = processInitiated || task == null ? bpmSession.findProcessTasks(pi, ctx) : new ArrayList<BpmTask>() {{
                add(task);
            }};
            if (!tasks.isEmpty()) {
                Set<String> taskNames = new HashSet<String>();
View Full Code Here

  }

  protected abstract void performAction(WidgetContextSupport support);

  protected void invokeBpmTransition() {
    ProcessToolContext ctx = getCurrentContext();
    task = bpmSession.performAction(definition, task, ctx);
    if (task == null || task.isFinished()) {
      showTransitionNotification();
    }
    if (task == null) {
View Full Code Here

            UserData user = (UserData) application.getUser();
            if (user.containsRole(HISTORY_SUPERUSER_ROLE_NAME)) {
                isHistorySuperuser = true;
            }
            else {
                ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
                String config = ctx.getSetting(HISTORY_SUPERUSER_CONFIG_KEY);
                if (Strings.hasText(config)) {
                    for (String roleName : config.split(",")) {
                        if (user.containsRole(roleName)) {
                            isHistorySuperuser = true;
                            break;
View Full Code Here

    public void refreshData() {
        logContainer.removeAllItems();
        searchField.setValue("");
        table.setValue(null);
        if (bpmSession != null) {
            ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
            UserData user = isHistorySuperuser ? null : bpmSession.getUser(ctx);
            Collection<ProcessInstanceLog> logs = ctx.getProcessInstanceDAO().getUserHistory(user,
                    dateRangeField.getStartDate(), dateRangeField.getEndDate());
            DateFormat dateFormat = VaadinUtility.fullDateFormat();
            for (ProcessInstanceLog log : logs) {
                Item item = logContainer.addItem(log);
                item.getItemProperty("log.entryDate").setValue(dateFormat.format(log.getEntryDate().getTime()));
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.