Package org.drools.runtime

Examples of org.drools.runtime.StatefulKnowledgeSession.retract()


        ksession.fireAllRules();
        assertEquals( 4,
                      list.size() );

        //removal remaining cheese, no
        ksession.retract( ksession.getFactHandle( brie ) );
        ksession = getSerialisedStatefulKnowledgeSession( ksession,
        //                                                  MarshallerFactory.newIdentityMarshallingStrategy(),
                                                          true );
        ksession.fireAllRules();
        assertEquals( 4,
View Full Code Here


        StatefulKnowledgeSession ksession = knowledgeBase.newStatefulKnowledgeSession( sessionConfig,
                                                                                       KnowledgeBaseFactory.newEnvironment() );
        PseudoClockScheduler pseudoClock = ksession.getSessionClock();

        FactHandle h = ksession.insert( new A() );
        ksession.retract( h );
    }

    public static class A
        implements
        Serializable {
View Full Code Here

         }
         finally
         {
            for (FactHandle handle : handles)
            {
               securityContext.retract(handle);
            }
         }
      }
     
      return check.isGranted();
View Full Code Here

         }
         finally
         {
            for (FactHandle handle : handles)
            {
               securityContext.retract(handle);
            }
         }
      }
     
      return roleCheck.isGranted();
View Full Code Here

    {
        StatefulKnowledgeSession session = ((DroolsSessionData) rules.getSessionData()).getSession();
        FactHandle handle = session.getFactHandle(fact);
        if (handle != null)
        {
            session.retract(handle);
            session.fireAllRules();
        }
        else
        {
            logger.warn("Unable to retract fact " + fact + " because it is not in the knowledge base");
View Full Code Here

        assertEquals( 2,
                      list.size() );

        // remove cheese
        ksession = getSerialisedStatefulKnowledgeSession( ksession, MarshallerFactory.newIdentityMarshallingStrategy(), true );
        ksession.retract( ksession.getFactHandle( stilton ) );
        ksession = getSerialisedStatefulKnowledgeSession( ksession, MarshallerFactory.newIdentityMarshallingStrategy(), true );
        ksession.fireAllRules();
        assertEquals( 4,
                      list.size() );
View Full Code Here

        ksession.fireAllRules();
        assertEquals( 4,
                      list.size() );

        // now remove a cheese, should be no change
        ksession.retract( ksession.getFactHandle( stilton ) );
        ksession = getSerialisedStatefulKnowledgeSession( ksession, MarshallerFactory.newIdentityMarshallingStrategy(), true );
        ksession.fireAllRules();
        assertEquals( 4,
                      list.size() );
View Full Code Here

        ksession.fireAllRules();
        assertEquals( 4,
                      list.size() );

        // now remove a person, should be no change
        ksession.retract( ksession.getFactHandle( bobba ) );
        ksession = getSerialisedStatefulKnowledgeSession( ksession, MarshallerFactory.newIdentityMarshallingStrategy(), true );
        ksession.fireAllRules();
        assertEquals( 4,
                      list.size() );
View Full Code Here

        ksession.fireAllRules();
        assertEquals( 4,
                      list.size() );

        //removal remaining cheese, should increase by one, as one person left
        ksession.retract( ksession.getFactHandle( brie ) );
        ksession = getSerialisedStatefulKnowledgeSession( ksession, MarshallerFactory.newIdentityMarshallingStrategy(), true );
        ksession.fireAllRules();
        assertEquals( 5,
                      list.size() );
    }
View Full Code Here

        assertEquals( 2,
                      list.size() );

        // remove cheese
        ksession = getSerialisedStatefulKnowledgeSession( ksession, MarshallerFactory.newIdentityMarshallingStrategy(), true );
        ksession.retract( ksession.getFactHandle( stilton ) );
        ksession = getSerialisedStatefulKnowledgeSession( ksession, MarshallerFactory.newIdentityMarshallingStrategy(), true );
        ksession.fireAllRules();
        assertEquals( 2,
                      list.size() );
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.