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
DAO for manipulating glossary.
-
Field Summary
Modifier and TypeFieldDescriptionprotected AmetysObjectResolver
Ametys object resolverprotected SiteManager
The site managerstatic final String
The Avalon role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
_wordExists
(String word, String siteName, String language) Tests if the specified word exists in the glossary.createDefinition
(String word, String variants, String content, String display, String siteName, String language) Creates a word definition.deleteDefinitions
(ArrayList<String> ids) Deletes word definitions.editDefinition
(String id, String word, String variants, String content, String display, String siteName, String language) Edits a word definition.getDefinition
(String id) Get properties of a word definitiongetDefinition
(DefaultDefinition wordDefinition) Get the definition in JSONgetDefinitions
(String siteName, String lang) Get the word definitionsvoid
service
(ServiceManager manager) Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
-
Field Details
-
ROLE
The Avalon role -
_siteManager
The site manager -
_resolver
Ametys object resolver
-
-
Constructor Details
-
GlossaryDAO
public GlossaryDAO()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
getDefinitions
Get the word definitions- Parameters:
siteName
- The site namelang
- The language- Returns:
- The word definitions
-
getDefinition
Get properties of a word definition- Parameters:
id
- the id of definition- Returns:
- the properties
-
getDefinition
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
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.
-