@Controller public class OccurrenceController extends AbstractSecureController
| Modifier and Type | Field and Description |
|---|---|
protected AssertionUtils |
assertionUtils |
protected AuthService |
authService |
protected String |
biocacheMediaUrl |
protected ContactUtils |
contactUtils |
protected DownloadService |
downloadService |
protected String |
facetConfig |
protected String |
hostUrl |
protected String |
nativeCountry |
protected org.ala.client.util.RestfulClient |
restfulClient |
protected SearchDAO |
searchDAO
Fulltext search DAO
|
protected SearchUtils |
searchUtils
Data Resource DAO
|
protected SpeciesLookupService |
speciesLookupService |
protected Pattern |
taxonIDPattern
Compiled pattern for taxon IDs
|
protected String |
taxonIDPatternString
The response to be returned for the isAustralian test
|
apiCheckUrl| Constructor and Description |
|---|
OccurrenceController() |
| Modifier and Type | Method and Description |
|---|---|
String |
batchDownload(javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpServletRequest request,
DownloadRequestParams params,
org.springframework.validation.BindingResult result,
String filepath,
String directory,
String ip,
org.springframework.ui.Model model) |
void |
batchDownload(javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpServletRequest request,
String queries,
String field,
String separator,
String title)
Webservice to support bulk downloads for a long list of queries for a single field.
|
void |
batchSearch(javax.servlet.http.HttpServletResponse response,
String redirectBase,
String queries,
String field,
String separator,
String title)
Given a list of queries for a single field, return an AJAX response with the qid (cached query id)
NOTE: triggered on "Search" button
|
Object |
compareOccurrenceVersions(String uuid)
Returns a comparison of the occurrence versions.
|
void |
downloadFacet(DownloadRequestParams requestParams,
boolean includeCount,
boolean lookupName,
boolean includeSynonyms,
String ip,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Downloads the complete list of values in the supplied facet
ONLY 1 facet should be included in the params.
|
void |
dumpDistinctLatLongs(SearchRequestParams requestParams,
javax.servlet.http.HttpServletResponse response)
Dumps the distinct latitudes and longitudes that are used in the
connected index (to 4 decimal places)
|
List<DownloadDetailsDTO> |
getCurrentDownloads() |
String[] |
getDeleteOccurrences(String fromDate,
javax.servlet.http.HttpServletResponse response)
Returns the records uuids that have been deleted since the fromDate inclusive.
|
List<String> |
getImages(String guid)
Returns a list of image urls for the supplied taxon guid.
|
Set<IndexFieldDTO> |
getIndexedFields(String fields)
Returns a list with the details of the index field
|
List<FacetResultDTO> |
getOccurrenceFacetDetails(SpatialSearchRequestParams requestParams)
Returns a facet list including the number of distinct values for a field
|
Pattern |
getTaxonIDPattern() |
List |
groupFacets()
Returns the default facets grouped by themes that are applied to a search
|
String |
homePageHandler(org.springframework.ui.Model model)
Custom handler for the welcome view.
|
protected void |
initBinder(org.springframework.web.bind.WebDataBinder binder)
Need to initialise the validator to be used otherwise the @Valid annotation will not work
|
NativeDTO |
isAustralian(String guid)
Checks to see if the supplied GUID represents an Australian species.
|
String[] |
listAllFacets()
Returns the default facets that are applied to a search
|
SearchResultDTO |
listOccurrences(org.springframework.ui.Model model)
Returns the complete list of Occurrences
|
Map<String,Object> |
nearestOccurrence(SpatialSearchRequestParams requestParams)
Utility method for retrieving a list of occurrences.
|
String |
occurrenceDownload(DownloadRequestParams requestParams,
org.springframework.validation.BindingResult result,
String ip,
String apiKey,
org.springframework.ui.Model model,
javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpServletRequest request)
Occurrence search page uses SOLR JSON to display results
Please NOTE that the q and fq provided to this URL should be obtained
from SearchResultDTO.urlParameters
|
String |
occurrenceIndexDownload(DownloadRequestParams requestParams,
org.springframework.validation.BindingResult result,
String apiKey,
String ip,
org.springframework.ui.Model model,
javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpServletRequest request) |
SearchResultDTO |
occurrenceSearch(SpatialSearchRequestParams requestParams,
String apiKey,
Boolean lookupImageMetadata,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Occurrence search page uses SOLR JSON to display results
|
SearchResultDTO |
occurrenceSearchByArea(SpatialSearchRequestParams requestParams,
org.springframework.ui.Model model)
Deprecated.
|
SearchResultDTO |
occurrenceSearchByTaxon(SpatialSearchRequestParams requestParams,
String guid,
org.springframework.ui.Model model)
Occurrence search page uses SOLR JSON to display results
|
SearchResultDTO |
occurrenceSearchForUID(SpatialSearchRequestParams requestParams,
String uid,
org.springframework.ui.Model model)
Occurrence search for a given collection, institution, data_resource or data_provider.
|
SearchResultDTO |
occurrenceSearchSensitive(SpatialSearchRequestParams requestParams,
String apiKey,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
String |
occurrenceSensitiveDownload(DownloadRequestParams requestParams,
String apiKey,
String ip,
boolean fromIndex,
javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpServletRequest request) |
Map<String,Integer> |
occurrenceSpeciesCounts(javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpServletRequest request,
String separator)
Webservice to report the occurrence counts for the supplied list of taxa
|
String |
oldApiHandler(org.springframework.ui.Model model)
Custom handler for the welcome view.
|
String |
refreshCache()
Occurrence search page uses SOLR JSON to display results
|
void |
setAssertionUtils(AssertionUtils assertionUtils) |
void |
setContactUtils(ContactUtils contactUtils) |
void |
setSearchDAO(SearchDAO searchDAO) |
void |
setSearchUtils(SearchUtils searchUtils) |
void |
setSpeciesLookupService(SpeciesLookupService speciesLookupService) |
Object |
showOccurrence(String uuid)
Occurrence record page
When user supplies a uuid that is not found search for a unique record
with the supplied occurrenc_id
Returns a SearchResultDTO when there is more than 1 record with the supplied UUID
TODO move to service layer
|
Object |
showOccurrence(String uuid,
String apiKey,
String ip,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Occurrence record page
When user supplies a uuid that is not found search for a unique record
with the supplied occurrence_id
Returns a SearchResultDTO when there is more than 1 record with the supplied UUID
|
Object |
showSensitiveOccurrence(String uuid,
String apiKey,
String ip,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
List<OccurrenceSourceDTO> |
sourceByTaxon(SpatialSearchRequestParams requestParams,
String guid)
Obtains a list of the sources for the supplied guid.
|
void |
writei18nPropertiesFile(String qualifier,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Returns the content of the messages.properties file.
|
isValidKey, shouldPerformOperation, shouldPerformOperation@Inject protected SearchDAO searchDAO
@Inject protected SearchUtils searchUtils
@Inject protected org.ala.client.util.RestfulClient restfulClient
@Inject protected SpeciesLookupService speciesLookupService
@Inject protected AuthService authService
@Inject protected ContactUtils contactUtils
@Inject protected AssertionUtils assertionUtils
@Inject protected DownloadService downloadService
protected String hostUrl
protected String taxonIDPatternString
protected String nativeCountry
protected Pattern taxonIDPattern
protected String biocacheMediaUrl
protected String facetConfig
public Pattern getTaxonIDPattern()
@InitBinder protected void initBinder(org.springframework.web.bind.WebDataBinder binder)
binder - @RequestMapping(value="/") public String homePageHandler(org.springframework.ui.Model model)
Note that this handler relies on the RequestToViewNameTranslator to determine the logical view name based on the request URL: "/welcome.do" -> "welcome".
@RequestMapping(value="/oldapi") public String oldApiHandler(org.springframework.ui.Model model)
Note that this handler relies on the RequestToViewNameTranslator to determine the logical view name based on the request URL: "/welcome.do" -> "welcome".
@RequestMapping(value="/active/download/stats") @ResponseBody public List<DownloadDetailsDTO> getCurrentDownloads()
@RequestMapping(value="/search/facets") @ResponseBody public String[] listAllFacets()
@RequestMapping(value="/search/grouped/facets") @ResponseBody public List groupFacets() throws IOException
IOException@RequestMapping(value="/facets/i18n{qualifier:.*}*")
public void writei18nPropertiesFile(@PathVariable(value="qualifier")
String qualifier,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws Exception
response - Exception@RequestMapping(value="index/fields") @ResponseBody public Set<IndexFieldDTO> getIndexedFields(@RequestParam(value="fl",required=false) String fields) throws Exception
Exception@RequestMapping(value="occurrence/facets") @ResponseBody public List<FacetResultDTO> getOccurrenceFacetDetails(SpatialSearchRequestParams requestParams) throws Exception
requestParams - Exception@RequestMapping(value={"/images/taxon/{guid:.+}.json*","/images/taxon/{guid:.+}*"})
@ResponseBody
public List<String> getImages(@PathVariable(value="guid")
String guid)
throws Exception
guid - Exception@RequestMapping(value={"/australian/taxon/{guid:.+}.json*","/australian/taxon/{guid:.+}*","/native/taxon/{guid:.+}.json*","/native/taxon/{guid:.+}*"})
@ResponseBody
public NativeDTO isAustralian(@PathVariable(value="guid")
String guid)
throws Exception
guid - Exception@RequestMapping(value={"/occurrences","/occurrences/collections","/occurrences/institutions","/occurrences/dataResources","/occurrences/dataProviders","/occurrences/taxa","/occurrences/dataHubs"},
method=GET)
@ResponseBody
public SearchResultDTO listOccurrences(org.springframework.ui.Model model)
throws Exception
Exception@RequestMapping(value={"/occurrences/taxon/{guid:.+}.json*","/occurrences/taxon/{guid:.+}*","/occurrences/taxa/{guid:.+}*"},
method=GET)
@ResponseBody
public SearchResultDTO occurrenceSearchByTaxon(SpatialSearchRequestParams requestParams,
@PathVariable(value="guid")
String guid,
org.springframework.ui.Model model)
throws Exception
model - Exception@RequestMapping(value="/occurrences/taxon/source/{guid:.+}.json*",
method=GET)
@ResponseBody
public List<OccurrenceSourceDTO> sourceByTaxon(SpatialSearchRequestParams requestParams,
@PathVariable(value="guid")
String guid)
throws Exception
guid - Exception@RequestMapping(value={"/occurrences/collections/{uid}","/occurrences/institutions/{uid}","/occurrences/dataResources/{uid}","/occurrences/dataProviders/{uid}","/occurrences/dataHubs/{uid}"},
method=GET)
@ResponseBody
public SearchResultDTO occurrenceSearchForUID(SpatialSearchRequestParams requestParams,
@PathVariable(value="uid")
String uid,
org.springframework.ui.Model model)
throws Exception
requestParams - The search parametersuid - The uid for collection, institution, data_resource or data_providermodel - Exception@RequestMapping(value="/occurrences/searchByArea*",
method=GET)
@Deprecated
@ResponseBody
public SearchResultDTO occurrenceSearchByArea(SpatialSearchRequestParams requestParams,
org.springframework.ui.Model model)
throws Exception
occurrenceSearch(SpatialSearchRequestParams)model - Exception@RequestMapping(value={"/occurrences/search.json*","/occurrences/search*"},
method=GET)
@ResponseBody
public SearchResultDTO occurrenceSearch(SpatialSearchRequestParams requestParams,
@RequestParam(value="apiKey",required=false)
String apiKey,
@RequestParam(value="im",required=false,defaultValue="false")
Boolean lookupImageMetadata,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws Exception
Exception@ResponseBody public SearchResultDTO occurrenceSearchSensitive(SpatialSearchRequestParams requestParams, @RequestParam(value="apiKey",required=true) String apiKey, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws Exception
Exception@RequestMapping(value="/cache/refresh",
method=GET)
@ResponseBody
public String refreshCache()
throws Exception
Exception@RequestMapping(value="/occurrences/facets/download*",
method=GET)
public void downloadFacet(DownloadRequestParams requestParams,
@RequestParam(value="count",required=false,defaultValue="false")
boolean includeCount,
@RequestParam(value="lookup",required=false,defaultValue="false")
boolean lookupName,
@RequestParam(value="synonym",required=false,defaultValue="false")
boolean includeSynonyms,
@RequestParam(value="ip",required=false)
String ip,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws Exception
requestParams - response - Exception@RequestMapping(value="/occurrences/batchSearch",
method=POST,
params="action=Download")
public void batchDownload(javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpServletRequest request,
@RequestParam(value="queries",required=true,defaultValue="")
String queries,
@RequestParam(value="field",required=true,defaultValue="")
String field,
@RequestParam(value="separator",defaultValue="\n")
String separator,
@RequestParam(value="title",required=false)
String title)
throws Exception
response - request - separator - Exception@RequestMapping(value="/occurrences/download/batchFile",
method=GET)
public String batchDownload(javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpServletRequest request,
DownloadRequestParams params,
org.springframework.validation.BindingResult result,
@RequestParam(value="file",required=true)
String filepath,
@RequestParam(value="directory",required=true,defaultValue="/data/biocache-exports")
String directory,
@RequestParam(value="ip",required=false)
String ip,
org.springframework.ui.Model model)
throws Exception
Exception@RequestMapping(value="/occurrences/batchSearch",
method=POST,
params="action=Search")
public void batchSearch(javax.servlet.http.HttpServletResponse response,
@RequestParam(value="redirectBase",required=true,defaultValue="")
String redirectBase,
@RequestParam(value="queries",required=true,defaultValue="")
String queries,
@RequestParam(value="field",required=true,defaultValue="")
String field,
@RequestParam(value="separator",defaultValue="\n")
String separator,
@RequestParam(value="title",required=false)
String title)
throws Exception
response - queries - separator - Exception@RequestMapping(value="/occurrences/taxaCount",
method={POST,GET})
@ResponseBody
public Map<String,Integer> occurrenceSpeciesCounts(javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpServletRequest request,
@RequestParam(defaultValue="\n")
String separator)
throws Exception
Exception@RequestMapping(value="/occurrences/download*",
method=GET)
public String occurrenceDownload(DownloadRequestParams requestParams,
org.springframework.validation.BindingResult result,
@RequestParam(value="ip",required=false)
String ip,
@RequestParam(value="apiKey",required=false)
String apiKey,
org.springframework.ui.Model model,
javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpServletRequest request)
throws Exception
Exception@RequestMapping(value="/occurrences/index/download*",
method=GET)
public String occurrenceIndexDownload(DownloadRequestParams requestParams,
org.springframework.validation.BindingResult result,
@RequestParam(value="apiKey",required=false)
String apiKey,
@RequestParam(value="ip",required=false)
String ip,
org.springframework.ui.Model model,
javax.servlet.http.HttpServletResponse response,
javax.servlet.http.HttpServletRequest request)
throws Exception
Exceptionpublic String occurrenceSensitiveDownload(DownloadRequestParams requestParams, String apiKey, String ip, boolean fromIndex, javax.servlet.http.HttpServletResponse response, javax.servlet.http.HttpServletRequest request) throws Exception
Exception@RequestMapping(value="/occurrences/nearest",
method=GET)
@ResponseBody
public Map<String,Object> nearestOccurrence(SpatialSearchRequestParams requestParams)
throws Exception
Exception@RequestMapping(value="/occurrences/coordinates*") public void dumpDistinctLatLongs(SearchRequestParams requestParams, javax.servlet.http.HttpServletResponse response) throws Exception
Exception@RequestMapping(value={"/occurrence/compare/{uuid}.json","/occurrence/compare/{uuid}"},
method=GET)
@ResponseBody
public Object showOccurrence(@PathVariable(value="uuid")
String uuid)
uuid - Exception@RequestMapping(value="/occurrence/compare*",
method=GET)
@ResponseBody
public Object compareOccurrenceVersions(@RequestParam(value="uuid",required=true)
String uuid)
uuid - @RequestMapping(value="/occurrence/deleted",
method=GET)
@ResponseBody
public String[] getDeleteOccurrences(@RequestParam(value="date",required=true)
String fromDate,
javax.servlet.http.HttpServletResponse response)
throws Exception
fromDate - response - Exception@RequestMapping(value={"/occurrence/{uuid:.+}","/occurrences/{uuid:.+}","/occurrence/{uuid:.+}.json","/occurrences/{uuid:.+}.json"},
method=GET)
@ResponseBody
public Object showOccurrence(@PathVariable(value="uuid")
String uuid,
@RequestParam(value="apiKey",required=false)
String apiKey,
@RequestParam(value="ip",required=false)
String ip,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws Exception
uuid - apiKey - Exception@RequestMapping(value={"/sensitive/occurrence/{uuid:.+}","/sensitive/occurrences/{uuid:.+}","/sensitive/occurrence/{uuid:.+}.json","/senstive/occurrences/{uuid:.+}.json"},
method=GET)
@ResponseBody
public Object showSensitiveOccurrence(@PathVariable(value="uuid")
String uuid,
@RequestParam(value="apiKey",required=true)
String apiKey,
@RequestParam(value="ip",required=false)
String ip,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
throws Exception
Exceptionpublic void setSearchDAO(SearchDAO searchDAO)
public void setSearchUtils(SearchUtils searchUtils)
public void setSpeciesLookupService(SpeciesLookupService speciesLookupService)
public void setContactUtils(ContactUtils contactUtils)
public void setAssertionUtils(AssertionUtils assertionUtils)
Copyright © 2014. All rights reserved.