|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mycore.datamodel.classifications2.impl.MCRCategoryDAOImpl
public class MCRCategoryDAOImpl
| Constructor Summary | |
|---|---|
MCRCategoryDAOImpl()
|
|
| Method Summary | |
|---|---|
void |
addCategory(MCRCategoryID parentID,
MCRCategory category)
Adds a category as child of another category. |
void |
deleteCategory(MCRCategoryID id)
Deletes a category with all child categories. |
boolean |
exist(MCRCategoryID id)
Tells if a given category exists. |
(package private) static MCRCategoryImpl |
getByNaturalID(org.hibernate.Session session,
MCRCategoryID id)
|
List<MCRCategory> |
getCategoriesByLabel(MCRCategoryID baseID,
String lang,
String text)
Retrieve all Categories tagged by a specific label in a specific lang. |
MCRCategory |
getCategory(MCRCategoryID id,
int childLevel)
Returns MCRCategory with this id and childLevel levels of subcategories. |
List<MCRCategory> |
getChildren(MCRCategoryID cid)
Returns the list of child categories for the specified category. |
long |
getLastModified()
allows to determine when the last change was made to the categories. |
List<MCRCategory> |
getParents(MCRCategoryID id)
Returns the parent of the given category and its parent and so on. |
List<MCRCategory> |
getRootCategories()
Returns all categories that do not have a parent category. |
MCRCategory |
getRootCategory(MCRCategoryID baseID,
int childLevel)
Returns the root Category with ancestor axis of the specified category and childLevel levels of subcategories. |
List<MCRCategoryID> |
getRootCategoryIDs()
Returns all category IDs that do not have a parent category. |
boolean |
hasChildren(MCRCategoryID cid)
Tells if a given category contains subcategories. |
(package private) static boolean |
isCategoryMovedRight(MCRCategoryImpl oldParent,
MCRCategoryImpl newParent,
int newIndex,
int oldIndex)
return true if a node moved in Category tree is moved to the right. |
void |
moveCategory(MCRCategoryID id,
MCRCategoryID newParentID)
Moves a Category from one subtree in a classification to a new parent. |
void |
moveCategory(MCRCategoryID id,
MCRCategoryID newParentID,
int index)
Moves a Category from one subtree in a classification to a new parent as the indexth child. |
void |
removeLabel(MCRCategoryID id,
String lang)
Removes a label from a Category. |
void |
replaceCategory(MCRCategory newCategory)
Replaces a MCRCategory by a new version of the same
category. |
void |
setLabel(MCRCategoryID id,
MCRLabel label)
Sets or updates a label from a Category. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public MCRCategoryDAOImpl()
| Method Detail |
|---|
public void addCategory(MCRCategoryID parentID,
MCRCategory category)
MCRCategoryDAO
addCategory in interface MCRCategoryDAOparentID - ID of the parent categorycategory - Category (with children) to be addedpublic void deleteCategory(MCRCategoryID id)
MCRCategoryDAO
deleteCategory in interface MCRCategoryDAOid - ID of Category to be removedpublic boolean exist(MCRCategoryID id)
MCRCategoryDAO
exist in interface MCRCategoryDAOid - ID of Category
public List<MCRCategory> getCategoriesByLabel(MCRCategoryID baseID,
String lang,
String text)
MCRCategoryDAO
getCategoriesByLabel in interface MCRCategoryDAObaseID - base Category which subtree is searched for the label.lang - language attribute of the labeltext - text of the label
public MCRCategory getCategory(MCRCategoryID id,
int childLevel)
MCRCategoryDAO
getCategory in interface MCRCategoryDAOid - ID of categorychildLevel - how many levels of subcategories should be retrieved (-1 for
invinitive)
idpublic List<MCRCategory> getChildren(MCRCategoryID cid)
MCRCategoryDAO
getChildren in interface MCRCategoryDAOcid - ID of category
public List<MCRCategory> getParents(MCRCategoryID id)
MCRCategoryDAO
getParents in interface MCRCategoryDAOid - ID of Category
public List<MCRCategoryID> getRootCategoryIDs()
MCRCategoryDAO
getRootCategoryIDs in interface MCRCategoryDAOpublic List<MCRCategory> getRootCategories()
MCRCategoryDAO
getRootCategories in interface MCRCategoryDAO
public MCRCategory getRootCategory(MCRCategoryID baseID,
int childLevel)
MCRCategoryDAO
getRootCategory in interface MCRCategoryDAObaseID - Category with relative level set to "0".childLevel - amount of subcategory levels rooted at baseID category
MCRCategoryDAO.getParents(MCRCategoryID),
MCRCategoryDAO.getCategory(MCRCategoryID, int)public boolean hasChildren(MCRCategoryID cid)
MCRCategoryDAO
hasChildren in interface MCRCategoryDAOcid - ID of Category
public void moveCategory(MCRCategoryID id,
MCRCategoryID newParentID)
MCRCategoryDAO
moveCategory in interface MCRCategoryDAOid - ID of the Category which should be movednewParentID - ID of the new parent
public void moveCategory(MCRCategoryID id,
MCRCategoryID newParentID,
int index)
MCRCategoryDAOindexth child.
moveCategory in interface MCRCategoryDAOid - ID of the Category which should be movednewParentID - ID of the new parentindex - insert category at index in the list of children
public void removeLabel(MCRCategoryID id,
String lang)
MCRCategoryDAO
removeLabel in interface MCRCategoryDAOid - ID of the categorylang - which language should be removed?
public void replaceCategory(MCRCategory newCategory)
throws IllegalArgumentException
MCRCategoryDAOMCRCategory by a new version of the same
category.
This replacment includes all subcategories and labels. So former
subcategories and labels not present in newCategory 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.
replaceCategory in interface MCRCategoryDAOnewCategory - new version of MCRCategory
IllegalArgumentException - if old version of MCRCategory does not exist
public void setLabel(MCRCategoryID id,
MCRLabel label)
MCRCategoryDAO
setLabel in interface MCRCategoryDAOid - ID of the categorylabel - to be set or updatedpublic long getLastModified()
MCRCategoryDAO
getLastModified in interface MCRCategoryDAO
static boolean isCategoryMovedRight(MCRCategoryImpl oldParent,
MCRCategoryImpl newParent,
int newIndex,
int oldIndex)
newParent is not an ancestor node of
oldParent, a simple comparison of their left
values is done to determine if a node is moved to the right.
If the newParent is an ancestor node of
oldParent, the ancestor axis is walked up to the direct
child of newParent. The position of the direct child in
the childrenList of newParent is compared to
newIndex to determine if a node is moved to the right. If
oldParent is an ancestor newParent the
solution is analog.
oldParent - newParent - newIndex - oldIndex -
static MCRCategoryImpl getByNaturalID(org.hibernate.Session session,
MCRCategoryID id)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||