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.Organization;
020import org.gbif.api.model.registry.search.KeyTitleResult;
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
028public interface OrganizationService
029  extends NetworkEntityService<Organization> {
030
031  /**
032   * Provides paging service to list datasets hosted by, but not owned by, a specific organization.
033   */
034  PagingResponse<Dataset> hostedDatasets(@NotNull UUID organizationKey, @Nullable Pageable page);
035
036  /**
037   * Provides paging service to list datasets published by a specific organization.
038   */
039  PagingResponse<Dataset> publishedDatasets(@NotNull UUID organizationKey, @Nullable Pageable page);
040
041  /**
042   * Provides paging service to list installations for the organization.
043   */
044  PagingResponse<Installation> installations(@NotNull UUID organizationKey, @Nullable Pageable page);
045
046  /**
047   * Provides access to all organizations from a country.
048   */
049  PagingResponse<Organization> listByCountry(Country country, @Nullable Pageable page);
050
051  /**
052   * Provides access to deleted organizations.
053   */
054  PagingResponse<Organization> listDeleted(@Nullable Pageable page);
055
056  /**
057   * Provides access to organizations that are awaiting their endorsement approval.
058   */
059  PagingResponse<Organization> listPendingEndorsement(@Nullable Pageable page);
060
061  /**
062   * Provides access to organizations that are not publishing (e.g. owning) any datasets.
063   */
064  PagingResponse<Organization> listNonPublishing(@Nullable Pageable page);
065
066  /**
067   * Provides a simple suggest service.
068   */
069  List<KeyTitleResult> suggest(@Nullable String q);
070
071  /**
072   * Confirm the endorsement of a new {@link Organization} by providing a confirmationKey.
073   * Confirming the endorsement of an {@link Organization} may not be required or possible depending how the
074   * {@link Organization} was created.
075   *
076   * @param organizationKey
077   * @param confirmationKey (aka challenge code)
078   * @return endorsement was confirmed using the provided keys
079   */
080  boolean confirmEndorsement(@NotNull UUID organizationKey, @NotNull UUID confirmationKey);
081
082}