Package org.ametys.plugins.thesaurus
Class ThesaurusDAO
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.thesaurus.ThesaurusDAO
- All Implemented Interfaces:
LogEnabled
,PluginAware
,Component
,Serviceable
DAO for manipulating thesaurus
-
Field Summary
Modifier and TypeFieldDescriptionprotected ModelItemTypeExtensionPoint
The extension point for available attribute typesprotected ContentDAO
The contentDAOprotected ContentTypeExtensionPoint
The extension point for content typesprotected ContentTypesHelper
The content types helperprotected CurrentUserProvider
The current user providerprotected EditContentTypeHelper
The EditContentTypeHelperprotected ObservationManager
Ametys observation mangerprotected AmetysObjectResolver
Ametys resolverprotected RightManager
The right managerstatic final String
Metadata for applicationNotestatic final String
Metadata for explanatoryNotestatic final String
Metadata for generic termstatic final String
Metadata for related termsstatic final String
Metadata for specific termsstatic final String
Metadata for synonymsstatic final String
Id of all microthesaurus super content typestatic final String
Metadata for related termsstatic final String
The Avalon role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected ModifiableTraversableAmetysObject
_getOrCreateNode
(ModifiableTraversableAmetysObject parentNode, String nodeName, String nodeType) Get or create a nodecheckBeforeMicrothesaurusDeletion
(String microthesaurusId) Do some check before microthesaurus deletioncreateMicrothesaurus
(String label, String thesaurusId, String microthesaurusName) Creates a microthesauruscreateThesaurus
(String label) Creates a thesaurusdeleteMicrothesaurus
(String microthesaurusId) Deletes a microthesaurusdeleteThesaurus
(String thesaurusId) Deletes a thesaurusfindThesaurusByLabel
(String label) Get a thesaurus by its labelgetAllTerms
(String microthesaurusId) Get the all terms of a microthesaurusgetChildTerms
(String microthesaurusId, String parentId) Get direct child terms of a termGet the list of ids of all the microthesauriigetMicrothesaurii
(String thesaurusId) Get microthesaurii of a thesaurusgetParentThesaurus
(ContentType microThesaurus) Get the parent thesaurusGet the root plugin storage object.getRootTerms
(String microthesaurusId) Get the root terms of a microthesaurusGet the list of thesaurusgetThesaurusLabel
(String thesaurusId) Get the label of thesaurusboolean
hasReferencingContents
(String microthesaurusId, Content term) Determines if a term which belongs to a microthesaurus is referenced by contents outside the microthesaurusvoid
service
(ServiceManager manager) 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.updateMicrothesaurus
(String microthesaurusId, String label) Edit a microthesaurusupdateThesaurus
(String thesaurusId, String label) Updates a thesaurusMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The Avalon role -
MICROTHESAURUS_CONTENT_TYPE_PREFIX
Metadata for related terms- See Also:
-
MICROTHESAURUS_ABSTRACT_CONTENT_TYPE
Id of all microthesaurus super content type- See Also:
-
METADATA_RELATED_TERMS
Metadata for related terms- See Also:
-
METADATA_SPECIFIC_TERMS
Metadata for specific terms- See Also:
-
METADATA_GENERIC_TERM
Metadata for generic term- See Also:
-
METADATA_SYNONYMS
Metadata for synonyms- See Also:
-
METADATA_APPLICATION_NOTE
Metadata for applicationNote- See Also:
-
METADATA_EXPLANATORY_NOTE
Metadata for explanatoryNote- See Also:
-
_resolver
Ametys resolver -
_rightManager
The right manager -
_currentUserProvider
The current user provider -
_contentTypeEP
The extension point for content types -
_contentTypesHelper
The content types helper -
_contentAttributeTypeExtensionPoint
The extension point for available attribute types -
_contentDAO
The contentDAO -
_editContentTypeHelper
The EditContentTypeHelper -
_observationManager
Ametys observation manger
-
-
Constructor Details
-
ThesaurusDAO
public ThesaurusDAO()
-
-
Method Details
-
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
-
getThesaurii
Get the list of thesaurus- Returns:
- the thesaurus
-
getMicrothesaurii
Get microthesaurii of a thesaurus- Parameters:
thesaurusId
- The id of thesaurus- Returns:
- the contentType ids of microthesaurii
-
getMicrothesaurii
Get the list of ids of all the microthesaurii- Returns:
- the list if microthesaurii ids
-
getParentThesaurus
Get the parent thesaurus- Parameters:
microThesaurus
- The microthesaurus- Returns:
- the parent thesaurus
-
findThesaurusByLabel
Get a thesaurus by its label- Parameters:
label
- the label- Returns:
- the thesaurus or null if not found
-
createThesaurus
Creates a thesaurus- Parameters:
label
- The label- Returns:
- The id and label of the created microthesaurus
-
updateThesaurus
public Map<String,Object> updateThesaurus(String thesaurusId, String label) throws EditContentTypeException Updates a thesaurus- Parameters:
thesaurusId
- The id of microthesauruslabel
- The new label- Returns:
- The id and label of the updated microthesaurus
- Throws:
EditContentTypeException
- if failed to update the existing content types for child microthesaurii.
-
deleteThesaurus
Deletes a thesaurus- Parameters:
thesaurusId
- The id of thesaurus- Returns:
- The id of the deleted thesaurus
-
getThesaurusLabel
Get the label of thesaurus- Parameters:
thesaurusId
- The id of thesaurus- Returns:
- The id and label of the thesaurus
-
getAllTerms
Get the all terms of a microthesaurus- Parameters:
microthesaurusId
- the id of microthesaurus- Returns:
- all terms
-
getRootTerms
Get the root terms of a microthesaurus- Parameters:
microthesaurusId
- the id of microthesaurus- Returns:
- root terms
-
getChildTerms
Get direct child terms of a term- Parameters:
microthesaurusId
- the id of microthesaurusparentId
- The parent Id- Returns:
- The child terms
-
hasReferencingContents
Determines if a term which belongs to a microthesaurus is referenced by contents outside the microthesaurus- Parameters:
microthesaurusId
- the id of microthesaurusterm
- the content term- Returns:
- true if the term has at least one referencing content outside the microthesaurus
-
createMicrothesaurus
public Map<String,Object> createMicrothesaurus(String label, String thesaurusId, String microthesaurusName) throws EditContentTypeException Creates a microthesaurus- Parameters:
label
- The labelthesaurusId
- The id of parent thesaurusmicrothesaurusName
- the name of the microthesaurus- Returns:
- The id and label of the created microthesaurus
- Throws:
EditContentTypeException
- if failed to create the microthesaurus content type
-
updateMicrothesaurus
public Map<String,Object> updateMicrothesaurus(String microthesaurusId, String label) throws EditContentTypeException Edit a microthesaurus- Parameters:
microthesaurusId
- The id of microthesaurus to editlabel
- The new label- Returns:
- The id and label of the updated microthesaurus
- Throws:
EditContentTypeException
- if failed to update the content type for this microthesaurus
-
checkBeforeMicrothesaurusDeletion
Do some check before microthesaurus deletion- Parameters:
microthesaurusId
- the id of microthesaurus- Returns:
- the check result
-
deleteMicrothesaurus
Deletes a microthesaurus- Parameters:
microthesaurusId
- The id of microthesaurus- Returns:
- The id of the deleted microthesaurus
-
getRootNode
Get the root plugin storage object.- Returns:
- the root plugin storage object.
- Throws:
AmetysRepositoryException
- if a repository error occurs.
-
_getOrCreateNode
protected ModifiableTraversableAmetysObject _getOrCreateNode(ModifiableTraversableAmetysObject parentNode, String nodeName, String nodeType) throws AmetysRepositoryException Get or create a node- Parameters:
parentNode
- the parent nodenodeName
- the name of the nodenodeType
- the type of the node- Returns:
- The retrieved or created node
- Throws:
AmetysRepositoryException
- if an error occurs when manipulating the repository
-