public PerCaseRuntimeManager(RuntimeEnvironment environment, SessionFactory factory, TaskServiceFactory taskServiceFactory, String identifier) { super(environment, identifier); this.factory = factory; this.taskServiceFactory = taskServiceFactory; this.mapper = ((org.kie.internal.runtime.manager.RuntimeEnvironment) environment).getMapper(); this.registry.register(this); }
public PerRequestRuntimeManager(RuntimeEnvironment environment, SessionFactory factory, TaskServiceFactory taskServiceFactory, String identifier) { super(environment, identifier); this.factory = factory; this.taskServiceFactory = taskServiceFactory; this.registry.register(this); }
@Override public Void execute(org.kie.api.runtime.Context context) { mapper.saveMapping(caseContext, ksessionId, ownerId); return null; } }
public boolean validate(Long ksessionId, Long processInstanceId) { Long mapped = this.mapper.findMapping(ProcessInstanceIdContext.get(processInstanceId), this.identifier); if (Objects.equals(mapped, ksessionId)) { return true; } return false; }
public List<String> getDeployments() { List<String> deploymentIds = new ArrayList<>(RuntimeManagerRegistry.get().getRegisteredIdentifiers()); // add jbpm as trigger group for backward compatibility deploymentIds.add("jbpm"); return deploymentIds; }
protected Map<String, WorkItemHandler> getWorkItemHandlersFromDescriptor(RuntimeEngine runtime) { Map<String, WorkItemHandler> defaultHandlers = new HashMap<String, WorkItemHandler>(); DeploymentDescriptor descriptor = getRuntimeManager().getDeploymentDescriptor(); if (descriptor != null) { Map<String, Object> params = getParametersMap(runtime); for (NamedObjectModel model : descriptor.getWorkItemHandlers()) { Object hInstance = getInstanceFromModel(model, getRuntimeManager().getEnvironment().getClassLoader(), params); if (hInstance != null) { defaultHandlers.put(model.getName(), (WorkItemHandler) hInstance); } } } return defaultHandlers; }
public RuntimeManager getManager(Task task) { return registry.getManager(task.getTaskData().getDeploymentId()); }
protected Properties loadJMSProperties() throws IOException { Properties properties = new Properties(); InputStream input = getRuntimeManager().getEnvironment().getClassLoader().getResourceAsStream("/jbpm.audit.jms.properties"); // required for junit test if (input == null) { input = getRuntimeManager().getEnvironment().getClassLoader().getResourceAsStream("jbpm.audit.jms.properties"); } properties.load(input); return properties; } }
@Override public AuditService getAuditService() { if (auditService == null) { boolean usePersistence = ((InternalRuntimeManager)manager).getEnvironment().usePersistence(); if (usePersistence) { auditService = new JPAAuditLogService(getKieSession().getEnvironment()); } else { throw new UnsupportedOperationException("AuditService was not configured, supported only with persistence"); } } return auditService; }
@Override public void close() { if (singleton == null) { return; } super.close(); // dispose singleton session only when manager is closing try { removeRuntimeFromTaskService(); } catch (UnsupportedOperationException e) { logger.debug("Exception while closing task service, was it initialized? {}", e.getMessage()); } if (this.singleton instanceof Disposable) { ((Disposable) this.singleton).dispose(); } factory.close(); this.singleton = null; }
@Override public void close() { try { if (!(taskServiceFactory instanceof LocalTaskServiceFactory)) { // if it's CDI based (meaning single application scoped bean) we need to unregister context removeRuntimeFromTaskService(); } } catch(Exception e) { // do nothing } super.close(); factory.close(); }
@Override public void activate() { super.activate(); // need to init one session to bootstrap all case - such as start timers KieSession initialKsession = factory.newKieSession(); initialKsession.execute(new DestroyKSessionCommand(initialKsession, this)); }
protected void checkPermission() { if (this.securityManager != null) { this.securityManager.checkPermission(); } }
@Override public Void execute(org.kie.api.runtime.Context context) { mapper.removeMapping(caseContext, ownerId); return null; } }
@Override public KieSession findKieSessionById(Long sessionId) { if (sessions.containsKey(sessionId)) { return sessions.get(sessionId); } else { throw new SessionNotFoundException("Session with id " + sessionId + " was not found"); } }
public boolean validate(Long ksessionId, Long processInstanceId) { Long mapped = this.mapper.findMapping(ProcessInstanceIdContext.get(processInstanceId), this.identifier); if (Objects.equals(mapped, ksessionId)) { return true; } return false; }
protected Map<String, Object> getGlobalsFromDescriptor(RuntimeEngine runtime) { Map<String, Object> globals = new HashMap<String, Object>(); DeploymentDescriptor descriptor = getRuntimeManager().getDeploymentDescriptor(); if (descriptor != null) { Map<String, Object> params = getParametersMap(runtime); for (NamedObjectModel model : descriptor.getGlobals()) { Object gInstance = getInstanceFromModel(model, getRuntimeManager().getEnvironment().getClassLoader(), params); if (gInstance != null) { globals.put(model.getName(), gInstance); } } } return globals; }
public PerProcessInstanceRuntimeManager(RuntimeEnvironment environment, SessionFactory factory, TaskServiceFactory taskServiceFactory, String identifier) { super(environment, identifier); this.factory = factory; this.taskServiceFactory = taskServiceFactory; this.mapper = ((org.kie.internal.runtime.manager.RuntimeEnvironment)environment).getMapper(); this.registry.register(this); }
@Override public void close() { try { if (!(taskServiceFactory instanceof LocalTaskServiceFactory)) { // if it's CDI based (meaning single application scoped bean) we need to unregister context removeRuntimeFromTaskService(); } } catch(Exception e) { // do nothing } super.close(); factory.close(); }
@Override public void close() { try { if (!(taskServiceFactory instanceof LocalTaskServiceFactory)) { // if it's CDI based (meaning single application scoped bean) we need to unregister context removeRuntimeFromTaskService(); } } catch (Exception e) { // do nothing } super.close(); factory.close(); }