- \r
- /**\r
- * TODO write controller method documentation\r
- * \r
- * @param page\r
- * @param pageSize\r
- * @return\r
- */\r
- @SuppressWarnings("unchecked")\r
- @RequestMapping(method = RequestMethod.GET,\r
- value = "/*/term/")\r
- public Pager<TermVocabulary> doGetVocabularies(\r
- @RequestParam(value = "page", required = false) Integer page,\r
- @RequestParam(value = "pageSize", required = false) Integer pageSize) {\r
- \r
- if(page == null){ page = DEFAULT_PAGE_NUMBER;}\r
- if(pageSize == null){ pageSize = DEFAULT_PAGESIZE;}\r
- \r
- return (Pager<TermVocabulary>) vocabularyService.page(null,pageSize, page, null, VOCABULARY_LIST_INIT_STRATEGY);\r
- }\r
- \r
- /**\r
- * TODO write controller method documentation\r
- * \r
- * @param request\r
- * @param response\r
- * @return\r
- * @throws IOException\r
- */\r
- @RequestMapping(method = RequestMethod.GET,\r
- value = "/*/term/?*")\r
- public TermVocabulary<DefinedTermBase> doGetTerms(HttpServletRequest request, HttpServletResponse response) throws IOException {\r
- UUID uuid = readValueUuid(request, "^/(?:[^/]+)/term/([^/?#&\\.]+).*");\r
- TermVocabulary<DefinedTermBase> vocab = vocabularyService.load(uuid, VOCABULARY_INIT_STRATEGY);\r
- return vocab;\r
- }\r
- \r
- /**\r
- * TODO write controller method documentation\r
- * \r
- * @param request\r
- * @param response\r
- * @return\r
- * @throws IOException\r
- */\r
- @RequestMapping(method = RequestMethod.GET,\r
- value = "/*/term/*/compareTo/?*")\r
- public ModelAndView doCompare(HttpServletRequest request, HttpServletResponse response) throws IOException {\r
- ModelAndView mv = new ModelAndView();\r
- UUID uuidThis = readValueUuid(request, "^/(?:[^/]+)/term/([^/?#&\\.]+).*");\r
- UUID uuidThat = readValueUuid(request, "^/(?:[^/]+)/term/(?:[^/]+)/compareTo/([^/?#&\\.]+).*");\r
- DefinedTermBase thisTerm = service.load(uuidThis, TERM_COMPARE_INIT_STRATEGY);\r
- DefinedTermBase thatTerm = service.load(uuidThat, TERM_COMPARE_INIT_STRATEGY);\r
- if(thisTerm.getVocabulary().equals(thatTerm.getVocabulary())){\r
- if(OrderedTermBase.class.isAssignableFrom(thisTerm.getClass())){\r
- Integer result = ((OrderedTermBase)thisTerm).compareTo((OrderedTermBase)thatTerm);\r
- mv.addObject(result);\r
- return mv;\r
- }\r
- response.sendError(400, "Only ordered term types can be compared");\r
- return mv;\r
- }\r
- response.sendError(400, "Terms of different vocabuaries can not be compared");\r
- return mv;\r
- }\r