001/*
002 * Copyright 2015-2024 Ping Identity Corporation
003 *
004 * This program is free software; you can redistribute it and/or modify
005 * it under the terms of the GNU General Public License (GPLv2 only)
006 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
007 * as published by the Free Software Foundation.
008 *
009 * This program is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
012 * GNU General Public License for more details.
013 *
014 * You should have received a copy of the GNU General Public License
015 * along with this program; if not, see <http://www.gnu.org/licenses>.
016 */
017
018package com.unboundid.scim2.client;
019
020import com.fasterxml.jackson.databind.node.ObjectNode;
021import com.unboundid.scim2.common.annotations.NotNull;
022
023/**
024 * An interface for handling the search result response. Methods will be called
025 * in the order they are received.
026 */
027public interface SearchResultHandler<T>
028{
029  /**
030   * Handle the startIndex in the search response.
031   *
032   * @param startIndex The startIndex.
033   */
034  void startIndex(final int startIndex);
035
036  /**
037   * Handle the itemsPerPage in the search response.
038   *
039   * @param itemsPerPage The itemsPerPage.
040   */
041  void itemsPerPage(final int itemsPerPage);
042
043  /**
044   * Handle the totalResults in the search response.
045   *
046   * @param totalResults The totalResults.
047   */
048  void totalResults(final int totalResults);
049
050  /**
051   * Handle a search result resource.
052   *
053   * @param scimResource A search result resource.
054   * @return {@code true} to continue processing the search result response or
055   *         {@code false} to immediate stop further processing of the response.
056   */
057  boolean resource(@NotNull final T scimResource);
058
059  /**
060   * Handle a schema extension in the search response.
061   *
062   * @param urn The URN of the extension schema.
063   * @param extensionObjectNode The ObjectNode representing the extension
064   *                            schema.
065   */
066  void extension(@NotNull final String urn,
067                 @NotNull final ObjectNode extensionObjectNode);
068}