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
public class ThesaurusDAO extends AbstractLogEnabled implements Serviceable, Component, PluginAware
DAO for manipulating thesaurus
-
-
Field Summary
Fields Modifier and Type Field Description protected ContentAttributeTypeExtensionPoint_contentAttributeTypeExtensionPointThe extension point for available attribute typesprotected ContentDAO_contentDAOThe contentDAOprotected ContentTypeExtensionPoint_contentTypeEPThe extension point for content typesprotected ContentTypesHelper_contentTypesHelperThe content types helperprotected CurrentUserProvider_currentUserProviderThe current user providerprotected EditContentTypeHelper_editContentTypeHelperThe EditContentTypeHelperprotected ObservationManager_observationManagerAmetys observation mangerprotected AmetysObjectResolver_resolverAmetys resolverprotected RightManager_rightManagerThe right managerstatic StringMETADATA_APPLICATION_NOTEMetadata for applicationNotestatic StringMETADATA_EXPLANATORY_NOTEMetadata for explanatoryNotestatic StringMETADATA_GENERIC_TERMMetadata for generic termstatic StringMETADATA_RELATED_TERMSMetadata for related termsstatic StringMETADATA_SPECIFIC_TERMSMetadata for specific termsstatic StringMETADATA_SYNONYMSMetadata for synonymsstatic StringMICROTHESAURUS_ABSTRACT_CONTENT_TYPEId of all microthesaurus super content typestatic StringMICROTHESAURUS_CONTENT_TYPE_PREFIXMetadata for related termsstatic StringROLEThe Avalon role
-
Constructor Summary
Constructors Constructor Description ThesaurusDAO()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ModifiableTraversableAmetysObject_getOrCreateNode(ModifiableTraversableAmetysObject parentNode, String nodeName, String nodeType)Get or create a nodeMap<String,Object>checkBeforeMicrothesaurusDeletion(String microthesaurusId)Do some check before microthesaurus deletionMap<String,Object>createMicrothesaurus(String label, String thesaurusId, String microthesaurusName)Creates a microthesaurusMap<String,Object>createThesaurus(String label)Creates a thesaurusMap<String,Object>deleteMicrothesaurus(String microthesaurusId)Deletes a microthesaurusMap<String,Object>deleteThesaurus(String thesaurusId)Deletes a thesaurusThesaurusfindThesaurusByLabel(String label)Get a thesaurus by its labelAmetysObjectIterable<Content>getAllTerms(String microthesaurusId)Get the all terms of a microthesaurusAmetysObjectIterable<Content>getChildTerms(String microthesaurusId, String parentId)Get direct child terms of a termList<String>getMicrothesaurii()Get the list of ids of all the microthesauriiList<String>getMicrothesaurii(String thesaurusId)Get microthesaurii of a thesaurusThesaurusgetParentThesaurus(ContentType microThesaurus)Get the parent thesaurusModifiableTraversableAmetysObjectgetRootNode()Get the root plugin storage object.AmetysObjectIterable<Content>getRootTerms(String microthesaurusId)Get the root terms of a microthesaurusAmetysObjectIterable<Thesaurus>getThesaurii()Get the list of thesaurusStringgetThesaurusLabel(String thesaurusId)Get the label of thesaurusbooleanhasReferencingContents(String microthesaurusId, Content term)Determines if a term which belongs to a microthesaurus is referenced by contents outside the microthesaurusvoidservice(ServiceManager manager)voidsetPluginInfo(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.Map<String,Object>updateMicrothesaurus(String microthesaurusId, String label)Edit a microthesaurusMap<String,Object>updateThesaurus(String thesaurusId, String label)Updates a thesaurus-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Field Detail
-
MICROTHESAURUS_CONTENT_TYPE_PREFIX
public static final String MICROTHESAURUS_CONTENT_TYPE_PREFIX
Metadata for related terms- See Also:
- Constant Field Values
-
MICROTHESAURUS_ABSTRACT_CONTENT_TYPE
public static final String MICROTHESAURUS_ABSTRACT_CONTENT_TYPE
Id of all microthesaurus super content type- See Also:
- Constant Field Values
-
METADATA_RELATED_TERMS
public static final String METADATA_RELATED_TERMS
Metadata for related terms- See Also:
- Constant Field Values
-
METADATA_SPECIFIC_TERMS
public static final String METADATA_SPECIFIC_TERMS
Metadata for specific terms- See Also:
- Constant Field Values
-
METADATA_GENERIC_TERM
public static final String METADATA_GENERIC_TERM
Metadata for generic term- See Also:
- Constant Field Values
-
METADATA_SYNONYMS
public static final String METADATA_SYNONYMS
Metadata for synonyms- See Also:
- Constant Field Values
-
METADATA_APPLICATION_NOTE
public static final String METADATA_APPLICATION_NOTE
Metadata for applicationNote- See Also:
- Constant Field Values
-
METADATA_EXPLANATORY_NOTE
public static final String METADATA_EXPLANATORY_NOTE
Metadata for explanatoryNote- See Also:
- Constant Field Values
-
_resolver
protected AmetysObjectResolver _resolver
Ametys resolver
-
_rightManager
protected RightManager _rightManager
The right manager
-
_currentUserProvider
protected CurrentUserProvider _currentUserProvider
The current user provider
-
_contentTypeEP
protected ContentTypeExtensionPoint _contentTypeEP
The extension point for content types
-
_contentTypesHelper
protected ContentTypesHelper _contentTypesHelper
The content types helper
-
_contentAttributeTypeExtensionPoint
protected ContentAttributeTypeExtensionPoint _contentAttributeTypeExtensionPoint
The extension point for available attribute types
-
_contentDAO
protected ContentDAO _contentDAO
The contentDAO
-
_editContentTypeHelper
protected EditContentTypeHelper _editContentTypeHelper
The EditContentTypeHelper
-
_observationManager
protected ObservationManager _observationManager
Ametys observation manger
-
-
Constructor Detail
-
ThesaurusDAO
public ThesaurusDAO()
-
-
Method Detail
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
setPluginInfo
public void setPluginInfo(String pluginName, String featureName, String id)
Description copied from interface:PluginAwareSets 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:
setPluginInfoin 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
public AmetysObjectIterable<Thesaurus> getThesaurii()
Get the list of thesaurus- Returns:
- the thesaurus
-
getMicrothesaurii
public List<String> getMicrothesaurii(String thesaurusId)
Get microthesaurii of a thesaurus- Parameters:
thesaurusId- The id of thesaurus- Returns:
- the contentType ids of microthesaurii
-
getMicrothesaurii
public List<String> getMicrothesaurii()
Get the list of ids of all the microthesaurii- Returns:
- the list if microthesaurii ids
-
getParentThesaurus
public Thesaurus getParentThesaurus(ContentType microThesaurus)
Get the parent thesaurus- Parameters:
microThesaurus- The microthesaurus- Returns:
- the parent thesaurus
-
findThesaurusByLabel
public Thesaurus findThesaurusByLabel(String label)
Get a thesaurus by its label- Parameters:
label- the label- Returns:
- the thesaurus or null if not found
-
createThesaurus
public Map<String,Object> createThesaurus(String label)
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
public Map<String,Object> deleteThesaurus(String thesaurusId)
Deletes a thesaurus- Parameters:
thesaurusId- The id of thesaurus- Returns:
- The id of the deleted thesaurus
-
getThesaurusLabel
public String getThesaurusLabel(String thesaurusId)
Get the label of thesaurus- Parameters:
thesaurusId- The id of thesaurus- Returns:
- The id and label of the thesaurus
-
getAllTerms
public AmetysObjectIterable<Content> getAllTerms(String microthesaurusId)
Get the all terms of a microthesaurus- Parameters:
microthesaurusId- the id of microthesaurus- Returns:
- all terms
-
getRootTerms
public AmetysObjectIterable<Content> getRootTerms(String microthesaurusId)
Get the root terms of a microthesaurus- Parameters:
microthesaurusId- the id of microthesaurus- Returns:
- root terms
-
getChildTerms
public AmetysObjectIterable<Content> getChildTerms(String microthesaurusId, String parentId)
Get direct child terms of a term- Parameters:
microthesaurusId- the id of microthesaurusparentId- The parent Id- Returns:
- The child terms
-
hasReferencingContents
public boolean hasReferencingContents(String microthesaurusId, Content term)
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
public Map<String,Object> checkBeforeMicrothesaurusDeletion(String microthesaurusId)
Do some check before microthesaurus deletion- Parameters:
microthesaurusId- the id of microthesaurus- Returns:
- the check result
-
deleteMicrothesaurus
public Map<String,Object> deleteMicrothesaurus(String microthesaurusId)
Deletes a microthesaurus- Parameters:
microthesaurusId- The id of microthesaurus- Returns:
- The id of the deleted microthesaurus
-
getRootNode
public ModifiableTraversableAmetysObject getRootNode() throws AmetysRepositoryException
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
-
-