public void fireTimer(Long helperId, Long eventId) { if (helperId == null) { throw new ResourcePlanningException("fire timer --> no helper id provided!!"); } if (eventId == null) { throw new ResourcePlanningException("fire timer --> no event id provided!!"); } ProcessEngine processEngine = BpmPlatform.getDefaultProcessEngine(); String businessKey = BusinessKeys.generateRequestHelpBusinessKey(helperId, eventId); List<ProcessInstance> executions = processEngine .getRuntimeService() .createProcessInstanceQuery() .processInstanceBusinessKey(businessKey) .list(); if ((executions == null) || (executions.size() != 1)) { throw new ResourcePlanningException( "none or more than one executions found for business key '" + businessKey + "'!!"); } Execution execution = executions.get(0); List<Job> jobs = processEngine .getManagementService() .createJobQuery() .processInstanceId(execution.getId()) .list(); if ((jobs == null) || (jobs.size() == 0)) { throw new ResourcePlanningException( "no jobs found for execution with business key '" + businessKey + "'!!"); } for (Job job : jobs) { processEngine.getManagementService().executeJob(job.getId()); } }
public void startHelperRequestProcess(Long helperId, Long eventId) { Map<String, Object> variables = new HashMap<String, Object>(); variables.put(BpmVariables.RequestHelpHelper.VAR_HELPER_ID, new Long(helperId)); variables.put(BpmVariables.Misc.VAR_EVENT_ID, new Long(eventId)); BpmPlatform.getDefaultProcessEngine() .getRuntimeService() .startProcessInstanceByMessage( BpmMessages.RequestHelpHelper.MSG_HELP_TRIG, BusinessKeys.generateRequestHelpBusinessKey(helperId, eventId), variables); }