3 * Copyright (C) 2009 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.remote
.controller
.oaipmh
;
12 import static eu
.etaxonomy
.cdm
.remote
.dto
.oaipmh
.MetadataPrefix
.DWC
;
14 import java
.util
.Arrays
;
15 import java
.util
.HashSet
;
16 import java
.util
.List
;
19 import org
.springframework
.beans
.factory
.annotation
.Autowired
;
20 import org
.springframework
.stereotype
.Controller
;
21 import org
.springframework
.web
.bind
.annotation
.RequestMapping
;
22 import org
.springframework
.web
.servlet
.ModelAndView
;
24 import eu
.etaxonomy
.cdm
.api
.service
.IReferenceService
;
25 import eu
.etaxonomy
.cdm
.model
.common
.LSID
;
26 import eu
.etaxonomy
.cdm
.model
.reference
.Reference
;
27 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonBase
;
28 import eu
.etaxonomy
.cdm
.model
.view
.AuditEventRecord
;
29 import eu
.etaxonomy
.cdm
.remote
.controller
.IdDoesNotExistException
;
30 import eu
.etaxonomy
.cdm
.remote
.dto
.oaipmh
.MetadataPrefix
;
31 import eu
.etaxonomy
.cdm
.remote
.dto
.oaipmh
.SetSpec
;
34 @RequestMapping(value
= "/reference/oai", params
= "verb")
35 public class ReferenceOaiPmhController
extends AbstractOaiPmhController
<Reference
, IReferenceService
> {
38 protected List
<String
> getPropertyPaths() {
39 return Arrays
.asList(new String
[]{
47 private static final List
<String
> TAXON_INIT_STRATEGY
= Arrays
.asList(new String
[]{
50 "name.nomenclaturalReference.titleCache",
55 protected void addSets(ModelAndView modelAndView
) {
56 Set
<SetSpec
> sets
= new HashSet
<SetSpec
>();
57 sets
.add(SetSpec
.REFERENCE
);
58 modelAndView
.addObject("sets",sets
);
63 public void setService(IReferenceService service
) {
64 this.service
= service
;
69 * @see eu.etaxonomy.cdm.remote.controller.AbstractOaiPmhController#finishModelAndView(eu.etaxonomy.cdm.model.common.LSID, eu.etaxonomy.cdm.remote.dto.oaipmh.MetadataPrefix, org.springframework.web.servlet.ModelAndView)
72 protected void finishModelAndView(LSID identifier
,
73 MetadataPrefix metadataPrefix
, ModelAndView modelAndView
)
74 throws IdDoesNotExistException
{
76 if(metadataPrefix
.equals(DWC
)){
77 modelAndView
.addObject("entitylist", obtainCoveredTaxaList(identifier
, metadataPrefix
));
78 modelAndView
.setViewName("oai/getRecord.dwc");
80 super.finishModelAndView(identifier
, metadataPrefix
, modelAndView
);
86 * @param metadataPrefix
88 * @throws IdDoesNotExistException
90 private List
<TaxonBase
> obtainCoveredTaxaList(
91 LSID identifier
, MetadataPrefix metadataPrefix
)
92 throws IdDoesNotExistException
{
94 AuditEventRecord
<Reference
> auditEventRecord
= obtainCdmEntity(identifier
);
95 Reference reference
= auditEventRecord
.getAuditableObject();
96 List
<TaxonBase
> list
= service
.listCoveredTaxa(reference
, true, TAXON_INIT_STRATEGY
);