Package org.ametys.odf.catalog
Class CatalogDAO
- java.lang.Object
-
- org.ametys.odf.catalog.CatalogDAO
-
- All Implemented Interfaces:
Component
,Contextualizable
,Serviceable
- Direct Known Subclasses:
CatalogDAO
public class CatalogDAO extends Object implements Serviceable, Component, Contextualizable
DAO for manipulating catalogs.
-
-
Field Summary
Fields Modifier and Type Field Description protected CatalogsManager
_catalogsManager
The catalog managerprotected Context
_context
The avalon context.protected CurrentUserProvider
_currentUserProvider
The current user providerprotected ServiceManager
_manager
The managerprotected AmetysObjectResolver
_resolver
The ametys object resolverprotected UserManager
_userManager
The users managerstatic String
ROLE
The Avalon role
-
Constructor Summary
Constructors Constructor Description CatalogDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
contextualize(Context context)
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>
generatePDF(String name, Map<String,Object> contextualParameters)
Generates the PDF of this 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 id)
Removes an ODF catalog.void
service(ServiceManager manager)
Map<String,String>
setDefaultCatalog(String id)
Set a catalog as default catalog
-
-
-
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
-
_userManager
protected UserManager _userManager
The users manager
-
_manager
protected ServiceManager _manager
The manager
-
-
Constructor Detail
-
CatalogDAO
public CatalogDAO()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
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 id)
Removes an ODF catalog.- Parameters:
id
- The id of the catalog to remove- 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
-
generatePDF
public Map<String,Object> generatePDF(String name, Map<String,Object> contextualParameters)
Generates the PDF of this catalog.- Parameters:
name
- The name (code) of the catalog to exportcontextualParameters
- the contextual parameters- Returns:
- An empty map, or an error
-
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
-
-