001/*
002 *  Copyright 2018 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.cms.tag;
017
018import java.util.Collection;
019import java.util.Map;
020
021import org.ametys.runtime.i18n.I18nizableText;
022
023/**
024 * This interface represents a tag provider. <br>
025 * @param <T> the tag class
026 */
027public interface TagProvider<T extends Tag>
028{
029    /**
030     * Returns the provider's id.
031     * @return the provider's id.
032     */
033    public String getId();
034    
035    /**
036     * Returns the provider's label.
037     * @return the provider's label.
038     */
039    public I18nizableText getLabel();
040    
041    /**
042     * Returns the provider's description.
043     * @return the provider's description.
044     */
045    public I18nizableText getDescription ();
046    
047    /**
048     * Returns the provider's tags.
049     * @param contextualParameters contextual parameters
050     * @return the provider's tags.
051     */
052    public Map<String, T> getTags (Map<String, Object> contextualParameters);
053    
054    /**
055     * Returns the provider's tag.
056     * @param tagName The tag name
057     * @param contextualParameters contextual parameters
058     * @return the provider's tag.
059     */
060    public T getTag(String tagName, Map<String, Object> contextualParameters);
061    
062    /**
063     * Returns the <strong>direct</strong> children of the provider's tag.
064     * @param tagName The tag name
065     * @param contextualParameters contextual parameters
066     * @return the provider's tag.
067     */
068    public Collection<T> getTags(String tagName, Map<String, Object> contextualParameters);
069    
070    /**
071     * Determines if the tag exists.
072     * @param tagName The tag unique name
073     * @param contextualParameters contextual parameters
074     * @return true if the tag exists.
075     */
076    public boolean hasTag (String tagName, Map<String, Object> contextualParameters);
077
078}