@RequestMapping(value = "/addrecord.html", method = RequestMethod.GET)
 public String addRecord(Map<String, Object> map) {
   map.put("currentuser", getCurrentUser());
   map.put("accesses", accessService.getAccesses());
   map.put("record", new Record());
   return "addrecord";
 }
 @RequestMapping(value = "/records.html", method = RequestMethod.GET)
 public String recordList(Map<String, Object> map) {
   List<Record> records =
       recordService.getRecords(
           getCurrentUser(), accessService.getAccess(2), recordTypeService.getRecordType(1), "");
   map.put("currentuser", getCurrentUser());
   map.put("records", records);
   System.out.println(records.size());
   return "records";
 }
  /** A-Team feature: forming xml|json files with notes 26-04-2012 */
  @RequestMapping(value = "/api/user/notes", method = RequestMethod.GET)
  public String exportExecute(
      @RequestParam Map<String, Object> reqMap,
      @RequestParam("email") String email,
      @RequestParam("pass") String password,
      @RequestParam("type") String formatXmlJson,
      HttpServletRequest request,
      HttpServletResponse response)
      throws IOException {

    PrintWriter out = response.getWriter();
    response.setContentType("text/plain");
    User currentUser = null;
    currentUser = userService.getUserByEmail(email);

    String encodedPass = passwordEncoder.encodePassword(password, null);
    if (currentUser != null && encodedPass.equals(currentUser.getPassword())) {
      List<Record> records =
          recordService.getRecords(
              currentUser, accessService.getAccess(2), recordTypeService.getRecordType(1), "");

      xmlService = new XMLService();
      if (formatXmlJson.equals("xml")) {
        xmlService.formXml(records, currentUser, accessService.getAccess(2));
      } else {
        xmlService.formJson(records, currentUser, accessService.getAccess(2));
      }
      out.print(xmlService.getXmlText().toString());
      out.close();
    } else {

      out.println("Access denied");
      out.close();
    }
    return null;
  }
 @RequestMapping(value = "/editrecord.html", method = RequestMethod.GET)
 public String editRecord(@RequestParam Map<String, Object> map, Map<String, Object> respMap) {
   String id = (String) map.get("id");
   respMap.put("errMesg", map.get("errMesg"));
   Integer recId = Integer.parseInt(id);
   Record record = recordService.getRecord(recId);
   if (record == null || !record.getUser().equals(getCurrentUser())) {
     return "redirect:/records.html";
   }
   List<FileView> fileDescription = fileDescriptionService.getFilesDescription(record);
   respMap.put("fileDescription", fileDescription);
   respMap.put("respMap", respMap);
   respMap.put("currentuser", getCurrentUser());
   respMap.put("accesses", accessService.getAccesses());
   respMap.put("record", record);
   return "addrecord";
 }
 /**
  * @param record
  * @param result
  * @return
  */
 @RequestMapping(value = "/addrecord.html", method = RequestMethod.POST)
 public String addRecord(
     @ModelAttribute("record") Record record, BindingResult result, Map<String, Object> map) {
   System.out.println("print id " + record.getId());
   try {
     record.setDate(new Date());
     record.setUser(getCurrentUser());
     record.setRecType(recordTypeService.getRecordType(1));
     recordService.saveOrUpdateRecord(record);
   } catch (Exception e) {
     e.printStackTrace();
     map.put("currentuser", getCurrentUser());
     map.put("accesses", accessService.getAccesses());
     map.put("record", new Record());
     return "addrecord";
   }
   return "redirect:/records.html";
 }