Class MCRCategLinkServiceImpl
java.lang.Object
org.mycore.datamodel.classifications2.impl.MCRCategLinkServiceImpl
- All Implemented Interfaces:
MCRCategLinkService
- Direct Known Subclasses:
MCRSolrCategLinkService
- Since:
- 2.0
- Version:
- $Revision$ $Date$
- Author:
- Thomas Scheffler (yagee)
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncountLinks
(MCRCategory parent, boolean childrenOnly) Counts links to a collection of categories.countLinksForType
(MCRCategory parent, String type, boolean childrenOnly) Counts links to a collection of categories.void
deleteLink
(MCRCategLinkReference reference) Delete all links that refer to the givenMCRCategLinkReference
.void
Delete all links that refer to the given collection of category links.Returns a collection of all links for the given type.Returns a list of linked Object IDs.getLinksFromCategoryForType
(MCRCategoryID id, String type) Returns a list of linked Object IDs restricted by the specified type.getLinksFromReference
(MCRCategLinkReference reference) Returns a list of linked categories.getReferences
(String type) Return a collection of all category link references for the given typegetTypes()
Return a collection of all link types.boolean
hasLink
(MCRCategory mcrCategory) Checks if the category with the given id is liked with an objecthasLinks
(MCRCategory category) Checks if a categories id refered by objects.boolean
isInCategory
(MCRCategLinkReference reference, MCRCategoryID id) Checks if a given reference is in a specific category.void
setLinks
(MCRCategLinkReference objectReference, Collection<MCRCategoryID> categories) Add links between categories and Objects.
-
Constructor Details
-
MCRCategLinkServiceImpl
public MCRCategLinkServiceImpl()
-
-
Method Details
-
countLinks
Description copied from interface:MCRCategLinkService
Counts links to a collection of categories.- Specified by:
countLinks
in interfaceMCRCategLinkService
- Parameters:
parent
- a subtree rooted at a MCRCategory for which links should be countedchildrenOnly
- if only direct children of category should be queried (query may be more optimized)- Returns:
- a Map with MCRCategoryID as key and the number of links as value
-
countLinksForType
public Map<MCRCategoryID,Number> countLinksForType(MCRCategory parent, String type, boolean childrenOnly) Description copied from interface:MCRCategLinkService
Counts links to a collection of categories.- Specified by:
countLinksForType
in interfaceMCRCategLinkService
- Parameters:
parent
- a subtree rooted at a MCRCategory for which links should be countedtype
- restrict links that refer to object of this typechildrenOnly
- if only direct children of category should be queried (query may be more optimized)- Returns:
- a Map with MCRCategoryID as key and the number of links as value
-
deleteLink
Description copied from interface:MCRCategLinkService
Delete all links that refer to the givenMCRCategLinkReference
.- Specified by:
deleteLink
in interfaceMCRCategLinkService
- Parameters:
reference
- an Object ID- See Also:
-
deleteLinks
Description copied from interface:MCRCategLinkService
Delete all links that refer to the given collection of category links.- Specified by:
deleteLinks
in interfaceMCRCategLinkService
- Parameters:
ids
- a collection ofMCRCategLinkReference
- See Also:
-
getLinksFromCategory
Description copied from interface:MCRCategLinkService
Returns a list of linked Object IDs.- Specified by:
getLinksFromCategory
in interfaceMCRCategLinkService
- Parameters:
id
- ID of the category- Returns:
- Collection of Object IDs, empty Collection when no links exist
-
getLinksFromCategoryForType
Description copied from interface:MCRCategLinkService
Returns a list of linked Object IDs restricted by the specified type.- Specified by:
getLinksFromCategoryForType
in interfaceMCRCategLinkService
- Parameters:
id
- ID of the categorytype
- restrict links that refer to object of this type- Returns:
- Collection of Object IDs
-
getLinksFromReference
Description copied from interface:MCRCategLinkService
Returns a list of linked categories.- Specified by:
getLinksFromReference
in interfaceMCRCategLinkService
- Parameters:
reference
- reference, e.g. to a MCRObject- Returns:
- list of MCRCategoryID of linked categories
-
setLinks
Description copied from interface:MCRCategLinkService
Add links between categories and Objects. Implementors must assure that ancestor (parent) axis categories are implicit linked by this method.- Specified by:
setLinks
in interfaceMCRCategLinkService
- Parameters:
objectReference
- reference to a Objectcategories
- a collection of categoryIDs to be linked to- See Also:
-
hasLinks
Description copied from interface:MCRCategLinkService
Checks if a categories id refered by objects.- Specified by:
hasLinks
in interfaceMCRCategLinkService
- Parameters:
category
- a subtree rooted at a MCRCategory for which links should be counted- Returns:
- true if the classification is used
-
hasLink
Description copied from interface:MCRCategLinkService
Checks if the category with the given id is liked with an object- Specified by:
hasLink
in interfaceMCRCategLinkService
- Returns:
- true if is linked otherwise false
-
isInCategory
Description copied from interface:MCRCategLinkService
Checks if a given reference is in a specific category.- Specified by:
isInCategory
in interfaceMCRCategLinkService
- Parameters:
reference
- reference, e.g. to a MCRObject- Returns:
- true if the reference is in the category
-
getReferences
Description copied from interface:MCRCategLinkService
Return a collection of all category link references for the given type- Specified by:
getReferences
in interfaceMCRCategLinkService
-
getTypes
Description copied from interface:MCRCategLinkService
Return a collection of all link types.- Specified by:
getTypes
in interfaceMCRCategLinkService
-
getLinks
Description copied from interface:MCRCategLinkService
Returns a collection of all links for the given type.- Specified by:
getLinks
in interfaceMCRCategLinkService
-