Package org.kie.runtime

Examples of org.kie.runtime.KieSession


    public void setIdentifier(String identifier) {
        this.identifier = identifier;
    }

    public Object execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();

        Object object = ksession.getGlobal( identifier );
        ExecutionResultImpl results = ((StatefulKnowledgeSessionImpl) ksession).session.getExecutionResult();
        if ( results != null ) {
            results.getResults().put( (this.outIdentifier != null) ? this.outIdentifier : this.identifier,
                                      object );
        }
View Full Code Here


public class GetEnvironmentCommand
    implements
    GenericCommand<Environment> {

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

public class DisposeCommand
    implements
    GenericCommand<Void> {

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

    public RemoveEventListenerCommand(ProcessEventListener listener) {
        this.processEventListener = listener;
    }

    public Object execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
        if ( workingMemoryEventListener != null ) {
            ksession.removeEventListener( workingMemoryEventListener );
        } else if ( agendaEventListener != null ) {
            ksession.removeEventListener( agendaEventListener );
        } else {
            ksession.removeEventListener( processEventListener );
        }
        return null;
    }
View Full Code Here

        this.identifier = identifier;
        this.object = object;
    }

    public Object execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();

        if ( this.outIdentifier != null ) {
            ((StatefulKnowledgeSessionImpl) ksession).session.getExecutionResult().getResults().put( this.outIdentifier ,
                                                                                                     object );
        }

        ksession.setGlobal( this.identifier,
                            this.object );
        return object;
    }
View Full Code Here

   
    public GetIdCommand() {
    }

    public Integer execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
        return ((StatefulKnowledgeSessionImpl)ksession).getId();
    }
View Full Code Here

        this.command = command;
        this.disconnected = disconnected;
    }

    public ExecutionResults execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();
       
        ExecutionResults kresults = null;
        if( ksession instanceof StatefulKnowledgeSessionImpl ) {
            kresults = ((StatefulKnowledgeSessionImpl)ksession).execute(context, this.command );
        }
        else {
            // Graceful failure
            kresults = ksession.execute(this.command);
        }
       
        if ( this.outIdentifier != null ) {
            ((ExecutionResultImpl)((KnowledgeCommandContext) context ).getExecutionResults()).getResults().put( this.outIdentifier, kresults );
        }
View Full Code Here

   
    public GetChannelsCommand() {
    }

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

    public GetKnowledgeBaseCommand() {
    }

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

        this.processEventListener = listener;
    }


    public Void execute(Context context) {
        KieSession ksession = ((KnowledgeCommandContext) context).getKieSession();

        if ( workingMemoryEventlistener != null ) {
            ksession.addEventListener( workingMemoryEventlistener );
        } else if ( agendaEventlistener != null ) {
            ksession.addEventListener( agendaEventlistener );
        } else {
            ksession.addEventListener( processEventListener );
        }
        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.