Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package org.drools.impl.adapters;
  
 import  org.kie.api.event.rule.RuleRuntimeEventListener;
 import  org.kie.api.runtime.rule.EntryPoint;
 import  org.kie.api.runtime.rule.Row;
 import  org.kie.internal.runtime.KnowledgeRuntime;
 
 import java.util.Map;
 
 import static org.drools.impl.adapters.FactHandleAdapter.adaptFactHandles;
 import static org.drools.impl.adapters.ProcessInstanceAdapter.adaptProcessInstances;
 
 
     public final KnowledgeRuntime delegate;
 
     private final Map<WorkingMemoryEventListener, RuleRuntimeEventListener> wimListeners = new HashMap<WorkingMemoryEventListener, RuleRuntimeEventListener>();
     private final Map<ProcessEventListener, org.kie.api.event.process.ProcessEventListener> processListeners = new HashMap<ProcessEventListener, org.kie.api.event.process.ProcessEventListener>();
     private final Map<AgendaEventListener, org.kie.api.event.rule.AgendaEventListener> agendaListeners = new HashMap<AgendaEventListener, org.kie.api.event.rule.AgendaEventListener>();
 
     public KnowledgeRuntimeAdapter(KnowledgeRuntime delegate) {
         this. = delegate;
     }
 
     public <T extends SessionClock> T getSessionClock() {
         final org.kie.api.time.SessionClock delegateClock = .getSessionClock();
         if (delegateClock instanceof org.drools.core.time.SessionPseudoClock) {
             return (T) new SessionPseudoClock() {
                 @Override
                 public long advanceTime(long amountTimeUnit unit) {
                     return ((org.drools.core.time.SessionPseudoClock)delegateClock).advanceTime(amountunit);
                 }
 
                 @Override
                 public long getCurrentTime() {
                     return delegateClock.getCurrentTime();
                 }
             };
         }
         return (T)new SessionClock() {
             @Override
             public long getCurrentTime() {
                 return delegateClock.getCurrentTime();
             }
         };
     }
 
     public void setGlobal(String identifierObject value) {
         .setGlobal(identifiervalue);
     }
 
     public Object getGlobal(String identifier) {
         return .getGlobal(identifier);
     }
 
     public Globals getGlobals() {
         return new GlobalsAdapter(.getGlobals());
     }
 
     public Calendars getCalendars() {
         return new CalendarsAdapter(.getCalendars());
     }
 
     public Environment getEnvironment() {
         return new EnvironmentAdapter(.getEnvironment());
     }
 
     public KnowledgeBase getKnowledgeBase() {
         return new KnowledgeBaseAdapter((org.kie.internal.KnowledgeBase).getKieBase());
     }
 
     public void registerExitPoint(String nameExitPoint exitPoint) {
         throw new UnsupportedOperationException("This operation is no longer supported");
    }
    public void unregisterExitPoint(String name) {
        throw new UnsupportedOperationException("This operation is no longer supported");
    }
    public void registerChannel(String nameChannel channel) {
        .registerChannel(namenew ChannelAdapter(channel));
    }
    @Override
    public void unregisterChannel(String name) {
        .unregisterChannel(name);
    }
    @Override
    public Map<StringChannelgetChannels() {
        Map<StringChannelchannels = new HashMap<StringChannel>();
        for (final Map.Entry<String, org.kie.api.runtime.Channel> entry : .getChannels().entrySet()) {
            channels.put(entry.getKey(), new Channel() {
                @Override
                public void send(Object object) {
                    entry.getValue().send(object);
                }
            });
        }
        return channels;
    }
    @Override
        return new KnowledgeSessionConfigurationAdapter(.getSessionConfiguration());
    }
    public void addEventListener(ProcessEventListener listener) {
        org.kie.api.event.process.ProcessEventListener adapted = new ProcessEventListenerAdapter(listener);
        .put(listeneradapted);
        .addEventListener(adapted);
    }
    public void removeEventListener(ProcessEventListener listener) {
    	.removeEventListener(.remove(listener));
    }
    	return .keySet();
    }
    public ProcessInstance startProcess(String processId) {
        return new ProcessInstanceAdapter(.startProcess(processId));
    }
    public ProcessInstance startProcess(String processIdMap<StringObjectparameters) {
        return new ProcessInstanceAdapter(.startProcess(processIdparameters));
    }
    public ProcessInstance createProcessInstance(String processIdMap<StringObjectparameters) {
        return new ProcessInstanceAdapter(.createProcessInstance(processIdparameters));
    }
    public ProcessInstance startProcessInstance(long processInstanceId) {
        return new ProcessInstanceAdapter(.startProcessInstance(processInstanceId));
    }
    public void signalEvent(String typeObject event) {
        .signalEvent(typeevent);
    }
    public void signalEvent(String typeObject eventlong processInstanceId) {
        .signalEvent(typeeventprocessInstanceId);
    }
        return adaptProcessInstances(.getProcessInstances());
    }
    public ProcessInstance getProcessInstance(long processInstanceId) {
        return new ProcessInstanceAdapter(.getProcessInstance(processInstanceId));
    }
    public ProcessInstance getProcessInstance(long processInstanceIdboolean readonly) {
        return new ProcessInstanceAdapter(.getProcessInstance(processInstanceIdreadonly));
    }
    public void abortProcessInstance(long processInstanceId) {
        .abortProcessInstance(processInstanceId);
    }
    	return new WorkItemManagerAdapter(.getWorkItemManager());
    }
    public void halt() {
        .halt();
    }
    public Agenda getAgenda() {
        return new AgendaAdapter(.getAgenda());
    }
        EntryPoint entryPoint = .getEntryPoint(name);
        return entryPoint == null ? null : new WorkingMemoryEntryPointAdapter(entryPoint);
    }
        for (EntryPoint ep : .getEntryPoints()) {
            result.add(new WorkingMemoryEntryPointAdapter(ep));
        }
        return result;
    }
    public QueryResults getQueryResults(String queryObject... arguments) {
        if (arguments != null) {
            for (int i = 0; i < arguments.lengthi++) {
                if (arguments[iinstanceof Variable) {
                    arguments[i] = org.kie.api.runtime.rule.Variable.v;
                }
            }
        }
        return new QueryResultsAdapter(.getQueryResults(queryarguments));
    }
    public LiveQuery openLiveQuery(String queryObject[] argumentsfinal ViewChangedEventListener listener) {
        return new LiveQueryAdapter(.openLiveQuery(queryargumentsnew org.kie.api.runtime.rule.ViewChangedEventListener() {
            @Override
            public void rowInserted(Row row) {
                listener.rowAdded(new RowAdapter(row));
            }
            @Override
            public void rowDeleted(Row row) {
                listener.rowRemoved(new RowAdapter(row));
            }
            @Override
            public void rowUpdated(Row row) {
                listener.rowUpdated(new RowAdapter(row));
            }
        }));
    }
    public String getEntryPointId() {
        return .getEntryPointId();
    }
    public FactHandle insert(Object object) {
        return new FactHandleAdapter(.insert(object));
    }
    public void retract(FactHandle handle) {
        .retract(((FactHandleAdapterhandle).getDelegate());
    }
    public void update(FactHandle handleObject object) {
        .update(((FactHandleAdapterhandle).getDelegate(), object);
    }
    public FactHandle getFactHandle(Object object) {
        return new FactHandleAdapter(.getFactHandle(object));
    }
    public Object getObject(FactHandle factHandle) {
        return .getObject(((FactHandleAdapter)factHandle).getDelegate());
    }
    public Collection<ObjectgetObjects() {
        return (Collection<Object>).getObjects();
    }
    public Collection<ObjectgetObjects(final ObjectFilter filter) {
        return (Collection<Object>).getObjects(new org.kie.api.runtime.ObjectFilter() {
            public boolean accept(Object object) {
                return filter.accept(object);
            }
        });
    }
    public <T extends FactHandleCollection<T> getFactHandles() {
        return (Collection<T>)adaptFactHandles(.getFactHandles());
    }
    public <T extends FactHandleCollection<T> getFactHandles(final ObjectFilter filter) {
        return (Collection<T>)adaptFactHandles(.getFactHandles(new org.kie.api.runtime.ObjectFilter() {
            public boolean accept(Object object) {
                return filter.accept(object);
            }
        }));
    }
    public long getFactCount() {
        return .getFactCount();
    }
    public void addEventListener(WorkingMemoryEventListener listener) {
        RuleRuntimeEventListener adapted = new WorkingMemoryEventListenerAdapter(listener);
        .put(listeneradapted);
        .addEventListener(adapted);
    }
    public void removeEventListener(WorkingMemoryEventListener listener) {
        .removeEventListener(.remove(listener));
    }
        return .keySet();
    }
    public void addEventListener(AgendaEventListener listener) {
        org.kie.api.event.rule.AgendaEventListener adapted = new AgendaEventListenerAdapter(listener);
        .put(listeneradapted);
        .addEventListener(adapted);
    }
    public void removeEventListener(AgendaEventListener listener) {
        .removeEventListener(.remove(listener));
    }
        return .keySet();
    }
    @Override
    public int hashCode() {
        return .hashCode();
    }
    @Override
    public boolean equals(Object obj) {
        return obj instanceof KnowledgeRuntimeAdapter && .equals(((KnowledgeRuntimeAdapter)obj).);
    }
New to GrepCode? Check out our FAQ X