/**
  * @see org.gbif.portal.service.DataResourceManager#findDatasets(java.lang.String, boolean,
  *     org.gbif.portal.dto.util.SearchConstraints)
  */
 @SuppressWarnings("unchecked")
 public SearchResultsDTO findDatasetsFromPlots(
     String nameStub,
     boolean fuzzy,
     boolean anyOccurrence,
     boolean includeCountrySearch,
     SearchConstraints searchConstraints) {
   List resources =
       dataResourceDAO.findDataResourcesAndProvidersAndNetworksFromPlots(
           nameStub,
           fuzzy,
           anyOccurrence,
           includeCountrySearch,
           searchConstraints.getStartIndex(),
           searchConstraints.getMaxResults() + 1);
   List resourceDTOList = new ArrayList();
   for (Object resource : resources) {
     if (resource instanceof DataResource)
       resourceDTOList.add(dataResourceDTOFactory.createDTO(resource));
     else if (resource instanceof DataProvider)
       resourceDTOList.add(dataProviderDTOFactory.createDTO(resource));
     else if (resource instanceof ResourceNetwork)
       resourceDTOList.add(resourceNetworkDTOFactory.createDTO(resource));
   }
   SearchResultsDTO searchResultsDTO = new SearchResultsDTO();
   searchResultsDTO.setResults(resourceDTOList, searchConstraints.getMaxResults());
   return searchResultsDTO;
 }
 /**
  * @see org.gbif.portal.service.DataResourceManager#getDataResourceImageUrlFor(java.lang.String)
  */
 public ImageRecordDTO getDataResourceImageFor(String imageKey) {
   return (ImageRecordDTO)
       imageRecordDTOFactory.createDTO(imageRecordDAO.getImageRecordFor(parseKey(imageKey)));
 }
 /** @see org.gbif.portal.service.DataResourceManager#getNewestDataResource() */
 public DataResourceDTO getNewestDataResource() throws ServiceException {
   DataResource dataResource = dataResourceDAO.getLastDataResourceAdded();
   return (DataResourceDTO) dataResourceDTOFactory.createDTO(dataResource);
 }
 /** @see org.gbif.portal.service.DataResourceManager#getNewestDataProvider() */
 public DataProviderDTO getNewestDataProvider() throws ServiceException {
   DataProvider dataProvider = dataProviderDAO.getLastDataProviderAdded();
   return (DataProviderDTO) dataProviderDTOFactory.createDTO(dataProvider);
 }
 /** @see org.gbif.portal.service.DataResourceManager#getNubDataResource() */
 public DataResourceDTO getNubDataResource() throws ServiceException {
   DataResource dataResource = dataResourceDAO.getDataResourceFor(nubDataResourceId);
   return (DataResourceDTO) dataResourceDTOFactory.createDTO(dataResource);
 }
 /** @see org.gbif.portal.service.DataResourceManager#getNubDataProvider() */
 public DataProviderDTO getNubDataProvider() throws ServiceException {
   DataProvider dataProvider = dataProviderDAO.getDataProviderFor(nubDataProviderId);
   return (DataProviderDTO) dataProviderDTOFactory.createDTO(dataProvider);
 }
 /** @see org.gbif.portal.service.DataResourceManager#getResourceNetworkFor(java.lang.String) */
 public ResourceNetworkDTO getResourceNetworkFor(String resourceNetworkKey)
     throws ServiceException {
   Long resourceNetworkId = parseKey(resourceNetworkKey);
   ResourceNetwork resourceNetwork = resourceNetworkDAO.getResourceNetworkFor(resourceNetworkId);
   return (ResourceNetworkDTO) resourceNetworkDTOFactory.createDTO(resourceNetwork);
 }
 /** @see org.gbif.portal.service.DataResourceManager#getDataProviderFor(java.lang.String) */
 public DataProviderDTO getDataProviderFor(String dataProviderKey) throws ServiceException {
   Long dataProviderId = parseKey(dataProviderKey);
   DataProvider dataProvider = dataProviderDAO.getDataProviderFor(dataProviderId);
   return (DataProviderDTO) dataProviderDTOFactory.createDTO(dataProvider);
 }
 /** @see org.gbif.portal.service.DataResourceManager#getDataResourceFor(java.lang.String) */
 public DataResourceDTO getDataResourceFor(String dataResourceKey) throws ServiceException {
   Long dataResourceId = parseKey(dataResourceKey);
   DataResource dataResource = dataResourceDAO.getDataResourceFor(dataResourceId);
   return (DataResourceDTO) dataResourceDTOFactory.createDTO(dataResource);
 }