import org.springframework.stereotype.Controller;\r
import org.springframework.web.bind.WebDataBinder;\r
import org.springframework.web.bind.annotation.InitBinder;\r
-import org.springframework.web.bind.annotation.ModelAttribute;\r
import org.springframework.web.bind.annotation.PathVariable;\r
import org.springframework.web.bind.annotation.RequestMapping;\r
import org.springframework.web.bind.annotation.RequestMethod;\r
import org.springframework.web.bind.annotation.RequestParam;\r
\r
-import eu.etaxonomy.cdm.api.service.AnnotatableServiceBase;\r
-import eu.etaxonomy.cdm.api.service.DescriptionServiceImpl;\r
import eu.etaxonomy.cdm.api.service.DistributionTree;\r
import eu.etaxonomy.cdm.api.service.IDescriptionService;\r
-import eu.etaxonomy.cdm.api.service.IFeatureTreeService;\r
-import eu.etaxonomy.cdm.api.service.NamedAreaTree;\r
import eu.etaxonomy.cdm.api.service.pager.Pager;\r
import eu.etaxonomy.cdm.model.common.Annotation;\r
import eu.etaxonomy.cdm.model.description.DescriptionBase;\r
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;\r
-import eu.etaxonomy.cdm.model.description.FeatureTree;\r
import eu.etaxonomy.cdm.model.description.TaxonDescription;\r
import eu.etaxonomy.cdm.model.location.NamedAreaLevel;\r
import eu.etaxonomy.cdm.remote.editor.NamedAreaLevelPropertyEditor;\r
-\r
import eu.etaxonomy.cdm.remote.editor.UUIDListPropertyEditor;\r
-import eu.etaxonomy.cdm.remote.editor.UUIDPropertyEditor;\r
import eu.etaxonomy.cdm.remote.editor.UuidList;\r
\r
/**\r
- * TODO write controller documentation\r
+ * IMPORTANT:\r
+ *\r
+ * This controller is mostly a 1:1 copy of the DescriptionController\r
+ * and this provides identical end points which only differ in the depth of the\r
+ * object graphs returned.\r
*\r
* @author a.kohlbecker\r
- * @date 24.03.2009\r
+ * @date Jun 25, 2013\r
+ *\r
*/\r
-\r
@Controller\r
-@RequestMapping(value = {"/portal/description/{uuid}", "/portal/description/{uuid_list}", "/portal/descriptionElement/{descriptionelement_uuid}", "/portal/featureTree/{featuretree_uuid}"})\r
+@RequestMapping(value = {\r
+ "/portal/description/{uuid}",\r
+ "/portal/description/{uuid_list}",\r
+ "/portal/descriptionElement/{descriptionelement_uuid}"})\r
public class DescriptionPortalController extends BaseController<DescriptionBase, IDescriptionService>\r
{\r
- @Autowired\r
- private IFeatureTreeService featureTreeService;\r
-\r
- private static final List<String> FEATURETREE_INIT_STRATEGY = Arrays.asList(\r
- new String[]{\r
- "representations",\r
- "root.feature.representations",\r
- "root.children.feature.representations",\r
- });\r
-\r
- private static final List<String> DESCRIPTIONS_DISTRIBUTION_INIT_STRATEGY = Arrays.asList(new String []{\r
- "elements.sources.citation.$",\r
- "elements.area.$",\r
- });\r
\r
protected static final List<String> DESCRIPTION_INIT_STRATEGY = Arrays.asList(new String []{\r
"$",\r
"elements.area.level",\r
"elements.modifyingText",\r
"elements.states.*",\r
- "elements.media.representations.parts", // TODO "elements.media" should be sufficient since we have the MediaAutoInitializer\r
+ "elements.media",\r
+ });\r
+ \r
+ protected static final List<String> ORDERED_DISTRIBUTION_INIT_STRATEGY = Arrays.asList(new String []{\r
+ "elements.$",\r
+ "elements.sources.citation.authorTeam.$",\r
+ "elements.sources.nameUsedInSource.originalNameString",\r
+ "elements.area.level",\r
});\r
\r
\r
this.service = service;\r
}\r
\r
- /**\r
- * TODO write controller method documentation\r
- *\r
- * @param request\r
- * @param response\r
- * @return\r
- * @throws IOException\r
- */\r
-\r
- @RequestMapping(value = {"/portal/featureTree/{featuretree_uuid}"}, method = RequestMethod.GET)\r
- public FeatureTree doGetFeatureTree(\r
- @PathVariable("featuretree_uuid") UUID featureUuid,\r
- HttpServletRequest request,\r
- HttpServletResponse response)throws IOException {\r
- //UUID featureTreeUuid = readValueUuid(request, null);\r
- FeatureTree featureTree = featureTreeService.load(featureUuid, FEATURETREE_INIT_STRATEGY);\r
- if(featureTree == null){\r
- HttpStatusMessage.UUID_NOT_FOUND.send(response);\r
- }\r
- return featureTree;\r
- }\r
-\r
@RequestMapping(value = "/portal/descriptionElement/{descriptionelement_uuid}/annotation", method = RequestMethod.GET)\r
public Pager<Annotation> getAnnotations(\r
@PathVariable("descriptionelement_uuid") UUID uuid,\r
HttpServletRequest request,\r
HttpServletResponse response) throws IOException {\r
- logger.info("getAnnotations() - " + request.getServletPath());\r
+ logger.info("getAnnotations() - " + request.getRequestURI());\r
DescriptionElementBase annotatableEntity = service.getDescriptionElementByUuid(uuid);\r
- Pager<Annotation> annotations = service.getDescriptionElementAnnotations(annotatableEntity, null, null, 0, null, DEFAULT_INIT_STRATEGY);\r
+ Pager<Annotation> annotations = service.getDescriptionElementAnnotations(annotatableEntity, null, null, 0, null, getInitializationStrategy());\r
return annotations;\r
}\r
\r
@PathVariable("uuid_list") UuidList descriptionUuidList,\r
@RequestParam(value = "omitLevels", required = false) Set<NamedAreaLevel> levels,\r
HttpServletRequest request, HttpServletResponse response) {\r
- logger.info("getOrderedDistributionsB(" + ObjectUtils.toString(levels) + ") - " + request.getServletPath());\r
+ logger.info("getOrderedDistributionsB(" + ObjectUtils.toString(levels) + ") - " + request.getRequestURI());\r
Set<TaxonDescription> taxonDescriptions = new HashSet<TaxonDescription>();\r
TaxonDescription description;\r
for (UUID descriptionUuid : descriptionUuidList) {\r
- description = (TaxonDescription) service.load(descriptionUuid, DESCRIPTION_INIT_STRATEGY);\r
+ logger.debug(" loading description " + descriptionUuid.toString() );\r
+ description = (TaxonDescription) service.load(descriptionUuid, null);\r
taxonDescriptions.add(description);\r
}\r
- DistributionTree distTree = service.getOrderedDistributions(taxonDescriptions, levels, DESCRIPTION_INIT_STRATEGY);\r
+ logger.debug(" get ordered distributions ");\r
+ DistributionTree distTree = service.getOrderedDistributions(taxonDescriptions, levels, ORDERED_DISTRIBUTION_INIT_STRATEGY);\r
+ logger.debug("done");\r
return distTree;\r
}\r
\r