コード例 #1
0
 /**
  * @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);
 }
コード例 #2
0
 /** @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);
   }
 }