Package org.kie.runtime

Examples of org.kie.runtime.KieSession


import org.kie.runtime.KieSession;

public class ClearAgendaCommand implements GenericCommand<Object> {

    public Void execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
        ksession.getAgenda().clear();
        return null;
    }
View Full Code Here


        }
        this.arguments = arguments;
    }

    public QueryResults execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
       
        if ( this.arguments == null || this.arguments.isEmpty() ) {
            this.arguments = Collections.emptyList();
        }
       
        for (int j = 0; j < arguments.size(); j++) {
            if (arguments.get(j) instanceof Variable) {
                arguments.set(j, Variable.v);
            }
        }

        QueryResults results = ksession.getQueryResults( name, this.arguments.toArray() );
       
        if ( this.outIdentifier != null ) {
            if(((StatefulKnowledgeSessionImpl)ksession).session.getExecutionResult() != null){
                ((StatefulKnowledgeSessionImpl)ksession).session.getExecutionResult().getResults().put( this.outIdentifier, results );
            }   
View Full Code Here

    public void setObjects(List<Object> objects) {
        this.objects = objects;
    }

    public Collection<FactHandle> execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
        List<FactHandle> handles = new ArrayList<FactHandle>();
       
        SessionEntryPoint wmep;
        if ( StringUtils.isEmpty( this.entryPoint ) ) {
            wmep = ksession;
        } else {
            wmep = ksession.getEntryPoint( this.entryPoint );
        }

        for ( Object object : objects ) {
            handles.add( wmep.insert( object ) );
        }
View Full Code Here

        this.handle = DisconnectedFactHandle.newFrom( handle );
        this.setters = setters;
    }

    public Object execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
        SessionEntryPoint wmep = ksession.getEntryPoint( handle.getEntryPointId() );
       
        Object object = wmep.getObject( this.handle );
        MVEL.eval( getMvelExpr(),
                   object );
View Full Code Here

    public GetEntryPointCommand(String name) {
        this.name = name;
    }

    public SessionEntryPoint execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
        return ksession.getEntryPoint( name );
    }
View Full Code Here

        this.factHandleExternalForm = factHandleExternalForm;
        this.disconnected = disconnected;
    }

    public FactHandle execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
        Collection<FactHandle> factHandles = ksession.getFactHandles();
        int fhId = Integer.parseInt(factHandleExternalForm.split(":")[1]);
        for (FactHandle factHandle : factHandles) {
            if (factHandle instanceof InternalFactHandle
                    && ((InternalFactHandle) factHandle).getId() == fhId) {
                InternalFactHandle fhClone = ((InternalFactHandle) factHandle).clone();
View Full Code Here

public class GetWorkingMemoryEventListenersCommand
    implements
    GenericCommand<Collection<WorkingMemoryEventListener>> {

    public Collection<WorkingMemoryEventListener> execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
        return ksession.getWorkingMemoryEventListeners();
    }
View Full Code Here

        this.handle = DisconnectedFactHandle.newFrom( handle );
        this.object = object;
    }

    public Object execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
       
        ksession.getEntryPoint( handle.getEntryPointId() ).update( handle, object );
        return null;
    }
View Full Code Here

    public FireUntilHaltCommand(AgendaFilter agendaFilter) {
        this.agendaFilter = agendaFilter;
    }

    public Integer execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
        final ReteooWorkingMemoryInterface session = ((StatefulKnowledgeSessionImpl)ksession).session;
       
        new Thread(new Runnable() {
            public void run() {
                if ( agendaFilter != null ) {
View Full Code Here

    public void setName(String name) {
        this.name = name;
    }

    public Void execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
        ((StatefulKnowledgeSessionImpl)ksession).session.getAgenda().getRuleFlowGroup( this.name ).clear();
        return null;
    }
View Full Code Here

TOP

Related Classes of org.kie.runtime.KieSession

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.