Package org.springmodules.workflow.jbpm31

Examples of org.springmodules.workflow.jbpm31.JbpmFactoryLocatorTests


    public static String serializeIdList(Long... ids) {
        return StringUtils.join(ids, ",");
    }

    public long getProcessInstanceIdForTaskInstance(final long taskInstanceId) {
        return (Long) getJbpmTemplate().execute(new JbpmCallback() {
            public Object doInJbpm(JbpmContext jbpmContext) throws JbpmException {
                TaskInstance ti = getTaskInstance(taskInstanceId);
                ProcessInstance pi = ti.getToken().getProcessInstance();
                return pi.getId();
            }
View Full Code Here


            }
        });
    }

    public void startProcessInstance(final long processInstanceId) {
        jbpmTemplate.execute(new JbpmCallback() {
            public Object doInJbpm(JbpmContext jbpmContext) throws JbpmException {
                ProcessInstance processInstance = jbpmContext.getProcessInstance(processInstanceId);
                processInstance.signal();
                jbpmContext.save(processInstance);
                return null;
View Full Code Here

            }
        });
    }

    public ProcessInstance createProcessInstance(final String flowName, final Map<String, Object> vars) {
        return (ProcessInstance) jbpmTemplate.execute(new JbpmCallback() {
            public Object doInJbpm(JbpmContext jbpmContext) throws JbpmException {
                ProcessInstance processInstance = createNewProcessInstance(flowName);
                jbpmContext.save(processInstance);
                if (null != vars) {
                    for (String varName : vars.keySet()) {
View Full Code Here

    public void lockTaskInstance(final long taskInstanceId, final String actor) {
        if (taskInstanceId <= 0) {
            return;
        }
        getJbpmTemplate().execute(new JbpmCallback() {
            public Object doInJbpm(JbpmContext jbpmContext) throws JbpmException {
                TaskInstance taskInstance = getTaskInstance(taskInstanceId);
                if (taskInstance != null) {
                    if (taskInstance.getStart() == null && !taskInstance.isCancelled() && !taskInstance.hasEnded()) {
                        taskInstance.start(actor);
View Full Code Here

        Hibernate.initialize(pi);
        return pi;
    }

    protected TaskInstance getTaskInstance(final long tid) {
        return (TaskInstance) getJbpmTemplate().execute(new JbpmCallback() {
            public Object doInJbpm(JbpmContext jbpmContext) throws JbpmException {
                try {
                    return _taskInstance(jbpmContext.getSession(), jbpmContext, tid);
                } catch (Throwable throwable) {
                    //       getLoggingUtils().log(throwable);
View Full Code Here

        return taskInstance;
    }

    public void unlockTaskInstance(final long taskInstanceId) {
        if (taskInstanceId != 0) {
            getJbpmTemplate().execute(new JbpmCallback() {
                public Object doInJbpm(JbpmContext jbpmContext) throws JbpmException {
                    TaskInstance ti = getTaskInstance(taskInstanceId);
                    ti.suspend();
                    jbpmContext.save(ti);
                    return null;
View Full Code Here

    public void completeTaskInstance(final long taskInstanceId) {
        if (taskInstanceId == 0) {
            return;
        }
        getJbpmTemplate().execute(new JbpmCallback() {
            public Object doInJbpm(JbpmContext jbpmContext) throws JbpmException {
                TaskInstance taskInstance = getTaskInstance(taskInstanceId);
                if (taskInstance.getEnd() == null && !taskInstance.hasEnded()) {
                    taskInstance.end();
                    jbpmContext.save(taskInstance);
View Full Code Here

            }
        });
    }

    public void setProcessVariableFor(final long processinstanceid, final String name, final Object val) {
        getJbpmTemplate().execute(new JbpmCallback() {
            public Object doInJbpm(JbpmContext context) throws JbpmException {
                final String fName = StringUtils.defaultString(name);
                boolean wasValNull = val == null;
                final String fVal = wasValNull ? StringUtils.EMPTY : val.toString();
                //   getLoggingUtils().log(String.format("setting [%s]=[%s] ", fName, fVal, fName, !wasValNull ? "not " : ""));
View Full Code Here

            setProcessVariableFor(processInstanceId, varName, vals.get(varName));
        }
    }

    public Long getNextTaskInstanceByActorAndCriteria(final String actor, final Map<String, Object> vars) {
        Object result = getJbpmTemplate().execute(new JbpmCallback() {
            public Object doInJbpm(JbpmContext jbpmContext) throws JbpmException {
                Collection<Long> tis = getOpenTaskInstancesByActorAndCriteria(actor, vars);
                if (tis != null && tis.size() > 0) {
                    return tis.iterator().next();
                }
View Full Code Here

    public Long getNextTaskInstanceByActor(final String actor) {
        return getNextTaskInstanceByActorAndCriteria(actor, null);
    }

    public Map<String, Object> getProcessVariablesFor(final long processInstanceId) {
        Map<String, Object> variableMap = (Map<String, Object>) getJbpmTemplate().execute(new JbpmCallback() {
            public Object doInJbpm(JbpmContext jbpmContext) throws JbpmException {
                ProcessInstance pi = jbpmContext.getProcessInstance(processInstanceId);
                Map vars = pi.getContextInstance().getVariables();
                return vars;
            }
View Full Code Here

TOP

Related Classes of org.springmodules.workflow.jbpm31.JbpmFactoryLocatorTests

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.