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.collections;
017
018import org.gbif.api.model.collections.OccurrenceMapping;
019
020import java.util.List;
021import java.util.UUID;
022
023import javax.validation.Valid;
024import javax.validation.constraints.NotNull;
025
026/** Service that provides a set of operations on {@link OccurrenceMapping}. */
027public interface OccurrenceMappingService {
028
029  /**
030   * Add a new {@link OccurrenceMapping} to a target entity.
031   *
032   * @param targetEntityKey key of target entity
033   * @param occurrenceMapping {@link OccurrenceMapping} to add
034   * @return key of OccurrenceMapping added
035   */
036  int addOccurrenceMapping(
037      @NotNull UUID targetEntityKey, @NotNull @Valid OccurrenceMapping occurrenceMapping);
038
039  /**
040   * Delete an existing {@link OccurrenceMapping} from a target entity by OccurrenceMapping key.
041   *
042   * @param targetEntityKey key of target entity
043   * @param occurrenceMappingKey {@link OccurrenceMapping} key to delete
044   */
045  void deleteOccurrenceMapping(@NotNull UUID targetEntityKey, int occurrenceMappingKey);
046
047  /**
048   * List all {@link OccurrenceMapping} of a target entity.
049   *
050   * @param targetEntityKey key of target entity
051   * @return list of {@link OccurrenceMapping} that belong to the entity
052   */
053  List<OccurrenceMapping> listOccurrenceMappings(@NotNull UUID targetEntityKey);
054}