public class ThesaurusDAO extends AbstractLogEnabled implements Serviceable, Component, PluginAware
Modifier and Type | Field and Description |
---|---|
private static String |
__PLUGIN_NODE_NAME |
private static String |
__ROOT_THESAURII_NODETYPE |
protected ContentDAO |
_contentDAO
The contentDAO
|
protected ContentTypeExtensionPoint |
_contentTypeEP
The extension point for content types
|
protected CurrentUserProvider |
_currentUserProvider
The current user provider
|
protected EditContentTypeHelper |
_editContentTypeHelper
The EditContentTypeHelper
|
protected ObservationManager |
_observationManager
Ametys observation manger
|
private String |
_pluginName |
protected AmetysObjectResolver |
_resolver
Ametys resolver
|
protected RightManager |
_rightManager
The right manager
|
static String |
METADATA_APPLICATION_NOTE
Metadata for applicationNote
|
static String |
METADATA_EXPLANATORY_NOTE
Metadata for explanatoryNote
|
static String |
METADATA_GENERIC_TERM
Metadata for generic term
|
static String |
METADATA_RELATED_TERMS
Metadata for related terms
|
static String |
METADATA_SPECIFIC_TERMS
Metadata for specific terms
|
static String |
METADATA_SYNONYMS
Metadata for synonyms
|
static String |
MICROTHESAURUS_ABSTRACT_CONTENT_TYPE
Id of all microthesaurus super content type
|
static String |
MICROTHESAURUS_CONTENT_TYPE_PREFIX
Metadata for related terms
|
static String |
ROLE
The Avalon role
|
Constructor and Description |
---|
ThesaurusDAO() |
Modifier and Type | Method and Description |
---|---|
private void |
_deleteTerm(Content term) |
private List<MetadataDefinition> |
_getMetadata(String microthesaurusCTypeId)
Get the additional metadata for a microthesaurus
|
private ContentTypeDefinition |
_getMicrothesaurusContentTypeDefinition(String cTypeId,
String label,
Thesaurus parentThesaurus)
Get the contentTypeDefinition for a microthesaurus
|
protected ModifiableTraversableAmetysObject |
_getOrCreateNode(ModifiableTraversableAmetysObject parentNode,
String nodeName,
String nodeType)
Get or create a node
|
Map<String,Object> |
checkBeforeMicrothesaurusDeletion(String microthesaurusId)
Do some check before microthesaurus deletion
|
Map<String,Object> |
createMicrothesaurus(String label,
String thesaurusId,
String microthesaurusName)
Creates a microthesaurus
|
Map<String,Object> |
createThesaurus(String label)
Creates a thesaurus
|
Map<String,Object> |
deleteMicrothesaurus(String microthesaurusId)
Deletes a microthesaurus
|
Map<String,Object> |
deleteThesaurus(String thesaurusId)
Deletes a thesaurus
|
Thesaurus |
findThesaurusByLabel(String label)
Get a thesaurus by its label
|
AmetysObjectIterable<Content> |
getAllTerms(String microthesaurusId)
Get the all terms of a microthesaurus
|
AmetysObjectIterable<Content> |
getChildTerms(String microthesaurusId,
String parentId)
Get direct child terms of a term
|
List<String> |
getMicrothesaurii()
Get the list of ids of all the microthesaurii
|
List<String> |
getMicrothesaurii(String thesaurusId)
Get microthesaurii of a thesaurus
|
Thesaurus |
getParentThesaurus(ContentType microThesaurus)
Get the parent thesaurus
|
ModifiableTraversableAmetysObject |
getRootNode()
Get the root plugin storage object.
|
AmetysObjectIterable<Content> |
getRootTerms(String microthesaurusId)
Get the root terms of a microthesaurus
|
AmetysObjectIterable<Thesaurus> |
getThesaurii()
Get the list of thesaurus
|
String |
getThesaurusLabel(String thesaurusId)
Get the label of thesaurus
|
boolean |
hasReferencingContents(String microthesaurusId,
Content term)
Determines if a term which belongs to a microthesaurus is referenced by contents outside the microthesaurus
|
void |
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. |
Map<String,Object> |
updateMicrothesaurus(String microthesaurusId,
String label)
Edit a microthesaurus
|
Map<String,Object> |
updateThesaurus(String thesaurusId,
String label)
Updates a thesaurus
|
getLogger, setLogger
public static final String MICROTHESAURUS_CONTENT_TYPE_PREFIX
public static final String MICROTHESAURUS_ABSTRACT_CONTENT_TYPE
public static final String METADATA_RELATED_TERMS
public static final String METADATA_SPECIFIC_TERMS
public static final String METADATA_GENERIC_TERM
public static final String METADATA_SYNONYMS
public static final String METADATA_APPLICATION_NOTE
public static final String METADATA_EXPLANATORY_NOTE
private static final String __PLUGIN_NODE_NAME
private static final String __ROOT_THESAURII_NODETYPE
protected AmetysObjectResolver _resolver
protected RightManager _rightManager
protected CurrentUserProvider _currentUserProvider
protected ContentTypeExtensionPoint _contentTypeEP
protected ContentDAO _contentDAO
protected EditContentTypeHelper _editContentTypeHelper
protected ObservationManager _observationManager
private String _pluginName
public ThesaurusDAO()
public void service(ServiceManager manager) throws ServiceException
service
in interface Serviceable
ServiceException
public void setPluginInfo(String pluginName, String featureName, String id)
PluginAware
setPluginInfo
in interface PluginAware
pluginName
- Unique identifier for the plugin hosting the extensionfeatureName
- Unique feature identifier (unique for a given pluginName)id
- Unique identifier of this componentpublic AmetysObjectIterable<Thesaurus> getThesaurii()
public List<String> getMicrothesaurii(String thesaurusId)
thesaurusId
- The id of thesauruspublic List<String> getMicrothesaurii()
public Thesaurus getParentThesaurus(ContentType microThesaurus)
microThesaurus
- The microthesaurusprivate ContentTypeDefinition _getMicrothesaurusContentTypeDefinition(String cTypeId, String label, Thesaurus parentThesaurus)
cTypeId
- The id of content type for this microthesauruslabel
- The label of the microthesaurusparentThesaurus
- The parent thesaurusprivate List<MetadataDefinition> _getMetadata(String microthesaurusCTypeId)
microthesaurusCTypeId
- The id of content type for this microthesauruspublic Thesaurus findThesaurusByLabel(String label)
label
- the labelpublic Map<String,Object> createThesaurus(String label)
label
- The labelpublic Map<String,Object> updateThesaurus(String thesaurusId, String label) throws EditContentTypeException
thesaurusId
- The id of microthesauruslabel
- The new labelEditContentTypeException
- if failed to update the existing content types for child microthesaurii.public Map<String,Object> deleteThesaurus(String thesaurusId)
thesaurusId
- The id of thesauruspublic String getThesaurusLabel(String thesaurusId)
thesaurusId
- The id of thesauruspublic AmetysObjectIterable<Content> getAllTerms(String microthesaurusId)
microthesaurusId
- the id of microthesauruspublic AmetysObjectIterable<Content> getRootTerms(String microthesaurusId)
microthesaurusId
- the id of microthesauruspublic AmetysObjectIterable<Content> getChildTerms(String microthesaurusId, String parentId)
microthesaurusId
- the id of microthesaurusparentId
- The parent Idpublic boolean hasReferencingContents(String microthesaurusId, Content term)
microthesaurusId
- the id of microthesaurusterm
- the content termpublic Map<String,Object> createMicrothesaurus(String label, String thesaurusId, String microthesaurusName) throws EditContentTypeException
label
- The labelthesaurusId
- The id of parent thesaurusmicrothesaurusName
- the name of the microthesaurusEditContentTypeException
- if failed to create the microthesaurus content typepublic Map<String,Object> updateMicrothesaurus(String microthesaurusId, String label) throws EditContentTypeException
microthesaurusId
- The id of microthesaurus to editlabel
- The new labelEditContentTypeException
- if failed to update the content type for this microthesauruspublic Map<String,Object> checkBeforeMicrothesaurusDeletion(String microthesaurusId)
microthesaurusId
- the id of microthesauruspublic Map<String,Object> deleteMicrothesaurus(String microthesaurusId)
microthesaurusId
- The id of microthesaurusprivate void _deleteTerm(Content term)
public ModifiableTraversableAmetysObject getRootNode() throws AmetysRepositoryException
AmetysRepositoryException
- if a repository error occurs.protected ModifiableTraversableAmetysObject _getOrCreateNode(ModifiableTraversableAmetysObject parentNode, String nodeName, String nodeType) throws AmetysRepositoryException
parentNode
- the parent nodenodeName
- the name of the nodenodeType
- the type of the nodeAmetysRepositoryException
- if an error occurs when manipulating the repository