/**
   * This method validates the lookupClass field. The field must may not contain null.
   *
   * @param question - the question to be validated
   * @return true if all validation has passed, false otherwise
   */
  private boolean validateLookupClass(Question question) {
    // Force a reload the lookupReturn dropdown list when the lookupClass changes
    String prevLookupClass =
        (String) GlobalVariables.getUserSession().retrieveObject(Constants.LOOKUP_CLASS_NAME);
    if (ObjectUtils.equals(question.getLookupClass(), prevLookupClass)) {
      GlobalVariables.getUserSession().removeObject(Constants.LOOKUP_RETURN_FIELDS);
    }

    if (question.getLookupClass() != null) {
      return true;
    } else {
      GlobalVariables.getMessageMap()
          .putError(
              Constants.QUESTION_DOCUMENT_FIELD_LOOKUP_CLASS,
              KeyConstants.ERROR_QUESTION_LOOKUP_CLASS_NOT_SPECIFIED);
      return false;
    }
  }
 /**
  * This method validates the lookupReturn with the specified lookupClass of the question. (The
  * lookupReturn may be different if JavaScript is disabled and thus the automatic population of
  * the lookupReturn drop down list has not occurred after the lookupClass has changed.)
  *
  * @param question - the question to be validated
  * @return true if validation has passed, false otherwise
  */
 @SuppressWarnings("unchecked")
 private boolean validateLookupReturnBasedOnLookupClass(Question question) {
   if (question.getLookupClass() != null) {
     try {
       List<String> lookupReturnClasses =
           getCustomAttributeService().getLookupReturns(question.getLookupClass());
       for (String lookupReturnClass : lookupReturnClasses) {
         if (StringUtils.equals(lookupReturnClass, question.getLookupReturn())) {
           return true;
         }
       }
       GlobalVariables.getMessageMap()
           .putError(
               Constants.QUESTION_DOCUMENT_FIELD_LOOKUP_RETURN,
               KeyConstants.ERROR_QUESTION_LOOKUP_RETURN_INVALID);
       return false;
     } catch (Exception e) {
       LOG.info(e.getMessage());
       throw new RuntimeException("QuestionMaintenanceDocumentRule encountered exception", e);
     }
   }
   return true;
 }