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.Batch;
019import org.gbif.api.model.common.export.ExportFormat;
020
021/** Defines the service to work with batches. */
022public interface BatchService {
023
024  /**
025   * Handles a batch. The batch can be to either do an initial import or to update existing data.
026   *
027   * @param entitiesFile file with the entities to import or update
028   * @param contactsFile file with the contacts to import or update
029   * @param format {@link ExportFormat} of the files
030   * @return key of the batch created
031   */
032  int handleBatch(byte[] entitiesFile, byte[] contactsFile, ExportFormat format);
033
034  /**
035   * Returns a {@link Batch} by its key.
036   *
037   * @param key key of the batch
038   * @return {@link Batch}
039   */
040  Batch get(int key);
041}