001/*
002 * Copyright 2013 Global Biodiversity Information Facility (GBIF)
003 * Licensed under the Apache License, Version 2.0 (the "License");
004 * you may not use this file except in compliance with the License.
005 * You may obtain a copy of the License at
006 * http://www.apache.org/licenses/LICENSE-2.0
007 * Unless required by applicable law or agreed to in writing, software
008 * distributed under the License is distributed on an "AS IS" BASIS,
009 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
010 * See the License for the specific language governing permissions and
011 * limitations under the License.
012 */
013package org.gbif.api.service.registry;
014
015import org.gbif.api.model.common.paging.Pageable;
016import org.gbif.api.model.common.paging.PagingResponse;
017import org.gbif.api.model.registry.Dataset;
018import org.gbif.api.model.registry.Installation;
019import org.gbif.api.model.registry.Node;
020import org.gbif.api.model.registry.Organization;
021import org.gbif.api.vocabulary.Country;
022
023import java.util.List;
024import java.util.UUID;
025import javax.annotation.Nullable;
026import javax.validation.constraints.NotNull;
027
028/**
029 * Actions on a GBIF node.
030 * Be aware that of 2013 Nodes DO NOT support the ContactInterface although advertised in this interface!!!
031 */
032public interface NodeService extends NetworkEntityService<Node> {
033
034  /**
035   * Provides access to the organizations endorsed by a single node.
036   */
037  PagingResponse<Organization> endorsedOrganizations(@NotNull UUID nodeKey, @Nullable Pageable page);
038
039  /**
040   * Provides access to the organizations that are awaiting an endorsement approval.
041   */
042  PagingResponse<Organization> pendingEndorsements(@Nullable Pageable page);
043
044  /**
045   * Provides access to the organizations that are awaiting an endorsement approval for the given node.
046   */
047  PagingResponse<Organization> pendingEndorsements(@NotNull UUID nodeKey, @Nullable Pageable page);
048
049  /**
050   * Provides the installations that are registered to organizations with an approved endorsement from the node.
051   */
052  PagingResponse<Installation> installations(@NotNull UUID nodeKey, @Nullable Pageable page);
053
054  /**
055   * Returns a node for a given country.
056   * 
057   * @return the countries node or null if none exists
058   */
059  Node getByCountry(Country country);
060
061  /**
062   * Returns a list of all countries which do have a GBIF node.
063   * 
064   * @return list of distinct countries having a GBIF node
065   */
066  List<Country> listNodeCountries();
067
068  /**
069   * Returns those countries considered active in GBIF.
070   * To be active a country must have a Node of type country present, that is either of voting or associate status.
071   *  @return A list of countries ordered by iso code
072    */
073   List<Country> listActiveCountries();
074
075  /**
076   * Provides paging service to list datasets published, i.e. owned by organizations endorsed by the given node.
077   * 
078   * @return list of datasets ordered by creation date with latest coming first
079   */
080  PagingResponse<Dataset> endorsedDatasets(@NotNull UUID nodeKey, @Nullable Pageable page);
081}