/**
   * getting a list of itemGrading for a publishedItemId is a lot of work, read the code in
   * GradingService.getItemScores() after we get the list, we are saving it in
   * QuestionScoreBean.itemScoresMap itemScoresMap = (publishedItemId, HashMap) = (Long
   * publishedItemId, (Long publishedItemId, Array itemGradings)) itemScoresMap will be refreshed
   * when the next QuestionScore link is click
   */
  private HashMap getItemScores(
      Long publishedId, Long itemId, String which, boolean isValueChange) {
    log.debug("getItemScores");
    GradingService delegate = new GradingService();
    QuestionScoresBean questionScoresBean =
        (QuestionScoresBean) ContextUtil.lookupBean("questionScores");
    HashMap itemScoresMap = questionScoresBean.getItemScoresMap();
    log.debug("getItemScores: itemScoresMap ==null ?" + itemScoresMap);
    log.debug("getItemScores: isValueChange ?" + isValueChange);

    if (itemScoresMap == null
        || isValueChange
        || questionScoresBean.getIsAnyItemGradingAttachmentListModified()) {
      log.debug("getItemScores: itemScoresMap == null or isValueChange == true ");
      log.debug("getItemScores: isValueChange = " + isValueChange);
      itemScoresMap = new HashMap();
      questionScoresBean.setItemScoresMap(itemScoresMap);
      // reset this anyway (because the itemScoresMap will be refreshed as well as the
      // attachment list)
      questionScoresBean.setIsAnyItemGradingAttachmentListModified(false);
    }
    log.debug("getItemScores: itemScoresMap.size() " + itemScoresMap.size());
    HashMap map = (HashMap) itemScoresMap.get(itemId);
    if (map == null) {
      log.debug("getItemScores: map == null ");
      map = delegate.getItemScores(publishedId, itemId, which, true);
      log.debug("getItemScores: map size " + map.size());
      itemScoresMap.put(itemId, map);
    }
    return map;
  }