Package org.ametys.odf.catalog
Class CatalogDAO
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.odf.catalog.CatalogDAO
-
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
- Direct Known Subclasses:
CatalogDAO
public class CatalogDAO extends AbstractLogEnabled implements Serviceable, Component
DAO for manipulating catalogs.
-
-
Field Summary
Fields Modifier and Type Field Description protected CatalogsManager
_catalogsManager
The catalog managerprotected CurrentUserProvider
_currentUserProvider
The current user providerprotected I18nUtils
_i18nUtils
The I18N utilsprotected AmetysObjectResolver
_resolver
The ametys object resolverprotected Scheduler
_scheduler
The schedulerstatic String
ROLE
The Avalon role
-
Constructor Summary
Constructors Constructor Description CatalogDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,String>
createCatalog(String title, String name, String catalogNameToCopy)
Creates a new ODF catalog.Map<String,String>
editCatalog(String id, String title)
Edits an ODF catalog.Map<String,Object>
getCatalogProperties(String id)
Gets the properties of a catalog.Map<String,Object>
getCatalogProperties(Catalog catalog)
Get the properties of a catalog as a MapMap<String,Object>
getCatalogsProperties(List<String> ids)
Gets the properties of a set of catalogs.Map<String,Object>
removeCatalog(String catalogId, boolean forceDeletion)
Removes an ODF catalog.void
service(ServiceManager manager)
Map<String,String>
setDefaultCatalog(String id)
Set a catalog as default catalog-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
_catalogsManager
protected CatalogsManager _catalogsManager
The catalog manager
-
_resolver
protected AmetysObjectResolver _resolver
The ametys object resolver
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_scheduler
protected Scheduler _scheduler
The scheduler
-
_i18nUtils
protected I18nUtils _i18nUtils
The I18N utils
-
-
Constructor Detail
-
CatalogDAO
public CatalogDAO()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
createCatalog
public Map<String,String> createCatalog(String title, String name, String catalogNameToCopy) throws ProcessingException
Creates a new ODF catalog.- Parameters:
title
- The title of the catalogname
- The code of the catalogcatalogNameToCopy
- The catalog name to copy or null- Returns:
- The id and the title of the created catalog, or an error
- Throws:
ProcessingException
- if creation failed
-
editCatalog
public Map<String,String> editCatalog(String id, String title)
Edits an ODF catalog.- Parameters:
id
- The id of the catalog to edittitle
- The title of the catalog- Returns:
- The id and the title of the edited catalog, or an error
-
setDefaultCatalog
public Map<String,String> setDefaultCatalog(String id)
Set a catalog as default catalog- Parameters:
id
- The id of catalog- Returns:
- The id and the title of the edited catalog, or an error
-
removeCatalog
public Map<String,Object> removeCatalog(String catalogId, boolean forceDeletion)
Removes an ODF catalog.- Parameters:
catalogId
- the catalog's idforceDeletion
- if true, will not check if the catalog is referenced byProgramItem
s before deleting the catalog- Returns:
- The id of the deleted catalog, or an error
-
getCatalogProperties
public Map<String,Object> getCatalogProperties(String id)
Gets the properties of a catalog.- Parameters:
id
- The catalog id- Returns:
- The properties of the catalog in a map
-
getCatalogsProperties
public Map<String,Object> getCatalogsProperties(List<String> ids)
Gets the properties of a set of catalogs.- Parameters:
ids
- The catalogs' id- Returns:
- The properties of the catalogs
-
getCatalogProperties
public Map<String,Object> getCatalogProperties(Catalog catalog)
Get the properties of a catalog as a Map- Parameters:
catalog
- The catalog- Returns:
- The properties into a map object
-
-