Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| KIE API 6.0.0.Beta3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.kie.api.runtime.rule
Interface SessionEntryPoint

All Known Subinterfaces:
  KieRuntime, KieSession, Session

    public interface SessionEntryPoint

An entry-point is an abstract channel through where facts are inserted into the engine.

Drools 5 supports multiple entry-points into a single `StatefulKnowledgeBase`: the default, anonymous entry-point, as well as as many user declared entry points the application requires.

To get a reference to an entry point, just request the session:

     StatefulKnowledgeSession session = kbase.newStatelessKnowledgeSession();
     ...
     WorkingMemoryEntryPoint entrypoint = session.getWorkingMemoryEntryPoint("my entry point");

Once a reference to an entry point is acquired, the application can insert, update and retract facts to/from that entry-point as usual:

     ...
     FactHandle factHandle = entrypoint.insert( fact );
     ...
     entrypoint.update( factHandle, newFact );
     ...
     entrypoint.retract( factHandle );
     ...

Method Summary
`void` | `delete(FactHandle handle)` Retracts the fact for which the given FactHandle was assigned.
`String` | `getEntryPointId()` Returns the String Id of this entry point
`long` | `getFactCount()` Returns the total number of facts currently in this entry point
`FactHandle` | `getFactHandle(Object object)` Returns the fact handle associated with the given object.
`
`<T extends FactHandle> Collection<T>`
` | `getFactHandles()` Returns all `FactHandle`s from the current session.
`
`<T extends FactHandle> Collection<T>`
` | `getFactHandles(ObjectFilter filter)` Returns all `FactHandle`s from the current session for which the facts are accepted by the given filter.
`Object` | `getObject(FactHandle factHandle)` Returns the object associated with the given FactHandle.
`Collection<? extends Object>` | `getObjects()` Returns all facts from the current session as a Collection.
`Collection<? extends Object>` | `getObjects(ObjectFilter filter)` Returns all facts from the current session that are accepted by the given `ObjectFilter`.
`FactHandle` | `insert(Object object)` Inserts a new fact into this entry point
`void` | `retract(FactHandle handle)` Deprecated. use `delete(FactHandle)`
`void` | `update(FactHandle handle, Object object)` Updates the fact for which the given FactHandle was assigned with the new fact set as the second parameter in this method.

Method Detail

### getEntryPointId

    String getEntryPointId()

  Returns the String Id of this entry point

  Returns:

### insert

    FactHandle insert(Object object)

  Inserts a new fact into this entry point

  Parameters:
    `object` - the fact to be inserted
  Returns:
    the fact handle created for the given fact

### retract

    void retract(FactHandle handle)

  Deprecated. use `delete(FactHandle)`

  Retracts the fact for which the given FactHandle was assigned.

  Parameters:
    `handle` - the handle whose fact is to be retracted.

### delete

    void delete(FactHandle handle)

  Retracts the fact for which the given FactHandle was assigned.

  Parameters:
    `handle` - the handle whose fact is to be retracted.

### update

    void update(FactHandle handle,
                Object object)

  Updates the fact for which the given FactHandle was assigned with the new fact set as the second parameter in this method.

  Parameters:
    `handle` - the FactHandle for the fact to be updated.
    `object` - the new value for the fact being updated.

### getFactHandle

    FactHandle getFactHandle(Object object)

  Returns the fact handle associated with the given object. It is important to note that this method behaves in accordance with the configured assert behaviour for this knowledge base (either IDENTITY or EQUALITY).

  Parameters:
    `object` - the fact for which the fact handle will be returned.
  Returns:
    the fact handle for the given object, or null in case no fact handle was found for the given object.
  See Also:
    `KnowledgeBaseConfiguration`

### getObject

    Object getObject(FactHandle factHandle)

  Returns the object associated with the given FactHandle.

  Parameters:
    `factHandle` -
  Returns:

### getObjects

    Collection<? extends Object> getObjects()

  Returns all facts from the current session as a Collection.

  This class is not a general-purpose `Collection` implementation! While this class implements the `Collection` interface, it intentionally violates `Collection` general contract, which mandates the use of the `equals` method when comparing objects.

  Instead the approach used when comparing objects with the `contains(Object)` method is dependent on the WorkingMemory configuration, where it can be configured for `Identity` or for `Equality`.

  Returns:

### getObjects

    Collection<? extends Object> getObjects(ObjectFilter filter)

  Returns all facts from the current session that are accepted by the given `ObjectFilter`.

  Parameters:
    `filter` - the filter to be applied to the returned collection of facts.
  Returns:

### getFactHandles

    <T extends FactHandle> Collection<T> getFactHandles()

  Returns all `FactHandle`s from the current session.

  Returns:

### getFactHandles

    <T extends FactHandle> Collection<T> getFactHandles(ObjectFilter filter)

  Returns all `FactHandle`s from the current session for which the facts are accepted by the given filter.

  Parameters:
    `filter` - the filter to be applied to the returned collection of `FactHandle`s.
  Returns:

### getFactCount

    long getFactCount()

  Returns the total number of facts currently in this entry point

  Returns:

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| KIE API 6.0.0.Beta3
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2013 JBoss by Red Hat. All Rights Reserved.