org.mycore.datamodel.classifications2.impl
Class MCRCategLinkServiceImpl

java.lang.Object
  extended by org.mycore.datamodel.classifications2.impl.MCRCategLinkServiceImpl
All Implemented Interfaces:
MCRCategLinkService

public class MCRCategLinkServiceImpl
extends Object
implements MCRCategLinkService

Since:
2.0
Version:
$Revision: 15422 $ $Date: 2009-07-01 10:48:51 +0200 (Wed, 01 Jul 2009) $
Author:
Thomas Scheffler (yagee)

Constructor Summary
MCRCategLinkServiceImpl()
           
 
Method Summary
 Map<MCRCategoryID,Number> countLinks(MCRCategory parent, boolean childrenOnly)
          Counts links to a collection of categories.
 Map<MCRCategoryID,Number> countLinksForType(MCRCategory parent, 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MCRCategLinkServiceImpl

public MCRCategLinkServiceImpl()
Method Detail

countLinks

public Map<MCRCategoryID,Number> countLinks(MCRCategory parent,
                                            boolean childrenOnly)
Description copied from interface: MCRCategLinkService
Counts links to a collection of categories.

Specified by:
countLinks in interface MCRCategLinkService
Parameters:
parent - 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

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 interface MCRCategLinkService
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

public void deleteLink(String id)
Description copied from interface: MCRCategLinkService
Delete all links that refer to the given Object ID.

Specified by:
deleteLink in interface MCRCategLinkService
Parameters:
id - an Object ID
See Also:
MCRCategLinkService.deleteLinks(Collection)

deleteLinks

public void deleteLinks(Collection<String> ids)
Description copied from interface: MCRCategLinkService
Delete all links that refer to the given collection of Object IDs.

Specified by:
deleteLinks in interface MCRCategLinkService
Parameters:
ids - a collection of Object IDs
See Also:
MCRCategLinkService.deleteLink(String)

getLinksFromCategory

public Collection<String> getLinksFromCategory(MCRCategoryID id)
Description copied from interface: MCRCategLinkService
Returns a list of linked Object IDs.

Specified by:
getLinksFromCategory in interface MCRCategLinkService
Parameters:
id - ID of the category
Returns:
Collection of Object IDs

getLinksFromCategoryForType

public Collection<String> getLinksFromCategoryForType(MCRCategoryID id,
                                                      String type)
Description copied from interface: MCRCategLinkService
Returns a list of linked Object IDs restricted by the specified type.

Specified by:
getLinksFromCategoryForType in interface MCRCategLinkService
Parameters:
id - ID of the category
type - restrict links that refer to object of this type
Returns:
Collection of Object IDs

getLinksFromObject

public Collection<MCRCategoryID> getLinksFromObject(String id)
Description copied from interface: MCRCategLinkService
Returns a list of linked categories.

Specified by:
getLinksFromObject in interface MCRCategLinkService
Parameters:
id - Object ID of a linked Object
Returns:
list of MCRCategoryID of linked categories

setLinks

public void setLinks(MCRObjectReference objectReference,
                     Collection<MCRCategoryID> categories)
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 interface MCRCategLinkService
Parameters:
objectReference - reference to a Object
categories - a collection of categoryIDs to be linked to
See Also:
#countLinks(Collection), #countLinksForType(Collection, String)

hasLinks

public Map<MCRCategoryID,Boolean> hasLinks(MCRCategory category)
Description copied from interface: MCRCategLinkService
Checks if a categories id refered by objects.

Specified by:
hasLinks in interface MCRCategLinkService
Parameters:
category - a subtree rooted at a MCRCategory for which links should be counted
Returns:
true if the classification is used