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.Comment;
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 Comment}.
028 */
029@SuppressWarnings("unused")
030public interface CommentService {
031
032  /**
033   * Add a new Comment to a target entity.
034   *
035   * @param targetEntityKey key of target entity
036   * @param comment         Comment to add
037   *
038   * @return key of Comment added
039   */
040  int addComment(@NotNull UUID targetEntityKey, @NotNull @Valid Comment comment);
041
042  /**
043   * Delete an existing Comment from a target entity by comment key.
044   *
045   * @param targetEntityKey key of target entity
046   * @param commentKey      Comment key to delete
047   */
048  void deleteComment(@NotNull UUID targetEntityKey, int commentKey);
049
050  /**
051   * List all comments of a target entity.
052   *
053   * @param targetEntityKey key of target entity
054   *
055   * @return list of comments that belong to the entity
056   */
057  List<Comment> listComments(@NotNull UUID targetEntityKey);
058}