/** * @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#getDataResourcesForProvider(java.lang.String) */ @SuppressWarnings("unchecked") public List<DataResourceDTO> getDataResourcesForProvider(String dataProviderKey) throws ServiceException { Long dataProviderId = parseKey(dataProviderKey); List<DataResource> dataResources = dataResourceDAO.getDataResourcesForProvider(dataProviderId); return (List<DataResourceDTO>) dataResourceDTOFactory.createDTOList(dataResources); }
/** * @see * org.gbif.portal.service.DataResourceManager#getResourceNetworksForDataResource(java.lang.String) */ @SuppressWarnings("unchecked") public List<ResourceNetworkDTO> getResourceNetworksForDataResource(String dataResourceKey) throws ServiceException { Long dataResourceId = parseKey(dataResourceKey); List<ResourceNetwork> resourceNetworks = resourceNetworkDAO.getResourceNetworksForDataResource(dataResourceId); return (List<ResourceNetworkDTO>) resourceNetworkDTOFactory.createDTOList(resourceNetworks); }
/** * @see * org.gbif.portal.service.DataResourceManager#getDataResourcesForResourceNetwork(java.lang.String) */ @SuppressWarnings("unchecked") public List<DataResourceDTO> getDataResourcesForResourceNetwork(String resourceNetworkKey) throws ServiceException { Long resourceNetworkId = parseKey(resourceNetworkKey); List<DataResource> dataResources = dataResourceDAO.getDataResourcesForResourceNetwork(resourceNetworkId); return (List<DataResourceDTO>) dataResourceDTOFactory.createDTOList(dataResources); }
/** * @see * org.gbif.portal.service.DataResourceManager#getPropertyStoreNamespacesForResourceAccesspoint(java.lang.String) */ @SuppressWarnings("unchecked") public List<PropertyStoreNamespaceDTO> getPropertyStoreNamespacesForResourceAccessPoint( String resourceAccessPointKey) throws ServiceException { Long resourceAccessPointId = parseKey(resourceAccessPointKey); List<PropertyStoreNamespace> propertyStoreNamespaces = propertyStoreNamespaceDAO.getPropertyStoreNamespacesForResourceAccessPoint( resourceAccessPointId); return (List<PropertyStoreNamespaceDTO>) propertyStoreNamespaceDTOFactory.createDTOList(propertyStoreNamespaces); }
/** @see org.gbif.portal.service.DataResourceManager#findDataProvidersForUser(java.lang.String) */ public List<DataProviderDTO> findDataProvidersForUser(String email) throws ServiceException { int indexOfAt = email.indexOf('@'); if (indexOfAt < 0) { return new ArrayList<DataProviderDTO>(); } // this could be dodgy - eg. [email protected] and [email protected] String username = email.substring(0, indexOfAt) + '%'; String domain = '%' + email.substring(indexOfAt + 1); List<DataProvider> dps = dataProviderDAO.getDataProviderAssociatedWithUser(username, domain); return dataProviderDTOFactory.createDTOList(dps); }
/** * @see org.gbif.portal.service.DataResourceManager#findDataProviders(java.lang.String, boolean, * java.lang.String, java.util.Date, org.gbif.portal.dto.util.SearchConstraints) */ public SearchResultsDTO findDataProviders( String providerName, boolean fuzzy, String isoCountryCode, Date modifiedSince, SearchConstraints searchConstraints) { List<DataProvider> providers = dataProviderDAO.findDataProviders( providerName, fuzzy, isoCountryCode, modifiedSince, searchConstraints.getStartIndex(), searchConstraints.getMaxResults() + 1); return dataProviderDTOFactory.createResultsDTO(providers, searchConstraints.getMaxResults()); }
/** * @see org.gbif.portal.service.DataResourceManager#findResourceNetworks(java.lang.String, * boolean, java.lang.String, java.util.Date, org.gbif.portal.dto.util.SearchConstraints) */ public SearchResultsDTO findResourceNetworks( String networkName, boolean fuzzy, String code, Date modifiedSince, SearchConstraints searchConstraints) { List<ResourceNetwork> networks = resourceNetworkDAO.findResourceNetworks( networkName, fuzzy, code, modifiedSince, searchConstraints.getStartIndex(), searchConstraints.getMaxResults() + 1); return resourceNetworkDTOFactory.createResultsDTO(networks, searchConstraints.getMaxResults()); }
/** * @see org.gbif.portal.service.DataResourceManager#findDataResources(java.lang.String, boolean, * org.gbif.portal.dto.util.SearchConstraints) */ public SearchResultsDTO findDataResources( String resourceName, boolean fuzzy, String providerKey, String basisOfRecordCode, Date modifiedSince, SearchConstraints searchConstraints) throws ServiceException { BasisOfRecord basisOfRecord = null; if (basisOfRecordCode != null) { basisOfRecord = BasisOfRecord.getBasisOfRecord(basisOfRecordCode); if (basisOfRecord == null) { throw new ServiceException("No basis of record found for code " + basisOfRecordCode); } } DataProvider dataProvider = null; if (providerKey != null) { Long dataProviderId = parseKey(providerKey); dataProvider = dataProviderDAO.getDataProviderFor(dataProviderId); if (dataProvider == null) { throw new ServiceException("No DataProvider found for key " + providerKey); } } List<DataResource> resources = dataResourceDAO.findDataResources( resourceName, fuzzy, dataProvider, basisOfRecord, modifiedSince, searchConstraints.getStartIndex(), searchConstraints.getMaxResults() + 1); return dataResourceDTOFactory.createResultsDTO(resources, searchConstraints.getMaxResults()); }
/** @see org.gbif.portal.service.DataResourceManager#getDataResourceList(java.lang.String) */ @SuppressWarnings({"unchecked", "unchecked"}) public List<KeyValueDTO> getDataResourceList(String resourceNetworkKey, String dataProviderKey) { Long resourceNetworkId = parseKey(resourceNetworkKey); Long dataProviderId = parseKey(dataProviderKey); List dataResourceKVs = null; if (resourceNetworkId != null) { List<DataResource> dataResources = dataResourceDAO.getDataResourcesForResourceNetwork(resourceNetworkId); List<KeyValueDTO> kvps = new ArrayList<KeyValueDTO>(); for (DataResource dr : dataResources) { StringBuffer sb = new StringBuffer(dr.getName()); if (dr.getDataProvider() != null) { sb.append(" - "); sb.append(dr.getDataProvider().getName()); } kvps.add(new KeyValueDTO(dr.getId().toString(), sb.toString())); } return kvps; } else { dataResourceKVs = dataResourceDAO.getDataResourceList(dataProviderId); return keyValueDTOFactory.createDTOList(dataResourceKVs); } }
/** @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#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); }
/** @see org.gbif.portal.service.DataResourceManager#getDataResourcesWithInferredTaxonomies() */ @SuppressWarnings("unchecked") public List<DataResourceDTO> getDataResourcesWithInferredTaxonomies() throws ServiceException { logger.debug("Retrieving Data Resource offering taxonomies"); List<DataResource> dataResources = dataResourceDAO.getDataResourcesWithNonSharedTaxonomies(); return (List<DataResourceDTO>) dataResourceDTOFactory.createDTOList(dataResources); }
/** @see org.gbif.portal.service.DataResourceManager#getAllDataResources() */ public List<DataResourceDTO> getAllDataResources() throws ServiceException { List<DataResource> drs = dataResourceDAO.getAllDataResources(); return dataResourceDTOFactory.createDTOList(drs); }
/** @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#getDataProviderList() */ @SuppressWarnings("unchecked") public List<KeyValueDTO> getDataProviderList() { List dataProviderKVs = dataProviderDAO.getDataProviderList(); return keyValueDTOFactory.createDTOList(dataProviderKVs); }
/** @see org.gbif.portal.service.DataResourceManager#getResourceNetworkList() */ @SuppressWarnings("unchecked") public List<KeyValueDTO> getResourceNetworkList() { List resourceNetworkKVs = resourceNetworkDAO.getResourceNetworkList(); return keyValueDTOFactory.createDTOList(resourceNetworkKVs); }
/** @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#getNewestDataResource() */ public DataResourceDTO getNewestDataResource() throws ServiceException { DataResource dataResource = dataResourceDAO.getLastDataResourceAdded(); return (DataResourceDTO) dataResourceDTOFactory.createDTO(dataResource); }
/** @see org.gbif.portal.service.DataResourceManager#getAgentsForDataResource(java.lang.String) */ @SuppressWarnings("unchecked") public List<DataResourceAgentDTO> getAgentsForDataResource(String dataResourceKey) { List<DataResourceAgent> agents = agentDAO.getAgentsForDataResource(parseKey(dataResourceKey)); return dataResourceAgentDTOFactory.createDTOList(agents); }
/** @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#getDataResourceImageUrlFor(java.lang.String) */ public ImageRecordDTO getDataResourceImageFor(String imageKey) { return (ImageRecordDTO) imageRecordDTOFactory.createDTO(imageRecordDAO.getImageRecordFor(parseKey(imageKey))); }
/** @see org.gbif.portal.service.DataResourceManager#getDataProvidersOfferingTaxonomies() */ @SuppressWarnings("unchecked") public List<DataProviderDTO> getDataProvidersOfferingTaxonomies() throws ServiceException { logger.debug("Retrieving Data Providers offering taxonomies"); List<DataProvider> dataProviders = dataProviderDAO.getDataProvidersOfferingTaxonomies(); return (List<DataProviderDTO>) dataProviderDTOFactory.createDTOList(dataProviders); }
/** @see org.gbif.portal.service.DataResourceManager#getInternationalDataProviders() */ public List<DataProviderDTO> getInternationalDataProviders() { return dataProviderDTOFactory.createDTOList( dataProviderDAO.getInternationalDataProviders(true)); }
/** @see org.gbif.portal.service.DataResourceManager#getAllDataProviders() */ public List<DataProviderDTO> getAllDataProviders() throws ServiceException { List<DataProvider> dps = dataProviderDAO.getAllDataProviders(); return dataProviderDTOFactory.createDTOList(dps); }