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.Tag; 019 020import java.util.List; 021import java.util.UUID; 022 023import javax.annotation.Nullable; 024import javax.validation.Valid; 025import javax.validation.constraints.NotNull; 026 027/** 028 * Service provides a set of operations on {@link Tag}. 029 */ 030@SuppressWarnings("unused") 031public interface TagService { 032 033 /** 034 * Add a new Tag to a target entity. 035 * 036 * @param targetEntityKey key of target entity 037 * @param value Tag to add 038 * 039 * @return key of Tag added 040 */ 041 int addTag(@NotNull UUID targetEntityKey, @NotNull String value); 042 043 /** 044 * Add a new Tag to a target entity. 045 * 046 * @param targetEntityKey key of target entity 047 * @param tag Tag to add 048 * 049 * @return key of Tag added 050 */ 051 int addTag(@NotNull UUID targetEntityKey, @NotNull @Valid Tag tag); 052 053 /** 054 * Delete an existing Tag from a tagged entity by tag key. 055 * 056 * @param taggedEntityKey key of tagged entity 057 * @param tagKey Tag key to delete 058 */ 059 void deleteTag(@NotNull UUID taggedEntityKey, int tagKey); 060 061 /** 062 * List all tags of a tagged entity. 063 * 064 * @param taggedEntityKey key of tagged entity 065 * @param owner owner 066 * 067 * @return list of tags that belong to the entity and owner 068 */ 069 List<Tag> listTags(@NotNull UUID taggedEntityKey, @Nullable String owner); 070}