Package org.ametys.plugins.glossary
Class GlossaryDAO
- java.lang.Object
-
- org.apache.avalon.framework.logger.AbstractLogEnabled
-
- org.ametys.plugins.glossary.GlossaryDAO
-
- All Implemented Interfaces:
Component,LogEnabled,Serviceable
public class GlossaryDAO extends AbstractLogEnabled implements Serviceable, Component
DAO for manipulating glossary.
-
-
Field Summary
Fields Modifier and Type Field Description protected AmetysObjectResolver_resolverAmetys object resolverprotected SiteManager_siteManagerThe site managerstatic StringROLEThe Avalon role
-
Constructor Summary
Constructors Constructor Description GlossaryDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected boolean_wordExists(String word, String siteName, String language)Tests if the specified word exists in the glossary.Map<String,String>createDefinition(String word, String variants, String content, String display, String siteName, String language)Creates a word definition.Map<String,Object>deleteDefinitions(ArrayList<String> ids)Deletes word definitions.Map<String,String>editDefinition(String id, String word, String variants, String content, String display, String siteName, String language)Edits a word definition.Map<String,Object>getDefinition(String id)Get properties of a word definitionMap<String,Object>getDefinition(DefaultDefinition wordDefinition)Get the definition in JSONMap<String,Object>getDefinitions(String siteName, String lang)Get the word definitionsvoidservice(ServiceManager manager)-
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
-
-
-
Field Detail
-
_siteManager
protected SiteManager _siteManager
The site manager
-
_resolver
protected AmetysObjectResolver _resolver
Ametys object resolver
-
-
Constructor Detail
-
GlossaryDAO
public GlossaryDAO()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
getDefinitions
public Map<String,Object> getDefinitions(String siteName, String lang)
Get the word definitions- Parameters:
siteName- The site namelang- The language- Returns:
- The word definitions
-
getDefinition
public Map<String,Object> getDefinition(String id)
Get properties of a word definition- Parameters:
id- the id of definition- Returns:
- the properties
-
getDefinition
public Map<String,Object> getDefinition(DefaultDefinition wordDefinition)
Get the definition in JSON- Parameters:
wordDefinition- the word definition- Returns:
- the JSON for the word definition
-
createDefinition
public Map<String,String> createDefinition(String word, String variants, String content, String display, String siteName, String language)
Creates a word definition.- Parameters:
word- The wordvariants- The variantscontent- The contentdisplay- The value of displayOnTextsiteName- The site namelanguage- The language- Returns:
- The id of the created word, or an error
-
editDefinition
public Map<String,String> editDefinition(String id, String word, String variants, String content, String display, String siteName, String language)
Edits a word definition.- Parameters:
id- The id of the word to editword- The new wordvariants- The new variantscontent- The new contentdisplay- The new value of displayOnTextsiteName- The site namelanguage- The language- Returns:
- The id of the edited word, or an error
-
deleteDefinitions
public Map<String,Object> deleteDefinitions(ArrayList<String> ids)
Deletes word definitions.- Parameters:
ids- The ids of definitions to delete- Returns:
- The ids of the deleted words, the ids of the unknown words, and maybe an error
-
_wordExists
protected boolean _wordExists(String word, String siteName, String language) throws AmetysRepositoryException
Tests if the specified word exists in the glossary.- Parameters:
word- The word to test.siteName- The site name.language- The language.- Returns:
- true if the word exists.
- Throws:
AmetysRepositoryException- if a repository error occurs.
-
-