コード例 #1
0
ファイル: JbpmExtensionManager.java プロジェクト: jior/glaf
  public synchronized void reconfig(JbpmContext jbpmContext, List<Extension> extensions) {
    if (extensions != null && extensions.size() > 0) {
      Iterator<Extension> iter = extensions.iterator();
      while (iter.hasNext()) {
        Extension extension = iter.next();
        String extendId = null;
        String processName = extension.getProcessName();
        if (StringUtils.isNotEmpty(processName)) {
          if (StringUtils.isNotEmpty(extension.getTaskName())) {
            extendId = processName + "_" + extension.getTaskName();
          } else if (StringUtils.isNotEmpty(extension.getName())) {
            extendId = processName + "_" + extension.getName();
          }
        }

        if (StringUtils.isEmpty(extendId)) {
          if (StringUtils.isNotEmpty(extension.getName())) {
            extendId = extension.getName();
          }
        }

        String sql = " delete from EX_JBPM_EXFIELD where EXTENDID_ = '" + extendId + "'";
        jbpmEntityDAO.executeSqlUpdate(jbpmContext, sql);
        sql = " delete from EX_JBPM_EXPARAM where EXTENDID_ = '" + extendId + "'";
        jbpmEntityDAO.executeSqlUpdate(jbpmContext, sql);
        sql = " delete from EX_JBPM_EXTENSION where EXTENDID_ = '" + extendId + "'";
        jbpmEntityDAO.executeSqlUpdate(jbpmContext, sql);

        extension.setExtendId(extendId);
        extension.setCreateDate(new Date());
      }

      jbpmEntityDAO.saveAll(jbpmContext, extensions);
    }
  }
コード例 #2
0
ファイル: JbpmExtensionManager.java プロジェクト: jior/glaf
  public List<Extension> getExtensionTasks(JbpmContext jbpmContext, String processName) {
    List<Extension> extensions = new java.util.ArrayList<Extension>();
    SqlExecutor queryExecutor = new SqlExecutor();
    String hql =
        " select a from "
            + Extension.class.getSimpleName()
            + " as a where a.processName = :processName and a.taskName is not null and a.locked = 0 ";
    Map<String, Object> paramMap = new java.util.HashMap<String, Object>();
    paramMap.put("processName", processName);
    queryExecutor.setSql(hql);
    queryExecutor.setParameter(paramMap);

    List<Object> rows = jbpmEntityDAO.getList(jbpmContext, queryExecutor);
    if (rows != null && rows.size() > 0) {
      ProcessDefinition processDefinition =
          jbpmContext.getGraphSession().findLatestProcessDefinition(processName);
      Map<String, Task> taskMap = processDefinition.getTaskMgmtDefinition().getTasks();
      Iterator<Object> iterator = rows.iterator();
      while (iterator.hasNext()) {
        Extension model = (Extension) iterator.next();
        model.setProcessDescription(processDefinition.getDescription());
        Task task = taskMap.get(model.getTaskName());
        model.setTaskDescription(task.getDescription());
        extensions.add(model);
      }
    }
    return extensions;
  }