Search in sources :

Example 1 with EntryPointCreator

use of org.drools.core.command.EntryPointCreator in project drools by kiegroup.

the class GetEntryPointCommand method execute.

public EntryPoint execute(Context context) {
    KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
    EntryPoint ep = ksession.getEntryPoint(name);
    if (ep == null) {
        return null;
    }
    EntryPointCreator epCreator = (EntryPointCreator) context.get(EntryPointCreator.class.getName());
    return epCreator != null ? epCreator.getEntryPoint(name) : ep;
}
Also used : EntryPoint(org.kie.api.runtime.rule.EntryPoint) EntryPointCreator(org.drools.core.command.EntryPointCreator) KieSession(org.kie.api.runtime.KieSession) RegistryContext(org.drools.core.command.impl.RegistryContext)

Example 2 with EntryPointCreator

use of org.drools.core.command.EntryPointCreator in project drools by kiegroup.

the class GetEntryPointsCommand method execute.

public Collection<? extends EntryPoint> execute(Context context) {
    KieSession ksession = ((RegistryContext) context).lookup(KieSession.class);
    Collection<? extends EntryPoint> eps = ksession.getEntryPoints();
    EntryPointCreator epCreator = (EntryPointCreator) context.get(EntryPointCreator.class.getName());
    if (epCreator == null) {
        return eps;
    }
    Collection<EntryPoint> result = new ArrayList<EntryPoint>();
    for (EntryPoint ep : eps) {
        result.add(epCreator.getEntryPoint(ep.getEntryPointId()));
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) EntryPointCreator(org.drools.core.command.EntryPointCreator) EntryPoint(org.kie.api.runtime.rule.EntryPoint) KieSession(org.kie.api.runtime.KieSession) RegistryContext(org.drools.core.command.impl.RegistryContext)

Aggregations

EntryPointCreator (org.drools.core.command.EntryPointCreator)2 RegistryContext (org.drools.core.command.impl.RegistryContext)2 KieSession (org.kie.api.runtime.KieSession)2 EntryPoint (org.kie.api.runtime.rule.EntryPoint)2 ArrayList (java.util.ArrayList)1