Package pl.net.bluesoft.rnd.processtool

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



    @Override
  public void refreshData() {
    filterList.removeAllComponents();
    ProcessToolContext processToolContextFromThread = ProcessToolContext.Util.getThreadProcessToolContext();

    final ProcessToolBpmSession bpmSession = activityMainPane.getBpmSession();
    final UserData user = bpmSession.getUser(processToolContextFromThread);

    final ProcessInstanceFilterDAO processInstanceFilterDAO = processToolContextFromThread.getProcessInstanceFilterDAO();
    List<ProcessInstanceFilter> filters = processInstanceFilterDAO.findAllByUserData(user);

    for (final ProcessInstanceFilter filter : filters)
    {
      Button taskName = new Button(filter.getName());     
View Full Code Here


    return getMessage(key, key);
  }

  @Override
  public String getMessage(String key, String defaultValue) {
        ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
    Collection<I18NProvider> i18NProviders = new ArrayList(ctx.getRegistry().getI18NProviders());
    //1st run - full localization e.g. _pl_PL
    for (I18NProvider i18NProvider : i18NProviders) {
      if (!i18NProvider.hasFullyLocalizedMessage(key, locale)) continue;
      String m = i18NProvider.getMessage(key, locale);
      if (m != null) return m;
View Full Code Here

public class PropertyAutoWiring {
    private static final Logger logger = Logger.getLogger(PropertyAutoWiring.class.getName());

    public static void autowire(Object obj, Map<String, String> attributes) {
        ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
        Class clazz = obj.getClass();
        for (Field f : Classes.getDeclaredFields(clazz)) {
            String autoName = null;
            AutoWiredProperty awp = f.getAnnotation(AutoWiredProperty.class);
            if (awp != null) {
                autoName = AutoWiredProperty.DEFAULT.equals(awp.name()) ? f.getName() : awp.name();
            }
            String v = nvl(attributes.get(autoName), ctx.getAutowiredProperty("autowire." + autoName));
            if (autoName != null && v != null) {
                try {
                  logger.finer("Setting class " + clazz.getSimpleName() + " attribute " + autoName + " to " + v);

          Object value = ConvertUtils.convert(v, f.getType());
View Full Code Here

   
    private final static Logger logger = Logger.getLogger(SendMailStep.class.getName());

    @Override
    public String invoke(BpmStep step, Map<String, String> params) throws Exception {
        ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
        BpmNotificationService service = ctx.getRegistry().getRegisteredService(BpmNotificationService.class);
       
        Map<String, Object> data = new HashMap<String, Object>();
        String processId = step.getProcessInstance().getExternalKey();
        if (!Strings.hasText(processId))
          processId = step.getProcessInstance().getInternalId();
View Full Code Here

   
    public void onProcessStateChange(BpmTask task, ProcessInstance pi, UserData userData, boolean processStarted,
                   boolean processEnded, boolean enteringStep) {
     
        refreshConfigIfNecessary();
        ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();

//    logger.log(Level.INFO, "BpmNotificationEngine processes " + configCache.size() + " rules");
    
        for (BpmNotificationConfig cfg : configCache) {
            try {
View Full Code Here

    @Override
    public void setContext(ProcessStateConfiguration state, ProcessStateWidget configuration, I18NSource i18NSource,
                           ProcessToolBpmSession bpmSession, Application application, Set<String> permissions, boolean isOwner) {
        super.setContext(state, configuration, i18NSource, bpmSession,
                application, permissions, isOwner);
        ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
        processDictionaryRegistry = ctx.getProcessDictionaryRegistry();
    }
View Full Code Here

    ReportTemplate template = new ReportDAO().loadByName(reportName);
    if (template == null)
      throw new ReportException("Report template does not exist!");
    // COMPILE REPORT
    JasperReport jasperReport = null;
    ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
    try {
      ByteArrayInputStream contentInputStream = getContentInputStream(template.getContent());
      Thread t = Thread.currentThread();
      ClassLoader previousLoader = t.getContextClassLoader();
      try {
        ClassLoader newClassLoader = ctx.getRegistry().getModelAwareClassLoader(getClass().getClassLoader());
        t.setContextClassLoader(newClassLoader);
        jasperReport = JasperCompileManager.compileReport(contentInputStream);
      } finally {
        t.setContextClassLoader(previousLoader);
      }
    } catch (Exception e) {
      throw new ReportException("Report compilation failed!", e);
    }


    // PREPARE INPUT
    Map<String, Object> parameters = new HashMap<String, Object>();
    parameters.put(JRXPathQueryExecuterFactory.XML_DATE_PATTERN, DATETIME_PATTERN);
    parameters.put(JRParameter.REPORT_LOCALE, locale);
    parameters.put(PROCESS_CONTEXT_KEY, ctx);

    // FILL REPORT
    JasperPrint jasperPrint = null;
    try {
      Thread t = Thread.currentThread();
      ClassLoader previousLoader = t.getContextClassLoader();
      try {
        ClassLoader newClassLoader = ctx
            .getRegistry().getModelAwareClassLoader(getClass().getClassLoader());
        t.setContextClassLoader(newClassLoader);
        parameters.put(DICTIONARY_HELPER, new DictionaryHelperImpl(processInstance));
        if (jasperReport.getQuery() != null && jasperReport.getQuery().getLanguage().equals("xPath")) {
          XStream xs = new XStream();
          xs.registerConverter(new MyPersistentSetConverter(xs.getMapper()), XStream.PRIORITY_VERY_HIGH);
          xs.omitField(ProcessInstance.class, "definition");
          xs.omitField(ProcessInstance.class, "processLogs");
          String s = xs.toXML(processInstance);

          jasperPrint = JasperFillManager.fillReport(jasperReport,
                                                     parameters,
                                                     new JRXmlDataSource(
                                                         new ByteArrayInputStream(s.getBytes())
                                                     ));
        } else if (jasperReport.getQuery() != null && hasText(jasperReport.getQuery().getText())) {
          parameters.put(PROCESS_INSTANCE_ID_KEY, String.valueOf(processInstance.getId()));
          jasperPrint = JasperFillManager.fillReport(jasperReport, parameters, ctx.getHibernateSession().connection());
        } else {
          parameters.put(PROCESS_INSTANCE_KEY, processInstance);
          jasperPrint = JasperFillManager.fillReport(jasperReport,
                                                     parameters,
                                                     new JREmptyDataSource());

        }
      } finally {
        t.setContextClassLoader(previousLoader);
      }
    } catch (Exception e) {
      throw new ReportException("Report filling failed!", e);
    }

    // EXPORT REPORT
    byte[] report = null;
    try {
      Thread t = Thread.currentThread();
      ClassLoader previousLoader = t.getContextClassLoader();
      try {
        ClassLoader newClassLoader = ctx
            .getRegistry().getModelAwareClassLoader(getClass().getClassLoader());
        t.setContextClassLoader(newClassLoader);
        report = exportReport(jasperPrint, format, encoding);
      } finally {
        t.setContextClassLoader(previousLoader);
View Full Code Here

        Thread t = Thread.currentThread();*/
        try {
            ReportTemplate template = new ReportDAO().loadByName(reportName);
            if (template == null)
                throw new Exception("Report template does not exist for name: ".concat(reportName));
            ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
            ByteArrayInputStream contentInputStream = new ByteArrayInputStream(Base64.decodeBase64(
                    (new String(template.getContent())).getBytes("UTF-8")));
//            previousLoader = t.getContextClassLoader();
//            ClassLoader newClassLoader = ctx.getRegistry().getModelAwareClassLoader(
//                    JasperReportingUtil.class.getClassLoader());
View Full Code Here

    public DictionaryHelperImpl(ProcessInstance processInstance) {
        init(processInstance);
    }
   
    private void init(ProcessInstance processInstance) {
        ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
        processDictionaryRegistry = ctx.getProcessDictionaryRegistry();
        processDefinitionConfig = processInstance.getDefinition();
        dictionaryMap = new HashMap<String, Map<String, String>>();
    }
View Full Code Here

        }
    }

    @Override
    public void withTransaction(final ProcessToolGuiCallback r) {
        ProcessToolContext ctx = ProcessToolContext.Util.getThreadProcessToolContext();
        r.callback(ctx, bpmSession);
    }
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.