@Override public void validate(KieSession ksession, Context<?> context) throws IllegalStateException { if (isClosed()) { throw new IllegalStateException("Runtime manager " + identifier + " is already closed"); } if (context == null || context.getContextId() == null) { return; } Long ksessionId = mapper.findMapping(context, this.identifier); if (ksessionId == null) { // make sure ksession is not use by any other context Object contextId = mapper.findContextId(ksession.getIdentifier(), this.identifier); if (contextId != null && !contextId.equals(context.getContextId().toString())) { throw new IllegalStateException("KieSession with id " + ksession.getIdentifier() + " is already used by another context " + contextId + " expected is "+ context.getContextId()); } return; } if (ksession.getIdentifier() != ksessionId) { throw new IllegalStateException("Invalid session was used for this context " + context); } }
ksession.getEnvironment().set("CaseId", context.getContextId()); } else { Object contexts = mapper.findContextId(ksession.getIdentifier(), manager.getIdentifier()); if (contexts instanceof Collection) { KieSession finalKieSession = ksession;
ksession.getEnvironment().set("CaseId", context.getContextId()); } else { Object contexts = mapper.findContextId(ksession.getIdentifier(), this.identifier); if (contexts instanceof Collection) { RuntimeEngine finalRuntimeEngnie = runtime;
@Override public void validate(KieSession ksession, Context<?> context) throws IllegalStateException { if (isClosed()) { throw new IllegalStateException("Runtime manager " + identifier + " is already closed"); } if (context == null || context.getContextId() == null) { return; } Long ksessionId = mapper.findMapping(context, this.identifier); if (ksessionId == null) { // make sure ksession is not use by any other context Object contextId = mapper.findContextId(ksession.getIdentifier(), this.identifier); if (contextId != null && !contextId.equals(context.getContextId().toString())) { throw new IllegalStateException("KieSession with id " + ksession.getIdentifier() + " is already used by another context " + contextId + " expected is "+ context.getContextId()); } return; } if (ksession.getIdentifier() != ksessionId) { throw new IllegalStateException("Invalid session was used for this context " + context); } }
@Override public void beforeProcessStarted(ProcessStartedEvent event) { String processId = event.getProcessInstance().getProcessId(); if (mapper.findContextId(ksessionId, getIdentifier()) == null) { //if no relation between process def ID and KIE Session is found, we store it mapper.saveMapping(ProcessDefContext.get(processId), ksessionId, getIdentifier()); } } }
ksession.getEnvironment().set("CaseId", context.getContextId()); } else { Object contexts = mapper.findContextId(ksession.getIdentifier(), manager.getIdentifier()); if (contexts instanceof Collection) { KieSession finalKieSession = ksession;
ksession.getEnvironment().set("CaseId", context.getContextId()); } else { Object contexts = mapper.findContextId(ksession.getIdentifier(), this.identifier); if (contexts instanceof Collection) { RuntimeEngine finalRuntimeEngnie = runtime;