All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.adobe.granite.omnisearch.spi.core.SavedSearchHandler Maven / Gradle / Ivy

There is a newer version: 6.5.21
Show newest version
/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  Copyright 2016 Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated and its
 * suppliers and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 **************************************************************************/

package com.adobe.granite.omnisearch.spi.core;


import java.util.Iterator;
import java.util.Map;

import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.osgi.annotation.versioning.ConsumerType;

import com.adobe.granite.omnisearch.api.core.OmniSearchException;

/**
 * A service provider SavedSearchHandler interface i.e. search module Assets, Sites
 * would need to implement this interface.
 * OmniSearch allows different modules to register themselves for Saved Search functionality , by implementing this interface.
 */
@ConsumerType
public interface SavedSearchHandler {

    /**
     * This function returns ID of SavedSearchHandler aka Search Module
     * This ID helps identify the search module uniquely i.e. assets, sites, projects etc.
     * @return ID of SavedSearchHandler
     */

    public String getID();


    /**This function returns list of all saved search for the module i.e. sites, Asset with specified limit and offset.
     * @param resolver ResourceResolver instance
     * @param limit number of result on a page
     * @param offset offset/start of result
     * @return Iterator of Resource  of nodes of saved search for the module.
     * @throws com.adobe.granite.omnisearch.api.core.OmniSearchException instance of OmniSearchException which provide error from the module
     */
    public Iterator getSavedSearches(ResourceResolver resolver, long limit, long offset) throws OmniSearchException;

    /**This function provide the detail of saved query from the saved search node of the provided path
     * @param resolver ResourceResolver instance
     * @param path path of the node of saved search, from which parameters of saved search Query required
     * @return Map containing parameters of the Query
     * @throws com.adobe.granite.omnisearch.api.core.OmniSearchException instance of OmniSearchException which provide error from the module
     */
    public Map getSavedSearchParameters(ResourceResolver resolver, String path) throws OmniSearchException;

    /**This function creates a  new saved search or updates a existing saved search based on the
     * parameters provided in predicateMap parameter.
     *
     * @param resolver ResourceResolver instance
     * @param predicateMap Map of type <String, String> containing all the parameters that needed to be saved
     *                     in query parameters of saved search node.
     * @return Resource that is created or updated for saved search
     * @throws com.adobe.granite.omnisearch.api.core.OmniSearchException instance of OmniSearchException which provide error from the module
     */
    public Resource createOrUpdateSavedSearch(ResourceResolver resolver, Map predicateMap) throws OmniSearchException;

    /**
     * This function delete the saved search node existing on the provided path
     * @param resolver ResourceResolver instance
     * @param path path of saved search node that needed to be deleted.
     * @return true if node deleted successfully , false otherwise
     * @throws com.adobe.granite.omnisearch.api.core.OmniSearchException instance of OmniSearchException which provide error from the module
     */
    public boolean deleteSavedSearch(ResourceResolver resolver, String path) throws OmniSearchException;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy