代码之家  ›  专栏  ›  技术社区  ›  HeDinges

在jBpm中,如何获得流/流程中已采取的所有转换?

  •  0
  • HeDinges  · 技术社区  · 17 年前

    在jboss jBpm中,是否可以获取在一个进程执行期间执行的所有转换?


    用例是:我们希望现在所有的节点,任务节点。。。那是 用户

    这将显示从当前活动令牌/节点到 开始 任务。

    一些 不起作用的想法

    • 获取活动令牌及其对应的节点,并通过到达的变换向上移动变换。这不起作用,因为可以传入多个转换,所以我们不知道采取了哪个转换。

    可能我应该调查JBPMèLOG表,但是我没有找到一个正确的方法(API)来查询这个表。欢迎对任何在线文档提出任何建议。

    注意:我们正在使用 jBpm公司版本:3.3.1

    3 回复  |  直到 17 年前
        1
  •  0
  •   Vanger    17 年前

    是的,如果需要获得转换,则需要使用jbpm\u log表。要获取所有节点,您只需要jbpm\u taskInstance表。 我唯一需要的文件是: http://docs.jboss.org/jbpm/v3/javadoc/ 这是方法的代码。CriteriaSQL是我们的CriteriaParams包装器。

        private String getTaskTransition(LFTaskInstance instance) {     
            CriteriaSQL csql = new CriteriaSQL(new CriteriaParams());
    
    
            String query = "SELECT l " +
                " FROM org.jbpm.taskmgmt.log.TaskCreateLog l " +
                " WHERE l.taskInstance = " + instance.getId();      
    
            Query c =((HibernateSession)em).getHibernateSession().createQuery(csql.getQueryString(query));
            TaskCreateLog logEntry  = (TaskCreateLog) c.uniqueResult(); 
            int index = logEntry.getIndex();
            Long token = logEntry.getToken().getId();
    
            //Find bottom log index of transition which greater then log index of current instance creation
            String subQuery = "SELECT min(jbpmLog.index) " + 
                    " FROM org.jbpm.graph.log.TransitionLog as jbpmLog " +
                    " where jbpmLog.token = trLog.token AND " + //reference to query below
                            " jbpmLog.index > " + index; 
    
            //Find transition name from its Definition by log index of made transition
            query = " SELECT trans.name FROM org.jbpm.graph.def.Transition as trans " +
                    " WHERE trans.id = " +
            " (SELECT min(transition.id) " +
            " FROM org.jbpm.graph.log.TransitionLog trLog " +
            " WHERE trLog.token = " + token + 
            "       and trLog.index = (" + subQuery + "))";
    
            c =((HibernateSession)em).getHibernateSession().createQuery(csql.getQueryString(query));
            return (String) c.uniqueResult();
        }
    
        2
  •  0
  •   Zoidberg    17 年前

    这是针对已经完成或部分处理的流程的吗?如果没有,那么可以在每个出口转换上放置一个操作处理程序,通过在当前标记中查找来记录转换的名称。

        3
  •  0
  •   ajuc    15 年前

    我们像这样使用sql select(必须在文件中启用登录到表JBPM\u LOG)jbpm.cfg.xml文件):

    select distinct *
      from (select level,
                   l.date_,
                   pd1.name_ p1,
                   n1.name_ n1,
                   pd2.name_ p2,
                   n2.name_ n2
              from juser.jbpm_log               l,
                   juser.jbpm_node              n1,
                   juser.jbpm_node              n2,
                   juser.jbpm_processdefinition pd1,
                   juser.jbpm_processdefinition pd2,
                   juser.jbpm_token             t,
                   juser.jbpm_processinstance   pi,
                   juser.jbpm_token             t2
             where l.class_ = 'T'
               and n1.id_ = l.sourcenode_
               and n2.id_ = l.destinationnode_
               and n1.processdefinition_ = pd1.id_
               and n2.processdefinition_ = pd2.id_
               and t.id_ = l.token_
               and t.processinstance_ = pi.id_
               and pi.superprocesstoken_ = t2.id_
            connect by prior pi.id_ = t2.processinstance_
             start with pi.id_ =
                        (select id_
                           from (select pi.id_
                                   from juser.jbpm_processinstance pi,
                                        juser.jbpm_token           t
                                  where pi.superprocesstoken_ = t.id_
                                 connect by prior t.processinstance_ = pi.id_
                                  start with pi.id_ = <<<ID_OF_PROCESSINSTANCE>>>
                                  order by pi.id_)
                          where rownum = 1)
             order by l.date_)
     order by date_;
    

    这使用的是connectby prior-我不知道这是否适用于除oracle之外的任何东西。

    推荐文章