-// $Id$\r
/**\r
* Copyright (C) 2009 EDIT European Distributed Institute of Taxonomy\r
* http://www.e-taxonomy.eu\r
\r
package eu.etaxonomy.cdm.remote.controller;\r
\r
+import io.swagger.annotations.Api;\r
+\r
import java.io.IOException;\r
import java.util.Arrays;\r
import java.util.List;\r
* @date 20.03.2009\r
*/\r
@Controller\r
-public class ClassificationPortalListController extends IdentifiableListController<Classification,IClassificationService> {\r
+@Api("portal_classification")\r
+@RequestMapping(value="/portal/classification")\r
+public class ClassificationPortalListController extends AbstractIdentifiableListController<Classification,IClassificationService> {\r
\r
\r
private static final List<String> CLASSIFICATION_INIT_STRATEGY = Arrays.asList(new String[]{\r
- "reference.authorTeam"\r
+ "reference.authorship"\r
+\r
});\r
\r
private static final List<String> NODE_INIT_STRATEGY = Arrays.asList(new String[]{\r
- "taxon.sec",\r
- "taxon.name.rank"\r
+ "taxon.name.rank",\r
+ "taxon.sec"\r
});\r
\r
\r
\r
private ITaxonService taxonService;\r
\r
- private IClassificationService service;\r
-\r
private ITermService termService;\r
\r
+ public ClassificationPortalListController() {\r
+ setInitializationStrategy(CLASSIFICATION_INIT_STRATEGY);\r
+ }\r
+\r
@Override\r
@Autowired\r
public void setService(IClassificationService service) {\r
}\r
\r
\r
- /**\r
- * Lists all available {@link Classification}s.\r
- * <p>\r
- * URI: <b>/{datasource-name}/portal/classification</b>\r
- *\r
- * @param request\r
- * @param response\r
- * @return a list of {@link Classification}s initialized by\r
- * the {@link #CLASSIFICATION_INIT_STRATEGY}\r
- * @throws IOException\r
- */\r
- @RequestMapping(value = { "/portal/classification" }, method = RequestMethod.GET)\r
- public List<Classification> getClassifications(HttpServletRequest request, HttpServletResponse response)\r
- throws IOException {\r
- logger.info("getClassification() " + requestPathAndQuery(request));\r
- return service.list(null, null, null,null, CLASSIFICATION_INIT_STRATEGY);\r
- }\r
-\r
-\r
/**\r
* @param treeUuid\r
* @param response\r
* @return\r
- * @throws IOException\r
+ * @throws IOException+\r
+ *\r
+ * @Deprecated use {@link ClassificationController#getChildNodes(UUID, HttpServletResponse)} instead\r
*/\r
@RequestMapping(\r
- value = {"/portal/classification/{treeUuid}/childNodes"},\r
+ value = {"{treeUuid}/childNodes"},\r
method = RequestMethod.GET)\r
public List<TaxonNode> getChildNodes(\r
@PathVariable("treeUuid") UUID treeUuid,\r
}\r
\r
\r
+ /**\r
+ *\r
+ * @param treeUuid\r
+ * @param rankUuid\r
+ * @param request\r
+ * @param response\r
+ * @return\r
+ * @throws IOException\r
+ *\r
+ * @Deprecated use {@link ClassificationController#getChildNodesAtRank(UUID, UUID, HttpServletResponse)} instead\r
+ */\r
@RequestMapping(\r
- value = {"/portal/classification/{treeUuid}/childNodesAt/{rankUuid}"},\r
+ value = {"{treeUuid}/childNodesAt/{rankUuid}"},\r
method = RequestMethod.GET)\r
public List<TaxonNode> getChildNodesAtRank(\r
@PathVariable("treeUuid") UUID treeUuid,\r
}\r
rank = findRank(rankUuid);\r
\r
- return service.listRankSpecificRootNodes(tree, rank, null, null, NODE_INIT_STRATEGY);\r
+// long start = System.currentTimeMillis();\r
+ List<TaxonNode> rootNodes = service.listRankSpecificRootNodes(tree, rank, null, null, NODE_INIT_STRATEGY);\r
+// System.err.println("service.listRankSpecificRootNodes() " + (System.currentTimeMillis() - start));\r
+ return rootNodes;\r
}\r
\r
\r
* the {@link #NODE_INIT_STRATEGY}\r
*/\r
@RequestMapping(\r
- value = {"/portal/classification/{treeUuid}/childNodesOf/{taxonUuid}"},\r
+ value = {"{treeUuid}/childNodesOf/{taxonUuid}"},\r
method = RequestMethod.GET)\r
public List<TaxonNode> getChildNodesOfTaxon(\r
@PathVariable("treeUuid") UUID treeUuid,\r
HttpServletResponse response) throws IOException {\r
logger.info("getChildNodesOfTaxon() " + request.getRequestURI());\r
\r
- Classification tree = service.find(treeUuid);\r
- Taxon taxon = (Taxon) taxonService.load(taxonUuid);\r
- List<TaxonNode> childs = service.loadChildNodesOfTaxon(taxon, tree, NODE_INIT_STRATEGY);\r
+\r
+ List<TaxonNode> childs = service.listChildNodesOfTaxon(taxonUuid, treeUuid, null, null, NODE_INIT_STRATEGY);\r
+ return childs;\r
+\r
+ }\r
+\r
+ @RequestMapping(\r
+ value = {"{treeUuid}/siblingsOf/{taxonUuid}"},\r
+ method = RequestMethod.GET)\r
+ public List<TaxonNode> getSiblingsOfTaxon(\r
+ @PathVariable("treeUuid") UUID treeUuid,\r
+ @PathVariable("taxonUuid") UUID taxonUuid,\r
+ HttpServletRequest request,\r
+ HttpServletResponse response) throws IOException {\r
+ logger.info("getSiblingsOfTaxon() " + request.getRequestURI());\r
+\r
+ //FIXME return pager\r
+ List<TaxonNode> childs = service.listSiblingsOfTaxon(taxonUuid, treeUuid, null, null, NODE_INIT_STRATEGY);\r
return childs;\r
\r
}\r
* the {@link #NODE_INIT_STRATEGY}\r
*/\r
@RequestMapping(\r
- value = {"/portal/classification/{treeUuid}/pathFrom/{taxonUuid}/toRank/{rankUuid}"},\r
+ value = {"{treeUuid}/pathFrom/{taxonUuid}/toRank/{rankUuid}"},\r
method = RequestMethod.GET)\r
public List<TaxonNode> getPathFromTaxonToRank(\r
@PathVariable("treeUuid") UUID treeUuid,\r
* the {@link #NODE_INIT_STRATEGY}\r
*/\r
@RequestMapping(\r
- value = {"/portal/classification/{treeUuid}/pathFrom/{taxonUuid}"},\r
+ value = {"{treeUuid}/pathFrom/{taxonUuid}"},\r
method = RequestMethod.GET)\r
public List<TaxonNode> getPathFromTaxon(\r
@PathVariable("treeUuid") UUID treeUuid,\r
}\r
\r
\r
-}
\ No newline at end of file
+}