001/*
002 *  Copyright 2022 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.web.repository.page;
017
018import java.util.Set;
019
020
021/**
022 * A ServicesAssignmentHandler is responsible for giving the available services for a given Zone.
023 * This list can be computed according any application needs, such as Rights of the logged in user, path of the Page, ...
024 */
025public interface ServicesAssignmentHandler
026{
027    /** The Avalon Role */
028    public static final String ROLE = ServicesAssignmentHandler.class.getName();
029    
030    /**
031     * Returns the list of available services for a given {@link Zone}.
032     * @param page the Page to consider
033     * @param zoneName the zone name to consider
034     * @return the list of available services ' id for a given Page and Zone
035     */
036    public Set<String> getAvailableServices (SitemapElement page, String zoneName);
037    
038    /**
039     * Returns the list of authorized view for a given {@link Page}, zone name and service
040     * @param allViews All existing view to limit
041     * @param page The page to consider
042     * @param zoneName The zone name to consider
043     * @param serviceId The service to consider
044     * @return The non null list of available views
045     */
046    public Set<String> limitAvailableServiceViews (Set<String> allViews, SitemapElement page, String zoneName, String serviceId);
047}