001/*
002 * Copyright 2015-2023 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;
021
022/**
023 * An interface for handling the search result response. Methods will be called
024 * in the order they are received.
025 */
026public interface SearchResultHandler<T>
027{
028  /**
029   * Handle the startIndex in the search response.
030   *
031   * @param startIndex The startIndex.
032   */
033  void startIndex(final int startIndex);
034
035  /**
036   * Handle the itemsPerPage in the search response.
037   *
038   * @param itemsPerPage The itemsPerPage.
039   */
040  void itemsPerPage(final int itemsPerPage);
041
042  /**
043   * Handle the totalResults in the search response.
044   *
045   * @param totalResults The totalResults.
046   */
047  void totalResults(final int totalResults);
048
049  /**
050   * Handle a search result resource.
051   *
052   * @param scimResource A search result resource.
053   * @return {@code true} to continue processing the search result response or
054   *         {@code false} to immediate stop further processing of the response.
055   */
056  boolean resource(final T scimResource);
057
058  /**
059   * Handle a schema extension in the search response.
060   *
061   * @param urn The URN of the extension schema.
062   * @param extensionObjectNode The ObjectNode representing the extension
063   *                            schema.
064   */
065  void extension(final String urn, final ObjectNode extensionObjectNode);
066}