use of org.kie.api.runtime.Context in project drools by kiegroup.
the class GetContextCommand method execute.
@Override
public Void execute(Context context) {
Context returned = ((RegistryContext) context).getContextManager().getContext(name);
((RequestContextImpl) context).setApplicationContext(returned);
return null;
}
use of org.kie.api.runtime.Context in project drools by kiegroup.
the class NewContextCommand method execute.
@Override
public Void execute(Context context) {
Context returned = ((RegistryContext) context).getContextManager().createContext(name);
((RequestContextImpl) context).setApplicationContext(returned);
return null;
}
use of org.kie.api.runtime.Context in project drools by kiegroup.
the class ConversationContextManager method joinConversation.
public void joinConversation(RequestContextImpl requestContext, String conversationId) {
Context ctx = conversationContexts.get(conversationId);
if (ctx == null) {
throw new RuntimeException("Conversation cannot be found");
}
requestContext.setConversationContext(ctx);
}
use of org.kie.api.runtime.Context in project drools by kiegroup.
the class SetVariableCommandFromLastReturn method execute.
public Object execute(Context context) {
Context targetCtx;
if (this.contextName == null) {
targetCtx = context;
} else {
targetCtx = ((RegistryContext) context).getContextManager().getContext(this.contextName);
}
GetDefaultValue sim = (GetDefaultValue) context.get("simulator");
Object o = sim.getObject();
// for FactHandle's we store the handle on a map and the actual object as
if (o instanceof FactHandle) {
Map<String, FactHandle> handles = (Map<String, FactHandle>) targetCtx.get("h");
if (handles == null) {
handles = new HashMap<String, FactHandle>();
targetCtx.set("h", handles);
}
handles.put(identifier, (FactHandle) o);
o = ((InternalFactHandle) o).getObject();
}
targetCtx.set(identifier, o);
return o;
}
use of org.kie.api.runtime.Context in project drools by kiegroup.
the class ContextManagerImpl method createContext.
public Context createContext(String identifier) {
Context ctx = this.contexts.get(identifier);
if (ctx == null) {
ctx = new ContextImpl(identifier, this, root);
this.contexts.put(identifier, ctx);
}
return ctx;
}
Aggregations