Package org.kie.api.runtime.rule

Examples of org.kie.api.runtime.rule.EntryPoint


    public Agenda getAgenda() {
        return new AgendaAdapter(delegate.getAgenda());
    }

    public WorkingMemoryEntryPoint getWorkingMemoryEntryPoint(String name) {
        EntryPoint entryPoint = delegate.getEntryPoint(name);
        return entryPoint == null ? null : new WorkingMemoryEntryPointAdapter(entryPoint);
    }
View Full Code Here


            ((AbstractWorkingMemory)context.wm).initInitialFact(context.ruleBase, context);
            context.handles.put( session.getInitialFactHandle().getId(), session.getInitialFactHandle() );
        }

        for ( ProtobufMessages.EntryPoint _ep : _session.getRuleData().getEntryPointList() ) {
            EntryPoint wmep = context.wm.getEntryPoints().get( _ep.getEntryPointId() );
            readFactHandles( context,
                             _ep,
                             ((NamedEntryPoint) wmep).getObjectStore(),
                             pctxs );
            readTruthMaintenanceSystem( context,
View Full Code Here

                                       ObjectStore objectStore,
                                       List<PropagationContext> pctxs) throws IOException,
                                                                          ClassNotFoundException {
        InternalWorkingMemory wm = context.wm;

        EntryPoint entryPoint = context.wm.getEntryPoints().get( _ep.getEntryPointId() );
       
        // load the handles
        for ( ProtobufMessages.FactHandle _handle : _ep.getHandleList() ) {
            InternalFactHandle handle = readFactHandle( context,
                                                        entryPoint,
View Full Code Here

        // If either way retrieves a strategy, use it
        if (strategy != null) {
            object = strategy.read( context.stream );
        }

        EntryPoint entryPoint = null;
        if (context.readBoolean()) {
            String entryPointId = context.readUTF();
            if (entryPointId != null && !entryPointId.equals( "" )) {
                entryPoint = context.wm.getEntryPoints().get( entryPointId );
            }
View Full Code Here

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

        for ( Object object : objects ) {
            handles.add( wmep.insert( object ) );
        }

        if ( outIdentifier != null ) {
            if ( this.returnObject ) {
                ((StatefulKnowledgeSessionImpl)ksession).session.getExecutionResult().getResults().put( this.outIdentifier,
View Full Code Here

        FactType agecar = getKbase().getFactType(packageName,"AgeOfCar");
        FactType amklaims = getKbase().getFactType(packageName,"AmountOfClaims");

        assertEquals( 7, getKSession().getEntryPoints().size() );

        EntryPoint gender_ep = getKSession().getEntryPoint("in_Gender");
            Assert.assertNotNull(gender_ep);
        EntryPoint noclaims_ep = getKSession().getEntryPoint("in_NoOfClaims");
            Assert.assertNotNull(noclaims_ep);
        EntryPoint scrambled_ep = getKSession().getEntryPoint("in_Scrambled");
            Assert.assertNotNull(scrambled_ep);
        EntryPoint domicile_ep = getKSession().getEntryPoint("in_Domicile");
            Assert.assertNotNull(domicile_ep);
        EntryPoint agecar_ep = getKSession().getEntryPoint("in_AgeOfCar");
            Assert.assertNotNull(agecar_ep);
        EntryPoint amklaims_ep = getKSession().getEntryPoint("in_AmountOfClaims");
            Assert.assertNotNull(amklaims_ep);

        gender_ep.insert("M");
        noclaims_ep.insert("> 4");
        scrambled_ep.insert(4);
        domicile_ep.insert("way out");
        agecar_ep.insert(new Double("3.4"));
        amklaims_ep.insert(9);

        getKSession().fireAllRules();

        assertEquals( 6, getKSession().getObjects().size() );
        assertEquals( 1, getKSession().getObjects( new ClassObjectFilter( gender.getFactClass() ) ).size() );
View Full Code Here

    //FIXME I used to keep all null-context fields... but then memory would blow up. Now I keep only the last one, but then I must override that for accumulates...
    public void testAggregate() throws Exception {

        getKSession().getEntryPoint("in_Limit").insert(18);

        EntryPoint ep = getKSession().getEntryPoint("in_Age");
            ep.insert(10);
            ep.insert(20);
            ep.insert(30);
            ep.insert(40);

        getKSession().fireAllRules();

        checkFirstDataFieldOfTypeStatus(getKbase().getFactType(packageName,"Summa"),true,false, null,90.0);
View Full Code Here

        StockTick tick = new StockTick( 0, "AAA", 1.0, 0 );
        StockTick tock = new StockTick( 1, "BBB", 1.0, 2500 );
        StockTick tack = new StockTick( 1, "CCC", 1.0, 2700 );

        EntryPoint epa = ksession.getEntryPoint("AAA");
        EntryPoint epb = ksession.getEntryPoint("BBB");

        epa.insert( tick );
        epb.insert( tock );
        ksession.insert( tack );

        FactHandle handle = ksession.insert("go1");
        ksession.fireAllRules();
        System.out.println( "***** " + list + " *****");
 
View Full Code Here

        final KieSessionConfiguration sconf = KnowledgeBaseFactory.newKnowledgeSessionConfiguration();
        sconf.setOption( ClockTypeOption.get( "pseudo" ) );

        StatefulKnowledgeSession ksession = createKnowledgeSession(kbase, sconf);

        EntryPoint eventStream = ksession.getEntryPoint( "Event Stream" );

        SessionPseudoClock clock = (SessionPseudoClock) ksession.<SessionClock>getSessionClock();

        final List results = new ArrayList();
        ksession.setGlobal( "results",
                            results );

        EventFactHandle handle1 = (EventFactHandle) eventStream.insert( new StockTick( 1,
                                                                                       "ACME",
                                                                                       50,
                                                                                       System.currentTimeMillis(),
                                                                                       3 ) );
View Full Code Here

        final KnowledgeBase kbase1 = loadKnowledgeBase( kbconf, "test_CEP_AssertBehaviorOnEntryPoints.drl" );

        final StatefulKnowledgeSession ksession = kbase1.newStatefulKnowledgeSession();
        AgendaEventListener ael1 = mock( AgendaEventListener.class );
        ksession.addEventListener( ael1 );
        EntryPoint ep1 = ksession.getEntryPoint( "stocktick stream" );

        FactHandle fh1 = ep1.insert( st1 );
        FactHandle fh1_2 = ep1.insert( st1 );
        FactHandle fh2 = ep1.insert( st2 );
        FactHandle fh3 = ep1.insert( st3 );

        assertSame( fh1,
                    fh1_2 );
        assertNotSame( fh1,
                       fh2 );
View Full Code Here

TOP

Related Classes of org.kie.api.runtime.rule.EntryPoint

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.