Class MCREventedCategoryDAOImpl
java.lang.Object
org.mycore.datamodel.classifications2.impl.MCRCategoryDAOImpl
org.mycore.datamodel.classifications2.impl.MCREventedCategoryDAOImpl
- All Implemented Interfaces:
MCRCategoryDAO
Category DAO Implementation with Event Handlers
- Author:
- Tobias Lenhardt [Hammer1279]
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddCategory
(MCRCategoryID parentID, MCRCategory category, int position) Adds a category as child of another category.void
Deletes a category with all child categories.void
moveCategory
(MCRCategoryID id, MCRCategoryID newParentID, int index) Moves a Category from one subtree in a classification to a new parent as theindex
th child.removeLabel
(MCRCategoryID id, String lang) Removes a label from a Category.replaceCategory
(MCRCategory newCategory) Replaces aMCRCategory
by a new version of the same category.setLabel
(MCRCategoryID id, MCRLabel label) Sets or updates a label from a Category.setLabels
(MCRCategoryID id, SortedSet<MCRLabel> labels) Sets a new set of labels from a Category.Methods inherited from class org.mycore.datamodel.classifications2.impl.MCRCategoryDAOImpl
addCategory, exist, getByNaturalID, getCategoriesByLabel, getCategoriesByLabel, getCategory, getChildren, getLastModified, getLastModified, getParents, getRootCategories, getRootCategory, getRootCategoryIDs, hasChildren, moveCategory, repairLeftRightValue, setURI, updateLastModified
-
Constructor Details
-
MCREventedCategoryDAOImpl
public MCREventedCategoryDAOImpl()
-
-
Method Details
-
addCategory
Description copied from interface:MCRCategoryDAO
Adds a category as child of another category. When parentID is null a root category will be created.- Specified by:
addCategory
in interfaceMCRCategoryDAO
- Overrides:
addCategory
in classMCRCategoryDAOImpl
- Parameters:
parentID
- ID of the parent categorycategory
- Category (with children) to be addedposition
- insert position- Returns:
- the parent category
-
deleteCategory
Description copied from interface:MCRCategoryDAO
Deletes a category with all child categories.- Specified by:
deleteCategory
in interfaceMCRCategoryDAO
- Overrides:
deleteCategory
in classMCRCategoryDAOImpl
- Parameters:
id
- ID of Category to be removed
-
moveCategory
Description copied from interface:MCRCategoryDAO
Moves a Category from one subtree in a classification to a new parent as theindex
th child.- Specified by:
moveCategory
in interfaceMCRCategoryDAO
- Overrides:
moveCategory
in classMCRCategoryDAOImpl
- Parameters:
id
- ID of the Category which should be movednewParentID
- ID of the new parentindex
- insert category at index in the list of children
-
removeLabel
Description copied from interface:MCRCategoryDAO
Removes a label from a Category.- Specified by:
removeLabel
in interfaceMCRCategoryDAO
- Overrides:
removeLabel
in classMCRCategoryDAOImpl
- Parameters:
id
- ID of the categorylang
- which language should be removed?- Returns:
- category where the label was removed
-
replaceCategory
public Collection<MCRCategoryImpl> replaceCategory(MCRCategory newCategory) throws IllegalArgumentException Description copied from interface:MCRCategoryDAO
Replaces aMCRCategory
by a new version of the same category. This replacment includes all subcategories and labels. So former subcategories and labels not present innewCategory
will be removed while new ones will be inserted. If you can use the other methods defined by this interface as they ought to be more optimized.- Specified by:
replaceCategory
in interfaceMCRCategoryDAO
- Overrides:
replaceCategory
in classMCRCategoryDAOImpl
- Parameters:
newCategory
- new version of MCRCategory- Returns:
- collection of replaced categories
- Throws:
IllegalArgumentException
- if old version of MCRCategory does not exist
-
setLabel
Description copied from interface:MCRCategoryDAO
Sets or updates a label from a Category.- Specified by:
setLabel
in interfaceMCRCategoryDAO
- Overrides:
setLabel
in classMCRCategoryDAOImpl
- Parameters:
id
- ID of the categorylabel
- to be set or updated- Returns:
- category where the label was set
-
setLabels
Description copied from interface:MCRCategoryDAO
Sets a new set of labels from a Category.- Specified by:
setLabels
in interfaceMCRCategoryDAO
- Overrides:
setLabels
in classMCRCategoryDAOImpl
- Parameters:
id
- ID of the categorylabels
- to be set- Returns:
- category where the labels was set
-