001/* 002 * Copyright 2010 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 */ 026public interface TagProvider 027{ 028 /** 029 * Returns the provider's id. 030 * @return the provider's id. 031 */ 032 public String getId(); 033 034 /** 035 * Returns the provider's label. 036 * @return the provider's label. 037 */ 038 public I18nizableText getLabel(); 039 040 /** 041 * Returns the provider's description. 042 * @return the provider's description. 043 */ 044 public I18nizableText getDescription (); 045 046 /** 047 * Returns the provider's tags. 048 * @param contextualParameters contextual parameters 049 * @return the provider's tags. 050 */ 051 public Map<String, Tag> getTags (Map<String, Object> contextualParameters); 052 053 /** 054 * Returns the provider's tags filtered by target type 055 * @param targetType If not null, returns only tags matching this target type 056 * @param contextualParameters contextual parameters 057 * @return the provider's tags. 058 */ 059 public Map<String, Tag> getFilteredTags(String targetType, Map<String, Object> contextualParameters); 060 061 /** 062 * Returns the provider's tag. 063 * @param tagName The tag name 064 * @param contextualParameters contextual parameters 065 * @return the provider's tag. 066 */ 067 public Tag getTag(String tagName, Map<String, Object> contextualParameters); 068 069 /** 070 * Returns the <strong>direct</strong> children of the provider's tag. 071 * @param tagName The tag name 072 * @param contextualParameters contextual parameters 073 * @return the provider's tag. 074 */ 075 public Collection<Tag> getTags(String tagName, Map<String, Object> contextualParameters); 076 077 /** 078 * Determines if the tag exists. 079 * @param tagName The tag unique name 080 * @param contextualParameters contextual parameters 081 * @return true if the tag exists. 082 */ 083 public boolean hasTag (String tagName, Map<String, Object> contextualParameters); 084 085}