/**
  * @see
  *     org.drools.event.rule.WorkingMemoryEventListener#objectRetracted(org.drools.event.rule.ObjectRetractedEvent)
  */
 public void objectRetracted(ObjectRetractedEvent event) {
   logger.debug(
       "==> [ObjectRetracted: handle="
           + event.getFactHandle()
           + "; object="
           + event.getOldObject()
           + "]");
   if (event.getOldObject() instanceof TohuObject) {
     TohuObject oldObject = (TohuObject) event.getOldObject();
     String id = oldObject.getId();
     logger.debug("==> ObjectRemoved: Removing Fact with ID [" + id + "] from Working Memry");
     TohuObject originalObject = getOriginalObject(id);
     processChange(id, originalObject, null, oldObject, event.getFactHandle());
   }
 }
 /**
  * @see
  *     org.drools.event.rule.WorkingMemoryEventListener#objectUpdated(org.drools.event.rule.ObjectUpdatedEvent)
  */
 public void objectUpdated(ObjectUpdatedEvent event) {
   logger.debug(
       "==> [ObjectUpdated handle="
           + event.getFactHandle()
           + "; object="
           + event.getOldObject()
           + "]");
   if (event.getObject() instanceof TohuObject) {
     TohuObject newObject = (TohuObject) event.getObject();
     String id = newObject.getId();
     logger.debug(
         "==> ObjectUpdated: Updating Fact with ID [" + id + "] that exists in Working Memry");
     TohuObject originalObject = getOriginalObject(id);
     processChange(id, originalObject, newObject, newObject, event.getFactHandle());
   }
 }
 /**
  * Makes copies of the original value all the objects that we wish to track.
  *
  * <p>Shallow copies are sufficient since none of our objects contain children. (All lists are
  * stored as comma-delimited strings so they can be serialized nicely.)
  *
  * @param originalObjects
  */
 public void initialise(Collection<?> originalObjects) {
   this.originalObjects = new HashMap<String, TohuObject>();
   for (Object object : originalObjects) {
     if (object instanceof TohuObject) {
       TohuObject i = (TohuObject) object;
       try {
         this.originalObjects.put(i.getId(), (TohuObject) i.clone());
       } catch (CloneNotSupportedException e) {
         // ignore
       }
     } else if (object instanceof Answer) {
       Answer answer = (Answer) object;
       storeClientAnswer(answer);
     }
   }
 }
 /**
  * @see
  *     org.drools.event.rule.WorkingMemoryEventListener#objectInserted(org.drools.event.rule.ObjectInsertedEvent)
  */
 public void objectInserted(ObjectInsertedEvent event) {
   logger.debug(
       "==> [ObjectInserted: handle="
           + event.getFactHandle()
           + "; object="
           + event.getObject()
           + "]");
   if (event.getObject() instanceof TohuObject) {
     TohuObject newObject = (TohuObject) event.getObject();
     String id = newObject.getId();
     TohuObject originalObject = getOriginalObject(id);
     logger.debug(
         "==>ObjectInserted: Inserting Tohu Fact with ID [" + id + "] into working memry");
     processChange(id, originalObject, newObject, newObject, event.getFactHandle());
   } else if (event.getObject() instanceof Answer) {
     Answer answer = (Answer) event.getObject();
     logger.debug(
         "==>ObjectInserted: Inserting Answer Fact with value ["
             + answer.getValue()
             + "] into working memry");
     storeClientAnswer(answer);
   }
 }