Package org.ametys.odf.catalog
Class CatalogsManager
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.odf.catalog.CatalogsManager
- All Implemented Interfaces:
LogEnabled
,PluginAware
,Component
,Contextualizable
,Serviceable
public class CatalogsManager
extends AbstractLogEnabled
implements Serviceable, Component, PluginAware, Contextualizable
Component to handle ODF catalogs
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncanEditCatalog
(String contentId) Determines if the catalog can be modified from the given contentvoid
contextualize
(Context context) void
copyCatalog
(Catalog catalog, Catalog catalogToCopy) Copy the programs and its hierarchy from a catalog to another.createCatalog
(String name, String title) Create a new catalogdeleteCatalog
(Catalog catalog) Delete cataloggetCatalog
(String name) Get a catalog matching with the given nameGet the list of catalogsGet the root catalogs storage object.getContentCatalog
(String contentId) Get the name of the catalog of a ODF contentprotected int
Get the workflow action id for copy.Returns the default catalogReturns the name of the default cataloggetProgramItems
(String catalog) Get the program's items of a catalog for all languagesgetPrograms
(String catalog) Get the programs of a catalog for all languagesgetPrograms
(String catalog, String lang) Get the programs of a catalogvoid
service
(ServiceManager manager) void
setContentCatalog
(String catalog, String contentId) Set the catalog of a content.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.Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
Avalon Role
-
-
Constructor Details
-
CatalogsManager
public CatalogsManager()
-
-
Method Details
-
contextualize
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
setPluginInfo
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
-
getCatalogs
Get the list of catalogs- Returns:
- the catalogs
-
getCatalog
Get a catalog matching with the given name- Parameters:
name
- The name- Returns:
- a catalog, or null if not found
-
getDefaultCatalogName
Returns the name of the default catalog- Returns:
- the name of the default catalog
-
getDefaultCatalog
Returns the default catalog- Returns:
- the default catalog or null if no default catalog was defined.
-
getContentCatalog
Get the name of the catalog of a ODF content- Parameters:
contentId
- The id of content- Returns:
- The catalog's name
-
canEditCatalog
Determines if the catalog can be modified from the given content- Parameters:
contentId
- The content id- Returns:
- A map with success=false if the catalog cannot be edited
-
setContentCatalog
public void setContentCatalog(String catalog, String contentId) throws com.opensymphony.workflow.WorkflowException Set the catalog of a content. This will modify recursively the catalog of referenced children- Parameters:
catalog
- The catalogcontentId
- The id of content to edit- Throws:
com.opensymphony.workflow.WorkflowException
- if an error occurred
-
getCatalogsRootNode
Get the root catalogs storage object.- Returns:
- the root catalogs node
- Throws:
AmetysRepositoryException
- if a repository error occurs.
-
createCatalog
Create a new catalog- Parameters:
name
- The unique nametitle
- The title of catalog- Returns:
- the created catalog
-
getPrograms
Get the programs of a catalog for all languages- Parameters:
catalog
- The code of catalog- Returns:
- The programs
-
getProgramItems
Get the program's items of a catalog for all languages- Parameters:
catalog
- The code of catalog- Returns:
- The
ProgramItem
-
getPrograms
Get the programs of a catalog- Parameters:
catalog
- The code of cataloglang
- The language. Can be null to get programs for all languages- Returns:
- The programs
-
copyCatalog
Copy the programs and its hierarchy from a catalog to another. The referenced courses are NOT copied.- Parameters:
catalog
- The new catalog to populatecatalogToCopy
- The catalog from which we copy the programs.- Throws:
ProcessingException
- If an error occurred during copy
-
getCopyActionId
Get the workflow action id for copy.- Returns:
- The workflow action id
-
deleteCatalog
Delete catalog- Parameters:
catalog
- the catalog to delete- Returns:
- the result map
-