001/* 002 * Copyright 2020 Global Biodiversity Information Facility (GBIF) 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.gbif.api.service.registry; 017 018import org.gbif.api.model.common.paging.PageableBase; 019import org.gbif.api.model.common.paging.PagingResponse; 020import org.gbif.api.model.registry.Dataset; 021import jakarta.validation.Valid; 022import jakarta.validation.constraints.NotNull; 023 024import java.util.List; 025import java.util.UUID; 026 027/** 028 * Service interface for managing Dataset DataPackage metadata. 029 */ 030@SuppressWarnings("unused") 031public interface DatasetDataPackageService { 032 033 /** 034 * Creates <a href="https://specs.frictionlessdata.io/data-package/">DataPackage</a> metadata to a target dataset. 035 * 036 * @param datasetKey key of target dataset 037 * @param dataPackage DataPackage metadata 038 * 039 */ 040 void create(UUID datasetKey, @NotNull @Valid Dataset.DataPackage dataPackage); 041 042 /** 043 * Updates <a href="https://specs.frictionlessdata.io/data-package/">DataPackage</a> metadata to a target dataset. 044 * 045 * @param datasetKey key of target dataset 046 * @param dataPackage DataPackage metadata 047 * 048 */ 049 void update(UUID datasetKey, @NotNull @Valid Dataset.DataPackage dataPackage); 050 051 /** 052 * Retrieves <a href="https://specs.frictionlessdata.io/data-package/">DataPackage</a> metadata of a dataset. 053 * 054 * @param datasetKey key of target dataset 055 * 056 */ 057 Dataset.DataPackage get(UUID datasetKey); 058 059 060 /** 061 * Retrieves the resource metadata information of a dataset data package. 062 * @param datasetKey key of the dataset data package 063 * @param resourceName resource name to retrieve 064 * @return JSON object as String 065 */ 066 String getResource(UUID datasetKey, String resourceName); 067 068 /** 069 * Retrieves the list of resources for a dataset data package. 070 * @param datasetKey key of the dataset data package 071 * @return JSON object as String 072 */ 073 String getResources(UUID datasetKey); 074 075 /** 076 * Retrieves the list of resources names for a dataset data package. 077 * @param datasetKey key of the dataset data package 078 * @return JSON object as String 079 */ 080 List<String> getResourceNames(UUID datasetKey); 081 082 /** 083 * Retrieves a pageable response of the registered data packages. 084 * @param params pageable request 085 * @return paging response containing a list of data packages 086 */ 087 PagingResponse<Dataset.DataPackage> list(PageableBase params); 088 089}