@Override public void insertAndStageActivation(final AgendaItem activation) { if (activationObjectTypeConf == null) { EntryPointId ep = workingMemory.getEntryPoint(); activationObjectTypeConf = ((InternalWorkingMemoryEntryPoint) workingMemory.getWorkingMemoryEntryPoint(ep.getEntryPointId())) .getObjectTypeConfigurationRegistry() .getObjectTypeConf(ep, activation); } InternalFactHandle factHandle = workingMemory .getFactHandleFactory() .newFactHandle(activation, activationObjectTypeConf, workingMemory, workingMemory); workingMemory .getEntryPointNode() .assertActivation(factHandle, activation.getPropagationContext(), workingMemory); activation.setFactHandle(factHandle); if (!activation.isCanceled() && (activation.getBlockers() == null || activation.getBlockers().isEmpty())) { // All activations started off staged, they are unstaged if they are blocked or // allowed to move onto the actual agenda for firing. getStageActivationsGroup().addActivation(activation); } }
public void modifyActivation(final AgendaItem activation, boolean previouslyActive) { if (declarativeAgenda) { InternalFactHandle factHandle = activation.getFactHandle(); workingMemory .getEntryPointNode() .modifyActivation(factHandle, activation.getPropagationContext(), workingMemory); if (previouslyActive) { // already activated return; } if (activation.isCanceled() || (activation.getBlockers() != null && activation.getBlockers().size() > 0)) { // it's blocked so do nothing return; } // All activations started off staged, they are unstaged if they are blocked or // allowed to move onto the actual agenda for firing. InternalActivationGroup activationGroup = getStageActivationsGroup(); if (activation.getActivationGroupNode() != null && activation.getActivationGroupNode().getActivationGroup() == activationGroup) { // already staged, so return return; } activationGroup.addActivation(activation); } else { if (!previouslyActive) { addActivation(activation, true); } else { Timer timer = activation.getRule().getTimer(); if (timer != null && timer instanceof ExpressionIntervalTimer) { ScheduledAgendaItem schItem = (ScheduledAgendaItem) activation; removeScheduleItem(schItem); scheduleItem(schItem, workingMemory); } } } }