org.mycore.datamodel.classifications2
Interface MCRCategLinkService

All Known Implementing Classes:
MCRCategLinkServiceImpl

public interface MCRCategLinkService

Since:
2.0
Version:
$Revision: 15001 $ $Date: 2009-03-24 17:39:36 +0100 (Tue, 24 Mar 2009) $
Author:
Thomas Scheffler (yagee)

Method Summary
 Map<MCRCategoryID,Number> countLinks(MCRCategory category, boolean childrenOnly)
          Counts links to a collection of categories.
 Map<MCRCategoryID,Number> countLinksForType(MCRCategory category, String type, boolean childrenOnly)
          Counts links to a collection of categories.
 void deleteLink(String id)
          Delete all links that refer to the given Object ID.
 void deleteLinks(Collection<String> ids)
          Delete all links that refer to the given collection of Object IDs.
 Collection<String> getLinksFromCategory(MCRCategoryID id)
          Returns a list of linked Object IDs.
 Collection<String> getLinksFromCategoryForType(MCRCategoryID id, String type)
          Returns a list of linked Object IDs restricted by the specified type.
 Collection<MCRCategoryID> getLinksFromObject(String id)
          Returns a list of linked categories.
 Map<MCRCategoryID,Boolean> hasLinks(MCRCategory category)
          Checks if a categories id refered by objects.
 void setLinks(MCRObjectReference objectReference, Collection<MCRCategoryID> categories)
          Add links between categories and Objects.
 

Method Detail

hasLinks

Map<MCRCategoryID,Boolean> hasLinks(MCRCategory category)
Checks if a categories id refered by objects.

Parameters:
category - a subtree rooted at a MCRCategory for which links should be counted
Returns:
true if the classification is used

countLinks

Map<MCRCategoryID,Number> countLinks(MCRCategory category,
                                     boolean childrenOnly)
Counts links to a collection of categories.

Parameters:
category - a subtree rooted at a MCRCategory for which links should be counted
childrenOnly - 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

Map<MCRCategoryID,Number> countLinksForType(MCRCategory category,
                                            String type,
                                            boolean childrenOnly)
Counts links to a collection of categories.

Parameters:
categIDs - a subtree rooted at a MCRCategory for which links should be counted
type - restrict links that refer to object of this type
childrenOnly - 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

void deleteLink(String id)
Delete all links that refer to the given Object ID.

Parameters:
id - an Object ID
See Also:
deleteLinks(Collection)

deleteLinks

void deleteLinks(Collection<String> ids)
Delete all links that refer to the given collection of Object IDs.

Parameters:
ids - a collection of Object IDs
See Also:
deleteLink(String)

getLinksFromCategory

Collection<String> getLinksFromCategory(MCRCategoryID id)
Returns a list of linked Object IDs.

Parameters:
id - ID of the category
Returns:
Collection of Object IDs

getLinksFromCategoryForType

Collection<String> getLinksFromCategoryForType(MCRCategoryID id,
                                               String type)
Returns a list of linked Object IDs restricted by the specified type.

Parameters:
id - ID of the category
type - restrict links that refer to object of this type
Returns:
Collection of Object IDs

getLinksFromObject

Collection<MCRCategoryID> getLinksFromObject(String id)
Returns a list of linked categories.

Parameters:
id - Object ID of a linked Object
Returns:
list of MCRCategoryID of linked categories

setLinks

void setLinks(MCRObjectReference objectReference,
              Collection<MCRCategoryID> categories)
Add links between categories and Objects. Implementors must assure that ancestor (parent) axis categories are implicit linked by this method.

Parameters:
objectReference - reference to a Object
categories - a collection of categoryIDs to be linked to
See Also:
#countLinks(Collection), #countLinksForType(Collection, String)