Class SitemapCategoryProvider
- java.lang.Object
-
- org.ametys.plugins.newsletter.category.SitemapCategoryProvider
-
- All Implemented Interfaces:
CategoryProvider
,PluginAware
,Configurable
,LogEnabled
,Serviceable
public class SitemapCategoryProvider extends Object implements LogEnabled, CategoryProvider, Serviceable, Configurable, PluginAware
This class provides newsletter categories from the site map
-
-
Field Summary
Fields Modifier and Type Field Description protected I18nizableText
_description
The descriptionprotected String
_featureName
The feature nameprotected String
_id
The idprotected I18nizableText
_label
The labelprotected Logger
_logger
The Loggerprotected String
_pluginName
The plugin nameprivate AmetysObjectResolver
_resolver
static String
CATEGORY_PREFIX_ID
The metadata name for newsletter templatestatic String
METADATA_AUTOMATIC_IDS
The metadata name for automatic newsletter ids.static String
METADATA_TEMPLATE
The metadata name for newsletter templatestatic String
TAG_NAME
The root id
-
Constructor Summary
Constructors Constructor Description SitemapCategoryProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
configure(Configuration configuration)
protected I18nizableText
configureDescription(Configuration configuration)
Configure description from the passed configurationprotected I18nizableText
configureLabel(Configuration configuration)
Configure label from the passed configurationvoid
enableLogging(Logger logger)
Collection<Category>
getAllCategories(String siteName, String lang)
Returns all the provider's categories, recursively.Collection<String>
getAutomaticIds(String categoryId)
Get automatic property.List<Category>
getCategories(String categoryID)
Get the sub-categories of a categoryList<Category>
getCategories(String siteName, String lang)
Returns the provider's root categories.Category
getCategory(String categoryID)
Returns the provider's category.I18nizableText
getDescription()
Returns the provider's description.String
getId()
Returns the provider's id.I18nizableText
getLabel()
Returns the provider's label.AmetysObjectIterable<Content>
getNewsletters(String categoryID, String siteName, String lang)
Get the newsletter contents linked to a categoryString
getPluginName()
Get the plugin nameString
getRootId(String siteName, String lang)
Get the root idboolean
hasCategory(String categoryID)
Determines if the category exists.boolean
hasChildren(String categoryID)
Determines if the category has sub-categoriesboolean
hasNewsletters(String categoryID, String siteName, String lang)
Determines if a category has categories linked withboolean
isWritable()
Determines if the categories can be modifiedvoid
service(ServiceManager serviceManager)
void
setAutomatic(String categoryId, Collection<String> automaticNewsletterIds)
Set automatic property.void
setPluginInfo(String pluginName, String featureName, String id)
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.void
setTemplate(Category category, String templateName)
Affect a template to category
-
-
-
Field Detail
-
TAG_NAME
public static final String TAG_NAME
The root id- See Also:
- Constant Field Values
-
METADATA_TEMPLATE
public static final String METADATA_TEMPLATE
The metadata name for newsletter template- See Also:
- Constant Field Values
-
METADATA_AUTOMATIC_IDS
public static final String METADATA_AUTOMATIC_IDS
The metadata name for automatic newsletter ids.- See Also:
- Constant Field Values
-
CATEGORY_PREFIX_ID
public static final String CATEGORY_PREFIX_ID
The metadata name for newsletter template- See Also:
- Constant Field Values
-
_label
protected I18nizableText _label
The label
-
_description
protected I18nizableText _description
The description
-
_pluginName
protected String _pluginName
The plugin name
-
_featureName
protected String _featureName
The feature name
-
_resolver
private AmetysObjectResolver _resolver
-
-
Constructor Detail
-
SitemapCategoryProvider
public SitemapCategoryProvider()
-
-
Method Detail
-
service
public void service(ServiceManager serviceManager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
configure
public void configure(Configuration configuration) throws ConfigurationException
- Specified by:
configure
in interfaceConfigurable
- Throws:
ConfigurationException
-
enableLogging
public void enableLogging(Logger logger)
- Specified by:
enableLogging
in interfaceLogEnabled
-
isWritable
public boolean isWritable()
Description copied from interface:CategoryProvider
Determines if the categories can be modified- Specified by:
isWritable
in interfaceCategoryProvider
- Returns:
- true if the categories can be modified
-
getCategories
public List<Category> getCategories(String siteName, String lang)
Description copied from interface:CategoryProvider
Returns the provider's root categories.- Specified by:
getCategories
in interfaceCategoryProvider
- Parameters:
siteName
- The site name. Can be null for all siteslang
- The languages. Can be null for all languages- Returns:
- the provider's root categories.
-
getAllCategories
public Collection<Category> getAllCategories(String siteName, String lang)
Description copied from interface:CategoryProvider
Returns all the provider's categories, recursively.- Specified by:
getAllCategories
in interfaceCategoryProvider
- Parameters:
siteName
- The site name.lang
- The languages.- Returns:
- all the provider's categories.
-
getCategories
public List<Category> getCategories(String categoryID)
Description copied from interface:CategoryProvider
Get the sub-categories of a category- Specified by:
getCategories
in interfaceCategoryProvider
- Parameters:
categoryID
- The category id- Returns:
- the sub-categories
-
hasCategory
public boolean hasCategory(String categoryID)
Description copied from interface:CategoryProvider
Determines if the category exists.- Specified by:
hasCategory
in interfaceCategoryProvider
- Parameters:
categoryID
- The category id- Returns:
- true if the category exists.
-
getCategory
public Category getCategory(String categoryID)
Description copied from interface:CategoryProvider
Returns the provider's category.- Specified by:
getCategory
in interfaceCategoryProvider
- Parameters:
categoryID
- The category id- Returns:
- the provider's category.
-
setTemplate
public void setTemplate(Category category, String templateName)
Description copied from interface:CategoryProvider
Affect a template to category- Specified by:
setTemplate
in interfaceCategoryProvider
- Parameters:
category
- The categorytemplateName
- The template name
-
getAutomaticIds
public Collection<String> getAutomaticIds(String categoryId)
Description copied from interface:CategoryProvider
Get automatic property.- Specified by:
getAutomaticIds
in interfaceCategoryProvider
- Parameters:
categoryId
- The category id.- Returns:
- the list of automatic newsletter IDs.
-
setAutomatic
public void setAutomatic(String categoryId, Collection<String> automaticNewsletterIds)
Description copied from interface:CategoryProvider
Set automatic property.- Specified by:
setAutomatic
in interfaceCategoryProvider
- Parameters:
categoryId
- The category id.automaticNewsletterIds
- The automatic newsletter IDs or empty to set non-automatic.
-
getNewsletters
public AmetysObjectIterable<Content> getNewsletters(String categoryID, String siteName, String lang)
Description copied from interface:CategoryProvider
Get the newsletter contents linked to a category- Specified by:
getNewsletters
in interfaceCategoryProvider
- Parameters:
categoryID
- The category idsiteName
- The site namelang
- The language name- Returns:
- the newsletter contents
-
hasChildren
public boolean hasChildren(String categoryID)
Description copied from interface:CategoryProvider
Determines if the category has sub-categories- Specified by:
hasChildren
in interfaceCategoryProvider
- Parameters:
categoryID
- The category id- Returns:
- true if the category have sub-categories
-
hasNewsletters
public boolean hasNewsletters(String categoryID, String siteName, String lang)
Description copied from interface:CategoryProvider
Determines if a category has categories linked with- Specified by:
hasNewsletters
in interfaceCategoryProvider
- Parameters:
categoryID
- The category idsiteName
- The site namelang
- The language name- Returns:
- if a category has categories linked with
-
configureLabel
protected I18nizableText configureLabel(Configuration configuration) throws ConfigurationException
Configure label from the passed configuration- Parameters:
configuration
- The configuration- Returns:
- The label
- Throws:
ConfigurationException
- If an error occurred
-
configureDescription
protected I18nizableText configureDescription(Configuration configuration) throws ConfigurationException
Configure description from the passed configuration- Parameters:
configuration
- The configuration- Returns:
- The description
- Throws:
ConfigurationException
- If an error occurred
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAware
Sets the plugin info relative to the current component.
Note : The feature name may be null if the targeted component in declared at plugin level.- Specified by:
setPluginInfo
in interfacePluginAware
- Parameters:
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this component
-
getPluginName
public String getPluginName()
Get the plugin name- Returns:
- the plugin name
-
getDescription
public I18nizableText getDescription()
Description copied from interface:CategoryProvider
Returns the provider's description.- Specified by:
getDescription
in interfaceCategoryProvider
- Returns:
- the provider's description.
-
getId
public String getId()
Description copied from interface:CategoryProvider
Returns the provider's id.- Specified by:
getId
in interfaceCategoryProvider
- Returns:
- the provider's id.
-
getLabel
public I18nizableText getLabel()
Description copied from interface:CategoryProvider
Returns the provider's label.- Specified by:
getLabel
in interfaceCategoryProvider
- Returns:
- the provider's label.
-
getRootId
public String getRootId(String siteName, String lang)
Description copied from interface:CategoryProvider
Get the root id- Specified by:
getRootId
in interfaceCategoryProvider
- Parameters:
siteName
- The site namelang
- The language name- Returns:
- the root id
-
-