Package org.jbpm.ejb.impl

Source Code of org.jbpm.ejb.impl.ExecuteJobCommand

package org.jbpm.ejb.impl;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jbpm.JbpmContext;
import org.jbpm.command.Command;
import org.jbpm.db.JobSession;
import org.jbpm.job.Job;

public class ExecuteJobCommand implements Command {

  private static final long serialVersionUID = 1L;
 
  long jobId;
 
  public ExecuteJobCommand(long jobId) {
    this.jobId = jobId;
  }

  public Object execute(JbpmContext jbpmContext) throws Exception {
    JobSession jobSession = jbpmContext.getJobSession();
    log.debug("loading job "+jobId);
    Job job = jobSession.loadJob(jobId);
    log.debug("executing job "+jobId);
    if (!job.execute(jbpmContext)) {
      log.warn("job "+jobId+" was not supposed to be deleted");
    }
    jobSession.deleteJob(job);
    return null;
  }

  private static Log log = LogFactory.getLog(ExecuteJobCommand.class);
}
TOP

Related Classes of org.jbpm.ejb.impl.ExecuteJobCommand

TOP
Copyright © 2018 www.massapi.com. 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.