コード例 #1
0
 private void storeClientAnswer(Answer answer) {
   if (clientAnswers == null) {
     clientAnswers = new HashMap<String, String>();
   }
   String answerValue = answer.getValue();
   // TODO should we really be handling "null" - see TOHU-3
   if (answerValue != null && (answerValue.equals("") || answerValue.equals("null"))) {
     answerValue = null;
   }
   clientAnswers.put(answer.getQuestionId(), answerValue);
 }
コード例 #2
0
 /**
  * @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);
   }
 }