Java Code Examples for org.kie.api.runtime.rule.FactHandle#State

The following examples show how to use org.kie.api.runtime.rule.FactHandle#State . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ListDataStore.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Override
public void delete( InternalFactHandle fh, RuleImpl rule, TerminalNode terminalNode, FactHandle.State fhState) {
    DataHandle dh = fh.getDataHandle();
    entryPointSubscribers.forEach( s -> s.delete( dh, rule, terminalNode, fhState ) );
    subscribers.forEach( s -> s.delete(dh) );
    store.remove( fh.getObject() );
}
 
Example 2
Source File: FieldDataStore.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
@Override
public void delete(InternalFactHandle fh, RuleImpl rule, TerminalNode terminalNode, FactHandle.State fhState) {
    DataHandle dh = fh.getDataHandle();
    if (dh != this.handle) {
        throw new IllegalArgumentException("The given handle is not contained in this DataStore");
    }
    entryPointSubscribers.forEach(s -> s.delete(dh, rule, terminalNode, fhState));
    subscribers.forEach(s -> s.delete(dh));
    handle = null;
}
 
Example 3
Source File: StatefulKnowledgeSessionImpl.java    From kogito-runtimes with Apache License 2.0 5 votes vote down vote up
public void delete(FactHandle factHandle,
                   RuleImpl rule,
                   TerminalNode terminalNode,
                   FactHandle.State fhState ) {
    checkAlive();
    this.defaultEntryPoint.delete(factHandle,
                                  rule,
                                  terminalNode,
                                  fhState);
}
 
Example 4
Source File: DeleteFromEntryPointCommand.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public DeleteFromEntryPointCommand(FactHandle handle, String entryPoint, FactHandle.State fhState) {
    this(handle, entryPoint);
    this.fhState = fhState;
}
 
Example 5
Source File: DisconnectedWorkingMemoryEntryPoint.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
@Override
public void delete( FactHandle factHandle, RuleImpl rule, TerminalNode terminalNode, FactHandle.State fhState ) {
    throw new UnsupportedOperationException( "This method is not supported for disconnected objects" );
}
 
Example 6
Source File: DisconnectedWorkingMemoryEntryPoint.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void delete(FactHandle handle, FactHandle.State fhState) {
    throw new UnsupportedOperationException( "This method is not supported for disconnected objects" );
}
 
Example 7
Source File: NamedEntryPoint.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void delete(FactHandle factHandle,
                   RuleImpl rule,
                   TerminalNode terminalNode,
                   FactHandle.State fhState) {
    if ( factHandle == null ) {
        throw new IllegalArgumentException( "FactHandle cannot be null " );
    }

    this.lock.lock();
    try {
        this.wm.startOperation();
        try {
            this.kBase.executeQueuedActions();

            InternalFactHandle handle = (InternalFactHandle) factHandle;

            if (handle.getId() == -1) {
                // can't retract an already retracted handle
                return;
            }

            // the handle might have been disconnected, so reconnect if it has
            if (handle.isDisconnected()) {
                handle = this.objectStore.reconnect(handle);
            }

            if (handle.getEntryPoint() != this) {
                throw new IllegalArgumentException("Invalid Entry Point. You updated the FactHandle on entry point '" + handle.getEntryPoint().getEntryPointId() + "' instead of '" + getEntryPointId() + "'");
            }

            EqualityKey key = handle.getEqualityKey();
            if (fhState.isStated()) {
                deleteStated(rule, terminalNode, handle, key);
            }
            if (fhState.isLogical()) {
                deleteLogical(key);
            }
        } finally {
            this.wm.endOperation();
        }
    } finally {
        this.lock.unlock();
    }
}
 
Example 8
Source File: DeleteCommand.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public DeleteCommand(FactHandle handle, FactHandle.State fhState) {
    this(handle);
    this.fhState = fhState;
}
 
Example 9
Source File: StatefulKnowledgeSessionImpl.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void delete(FactHandle handle, FactHandle.State fhState) {
    delete(handle, null, null, fhState);
}
 
Example 10
Source File: WorkingMemoryEntryPoint.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
void delete(FactHandle factHandle,
RuleImpl rule,
TerminalNode terminalNode,
FactHandle.State fhState);
 
Example 11
Source File: SequentialKnowledgeHelper.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void delete(Object handle, FactHandle.State fhState) {
    // TODO Auto-generated method stub
}
 
Example 12
Source File: CommandBasedEntryPoint.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
@Override
public void delete(FactHandle handle, FactHandle.State fhState) {
    runner.execute( new DeleteFromEntryPointCommand( handle, entryPoint, fhState ) );
}
 
Example 13
Source File: EntryPointDataProcessor.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void delete(InternalFactHandle fh, RuleImpl rule, TerminalNode terminalNode, FactHandle.State fhState) {
    (( WorkingMemoryEntryPoint ) entryPoint).delete( fh, rule, terminalNode, fhState );
    handles.remove( fh.getDataHandle() );
}
 
Example 14
Source File: CommandBasedStatefulKnowledgeSession.java    From kogito-runtimes with Apache License 2.0 4 votes vote down vote up
public void delete(FactHandle handle, FactHandle.State fhState) {
    runner.execute( new DeleteCommand( handle, fhState ) );
}
 
Example 15
Source File: DummyWorkingMemory.java    From kogito-runtimes with Apache License 2.0 2 votes vote down vote up
@Override
public void delete(FactHandle handle, FactHandle.State fhState) {

}
 
Example 16
Source File: DummyWorkingMemory.java    From kogito-runtimes with Apache License 2.0 2 votes vote down vote up
@Override
public void delete(FactHandle factHandle, RuleImpl rule, TerminalNode terminalNode, FactHandle.State fhState) {

}
 
Example 17
Source File: DummyKnowledgeRuntime.java    From kogito-runtimes with Apache License 2.0 2 votes vote down vote up
@Override
public void delete(FactHandle handle, FactHandle.State fhState) {

}
 
Example 18
Source File: InternalStoreCallback.java    From kogito-runtimes with Apache License 2.0 votes vote down vote up
void delete( InternalFactHandle fh, RuleImpl rule, TerminalNode terminalNode, FactHandle.State fhState); 
Example 19
Source File: KnowledgeHelper.java    From kogito-runtimes with Apache License 2.0 votes vote down vote up
void delete(Object object, FactHandle.State fhState); 
Example 20
Source File: KnowledgeHelper.java    From kogito-runtimes with Apache License 2.0 votes vote down vote up
void delete(FactHandle handle, FactHandle.State fhState);