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.registry.Identifier; 019 020import java.util.List; 021import java.util.UUID; 022 023import javax.validation.Valid; 024import javax.validation.constraints.NotNull; 025 026/** 027 * Service provides a set of operations on {@link Identifier}. 028 */ 029@SuppressWarnings("unused") 030public interface IdentifierService { 031 032 /** 033 * Add a new Identifier to a target entity. 034 * 035 * @param targetEntityKey key of target entity 036 * @param identifier Identifier to add 037 * 038 * @return key of Identifier added 039 */ 040 int addIdentifier(@NotNull UUID targetEntityKey, @NotNull @Valid Identifier identifier); 041 042 /** 043 * Delete an existing Identifier from a target entity by identifier key. 044 * 045 * @param targetEntityKey key of target entity 046 * @param identifierKey Identifier key to delete 047 */ 048 void deleteIdentifier(@NotNull UUID targetEntityKey, int identifierKey); 049 050 /** 051 * List all identifiers of a target entity. 052 * 053 * @param targetEntityKey key of target entity 054 * 055 * @return list of identifiers that belong to the entity 056 */ 057 List<Identifier> listIdentifiers(@NotNull UUID targetEntityKey); 058}