/**
   * Implementation of AbstractController.handleRequestInternal
   *
   * @param HttpServletRequest request
   * @param HttpServletResponse response
   * @return ModelAndView
   * @throws Exception
   */
  @Override
  protected ModelAndView handleRequestInternal(
      HttpServletRequest request, HttpServletResponse response) throws Exception {

    readRequest(request);

    Owner owner = myshowcaseService.getOwnerById(new Long(ownerId));

    Showcase showcase = myshowcaseService.obtainCurrentShowcase(owner);

    List<String> messages = new ArrayList<String>();

    String showcaseArtefactCount = "" + showcase.getArtefacts().size();

    messages.add(showcaseArtefactCount);

    response.setContentType("application/json");

    response.setCharacterEncoding("UTF-8");

    PrintWriter out = response.getWriter();

    out.write(new Gson().toJson(messages));

    out.flush();

    out.close();

    return null;
  }
  /**
   * Implementation of AbstractController.handleRequestInternal
   *
   * @param HttpServletRequest request
   * @param HttpServletResponse response
   * @return ModelAndView
   * @throws Exception
   */
  @Override
  protected ModelAndView handleRequestInternal(
      HttpServletRequest request, HttpServletResponse response) throws Exception {

    readRequest(request);

    showcase = myshowcaseService.getShowcaseById(new Long(showcaseId));

    List<Artefact> artefacts = new ArrayList<Artefact>();

    List<Artefact> artefactList =
        myshowcaseService.getShowcaseEvidenceArtefactMappings(
            showcase, new Long(competencyId), new Long(mappingId));

    // Process Artefact List
    Artefact jsonArtefact = null;

    ArtefactDetail jsonArtefactDetail = null;

    ArtefactType jsonArtefactType = null;

    for (Artefact artefact : artefactList) {

      jsonArtefactType = new ArtefactType();

      jsonArtefactDetail = new ArtefactDetail();

      jsonArtefact = artefact.getDeepCopy();

      jsonArtefact.setArtefactId(artefact.getArtefactId());

      jsonArtefact.setDescription(artefact.getDescription());

      jsonArtefact.setName(artefact.getName());

      jsonArtefact.setCreatedDate(artefact.getCreatedDate());

      jsonArtefact.setCreatedDateTime(artefact.getCreatedDate());

      jsonArtefactType.setName(artefact.getType().getName());

      jsonArtefact.setType(jsonArtefactType);

      jsonArtefactDetail.setFileName(artefact.getArtefactDetail().getFileName());

      jsonArtefactDetail.setFilePath(artefact.getArtefactDetail().getFilePath());

      jsonArtefactDetail.setFileType(artefact.getArtefactDetail().getFileType());

      jsonArtefactDetail.setUrl(artefact.getArtefactDetail().getUrl());

      jsonArtefactDetail.setDetail(artefact.getArtefactDetail().getDetail());

      jsonArtefactDetail.setFlickrUserName(artefact.getArtefactDetail().getFlickrUserName());

      jsonArtefactDetail.setTwitterUserName(artefact.getArtefactDetail().getTwitterUserName());

      jsonArtefact.setArtefactDetail(jsonArtefactDetail);

      artefacts.add(jsonArtefact);
    }

    response.setContentType("application/json");

    response.setCharacterEncoding("UTF-8");

    PrintWriter out = response.getWriter();

    out.write(new Gson().toJson(artefacts));

    out.flush();

    out.close();

    return null;
  }