⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 getprocessdefinitionscommand.java

📁 workflow first jbpm
💻 JAVA
字号:
package org.jbpm.command;

import java.util.Iterator;
import java.util.List;

import org.jbpm.JbpmContext;
import org.jbpm.graph.def.ProcessDefinition;

/**
 * This Command returns all process definitions (or only the latest if
 * onlyLatest is true)
 * 
 * @author Bernd Ruecker (bernd.ruecker@camunda.com)
 */
public class GetProcessDefinitionsCommand extends AbstractGetObjectBaseCommand {

    private static final long serialVersionUID = -1908847549444051495L;

    private boolean onlyLatest = true;

    public GetProcessDefinitionsCommand() {
    }

    public GetProcessDefinitionsCommand(boolean onlyLatest) {
        this.onlyLatest = onlyLatest;
    }

    public Object execute(JbpmContext jbpmContext) throws Exception {
        setJbpmContext(jbpmContext);
        List result = (onlyLatest ? jbpmContext.getGraphSession().findLatestProcessDefinitions() : jbpmContext.getGraphSession().findAllProcessDefinitions());

        /*
         * traverse and access property if it is missing in the default
         * fetchgroup
         */
        Iterator iter = result.iterator();
        while (iter.hasNext()) {
            ProcessDefinition pd = (ProcessDefinition) iter.next();
            retrieveProcessDefinition(pd);
        }

        return result;
    }

    public boolean isOnlyLatest() {
        return onlyLatest;
    }

    public void setOnlyLatest(boolean onlyLatest) {
        this.onlyLatest = onlyLatest;
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -