001/*
002 * (C) Copyright 2014 Nuxeo SA (http://nuxeo.com/) and others.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl-2.1.html
008 *
009 * This library 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 GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Thomas Roger
016 *     Nelson Silva
017 */
018
019package org.nuxeo.search.ui;
020
021import java.util.List;
022
023import org.nuxeo.ecm.core.api.CoreSession;
024import org.nuxeo.ecm.core.api.DocumentModel;
025import org.nuxeo.ecm.platform.actions.ActionContext;
026import org.nuxeo.ecm.platform.contentview.jsf.ContentViewHeader;
027import org.nuxeo.ecm.platform.contentview.jsf.ContentViewState;
028
029/**
030 * Service handling contributed searches and related saved searches.
031 *
032 * @since 6.0
033 */
034public interface SearchUIService {
035
036    /**
037     * Returns the list of Content view headers associated to a search.
038     */
039    List<ContentViewHeader> getContentViewHeaders(ActionContext actionContext);
040
041    /**
042     * Returns the list of Content view headers associated to a search and depending of a local configuration.
043     */
044    List<ContentViewHeader> getContentViewHeaders(ActionContext actionContext, DocumentModel doc);
045
046    /**
047     * Save the current search in the user workspace with the given title.
048     *
049     * @param session the {@code CoreSession} to use
050     * @param searchContentViewState the search to save
051     * @param title the title of the being saved search
052     * @return the saved search DocumentModel
053     */
054    DocumentModel saveSearch(CoreSession session, ContentViewState searchContentViewState, String title);
055
056    /**
057     * Returns the current user saved searches, located into its own user workspace.
058     */
059    List<DocumentModel> getCurrentUserSavedSearches(CoreSession session);
060
061    /**
062     * Returns all the accessible saved searches except the ones for the current user.
063     */
064    List<DocumentModel> getSharedSavedSearches(CoreSession session);
065
066    /**
067     * Load the content view state for a given saved search.
068     *
069     * @since 7.3
070     */
071    ContentViewState loadSearch(DocumentModel savedSearch);
072}