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.common.paging.Pageable;
019import org.gbif.api.model.common.paging.PagingResponse;
020import org.gbif.api.model.registry.Dataset;
021import org.gbif.api.model.registry.Installation;
022import org.gbif.api.model.registry.Organization;
023import org.gbif.api.model.registry.search.KeyTitleResult;
024import org.gbif.api.model.registry.search.OrganizationRequestSearchParams;
025import org.gbif.api.vocabulary.Country;
026
027import java.util.List;
028import java.util.UUID;
029
030import javax.annotation.Nullable;
031import javax.validation.constraints.NotNull;
032
033import org.geojson.FeatureCollection;
034
035@SuppressWarnings("unused")
036public interface OrganizationService extends NetworkEntityService<Organization> {
037
038  /**
039   * Provides paging service to list datasets hosted by, but not owned by, a specific organization.
040   */
041  PagingResponse<Dataset> hostedDatasets(@NotNull UUID organizationKey, @Nullable Pageable page);
042
043  /** Provides paging service to list datasets published by a specific organization. */
044  PagingResponse<Dataset> publishedDatasets(@NotNull UUID organizationKey, @Nullable Pageable page);
045
046  /** Provides paging service to list installations for the organization. */
047  PagingResponse<Installation> installations(
048      @NotNull UUID organizationKey, @Nullable Pageable page);
049
050  /** Provides access to all organizations from a country. */
051  PagingResponse<Organization> listByCountry(Country country, @Nullable Pageable page);
052
053  /** Provides access to deleted organizations. */
054  PagingResponse<Organization> listDeleted(OrganizationRequestSearchParams searchParams);
055
056  /** Provides access to organizations that are awaiting their endorsement approval. */
057  PagingResponse<Organization> listPendingEndorsement(@Nullable Pageable page);
058
059  /** Provides access to organizations that are not publishing (e.g. owning) any datasets. */
060  PagingResponse<Organization> listNonPublishing(@Nullable Pageable page);
061
062  /** Provides a simple suggest service. */
063  List<KeyTitleResult> suggest(@Nullable String q);
064
065  /**
066   * Confirm the endorsement of a new {@link Organization} by providing a confirmationKey.
067   * Confirming the endorsement of an {@link Organization} may not be required or possible depending
068   * how the {@link Organization} was created.
069   *
070   * @param organizationKey key of the organization
071   * @param confirmationKey (aka challenge code)
072   * @return endorsement was confirmed using the provided keys
073   */
074  boolean confirmEndorsement(@NotNull UUID organizationKey, @NotNull UUID confirmationKey);
075
076  /**
077   * Confirm the endorsement of a new {@link Organization} without a confirmationKey. Confirming the
078   * endorsement of an {@link Organization} may not be required or possible depending how the {@link
079   * Organization} was created.
080   *
081   * @param organizationKey key of the organization
082   * @return endorsement was confirmed using the provided keys
083   */
084  boolean confirmEndorsement(@NotNull UUID organizationKey);
085
086  /**
087   * Revoke the endorsement of the {@link Organization}.
088   *
089   * @param organizationKey key of the organization
090   * @return endorsement was confirmed using the provided keys
091   */
092  boolean revokeEndorsement(@NotNull UUID organizationKey);
093
094  /**
095   * Provides paging service to list organizations that can be filtered by multiple parameters.
096   *
097   * @param searchParams {@link OrganizationRequestSearchParams}
098   * @return list of organizations ordered by creation date with the latest coming first
099   */
100  PagingResponse<Organization> list(OrganizationRequestSearchParams searchParams);
101
102  /**
103   * Lists the organizations in GeoJson format.
104   *
105   * @param request parameters to filter the request
106   * @return a {@link FeatureCollection} object that conforms with GeoJson
107   */
108  FeatureCollection listGeoJson(OrganizationRequestSearchParams request);
109}