org.mycore.datamodel.common
Class MCRLinkTableManager

java.lang.Object
  extended by org.mycore.datamodel.common.MCRLinkTableManager

public class MCRLinkTableManager
extends Object

This class manage all accesses to the link table database. This database holds all informations about links between MCRObjects/MCRClassifications.

Version:
$Revision: 14986 $ $Date: 2009-03-20 21:41:45 +0100 (Fri, 20 Mar 2009) $
Author:
Jens Kupferschmidt

Field Summary
static String ENTRY_TYPE_CHILD
          The list of entry types
static String ENTRY_TYPE_DERIVATE
           
static String ENTRY_TYPE_PARENT
           
static String ENTRY_TYPE_REFERENCE
           
(package private) static Logger logger
           
protected static MCRLinkTableManager singleton
          The link table manager singleton
 
Constructor Summary
protected MCRLinkTableManager()
          The constructor of this class.
 
Method Summary
 void addReferenceLink(MCRObjectID from, MCRObjectID to, String type, String attr)
          The method add a reference link pair.
 void addReferenceLink(String from, String to, String type, String attr)
          The method add a reference link pair.
 Map<String,Number> countReferenceCategory(String classid)
          The method count the number of references to a category of a classification without sub ID's and returns it as a Map
 int countReferenceCategory(String classid, String categid)
          The method count the number of references to a category of a classification.
 int countReferenceLinkTo(MCRObjectID to)
          The method count the reference links for a given target MCRobjectID.
 int countReferenceLinkTo(String to)
          The method count the reference links for a given target object ID.
 int countReferenceLinkTo(String to, String[] types, String restriction)
          counts the reference links for a given to object ID.
 void deleteReferenceLink(MCRObjectID from)
          The method delete a reference link.
 void deleteReferenceLink(String from)
          The method delete a reference link.
 void deleteReferenceLink(String from, String to, String type)
          The method delete a reference link pair for the given type to the store.
 Collection<String> getDestinationOf(MCRObjectID from, String type)
          Returns a List of all link destinations of from and a special type
 Collection<String> getDestinationOf(String from, String type)
          Returns a List of all link destination of from and a special type
 Collection<String> getSourceOf(MCRObjectID to)
          Returns a List of all link sources of to
 Collection<String> getSourceOf(MCRObjectID to, String type)
          Returns a List of all link sources of to and a special type
 Collection<String> getSourceOf(String to)
          Returns a List of all link sources of to
 Collection<String> getSourceOf(String[] to, String type)
          The method return a list of all source ID's of the refernce target to with the given type.
 Collection<String> getSourceOf(String to, String type)
          Returns a List of all link sources of to and a special type
static MCRLinkTableManager instance()
          Returns the link table manager singleton.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ENTRY_TYPE_CHILD

public static final String ENTRY_TYPE_CHILD
The list of entry types

See Also:
Constant Field Values

ENTRY_TYPE_DERIVATE

public static final String ENTRY_TYPE_DERIVATE
See Also:
Constant Field Values

ENTRY_TYPE_PARENT

public static final String ENTRY_TYPE_PARENT
See Also:
Constant Field Values

ENTRY_TYPE_REFERENCE

public static final String ENTRY_TYPE_REFERENCE
See Also:
Constant Field Values

singleton

protected static MCRLinkTableManager singleton
The link table manager singleton


logger

static Logger logger
Constructor Detail

MCRLinkTableManager

protected MCRLinkTableManager()
The constructor of this class.

Method Detail

instance

public static MCRLinkTableManager instance()
Returns the link table manager singleton.

Returns:
Returns a MCRLinkTableManager instance.

addReferenceLink

public void addReferenceLink(MCRObjectID from,
                             MCRObjectID to,
                             String type,
                             String attr)
The method add a reference link pair.

Parameters:
from - the source of the reference as MCRObjectID
to - the target of the reference as MCRObjectID
type - the type of the reference as String
attr - the optional attribute of the reference as String

addReferenceLink

public void addReferenceLink(String from,
                             String to,
                             String type,
                             String attr)
The method add a reference link pair.

Parameters:
from - the source of the reference as String
to - the target of the reference as String
type - the type of the reference as String
attr - the optional attribute of the reference as String

deleteReferenceLink

public void deleteReferenceLink(MCRObjectID from)
The method delete a reference link.

Parameters:
from - the source of the reference as MCRObjectID

deleteReferenceLink

public void deleteReferenceLink(String from)
The method delete a reference link.

Parameters:
from - the source of the reference as String

deleteReferenceLink

public void deleteReferenceLink(String from,
                                String to,
                                String type)
The method delete a reference link pair for the given type to the store.

Parameters:
from - the source of the reference as String
to - the target of the reference as String
type - the type of the reference as String

countReferenceLinkTo

public int countReferenceLinkTo(MCRObjectID to)
The method count the reference links for a given target MCRobjectID.

Parameters:
to - the object ID as MCRObjectID, they was referenced
Returns:
the number of references

countReferenceLinkTo

public int countReferenceLinkTo(String to)
The method count the reference links for a given target object ID.

Parameters:
to - the object ID as String, they was referenced
Returns:
the number of references

countReferenceLinkTo

public int countReferenceLinkTo(String to,
                                String[] types,
                                String restriction)
counts the reference links for a given to object ID.

Parameters:
types - Array of document type slected by the mcrfrom content
restriction - a first part of the to ID as String, it can be null
Returns:
the number of references

countReferenceCategory

public Map<String,Number> countReferenceCategory(String classid)
The method count the number of references to a category of a classification without sub ID's and returns it as a Map

Parameters:
classid - the classification ID as MCRObjectID
Returns:
a Map with key=categID and value=counted number of references

countReferenceCategory

public int countReferenceCategory(String classid,
                                  String categid)
The method count the number of references to a category of a classification.

Parameters:
classid - the classification ID as String
categid - the category ID as String
Returns:
the number of references

getSourceOf

public Collection<String> getSourceOf(MCRObjectID to)
Returns a List of all link sources of to

Parameters:
to - The MCRObjectID to referenced.
Returns:
List of Strings (Source-IDs)

getSourceOf

public Collection<String> getSourceOf(String to)
Returns a List of all link sources of to

Parameters:
to - The ID to referenced.
Returns:
List of Strings (Source-IDs)

getSourceOf

public Collection<String> getSourceOf(MCRObjectID to,
                                      String type)
Returns a List of all link sources of to and a special type

Parameters:
to - Destination-ID
type - link reference type
Returns:
List of Strings (Source-IDs)

getSourceOf

public Collection<String> getSourceOf(String to,
                                      String type)
Returns a List of all link sources of to and a special type

Parameters:
to - Destination-ID
type - link reference type
Returns:
List of Strings (Source-IDs)

getSourceOf

public Collection<String> getSourceOf(String[] to,
                                      String type)
The method return a list of all source ID's of the refernce target to with the given type.

Parameters:
to - the refernce target to
type - type of the refernce
Returns:
a list of ID's

getDestinationOf

public Collection<String> getDestinationOf(MCRObjectID from,
                                           String type)
Returns a List of all link destinations of from and a special type

Parameters:
from - Destination-ID
type - link reference type
Returns:
List of Strings (Source-IDs)

getDestinationOf

public Collection<String> getDestinationOf(String from,
                                           String type)
Returns a List of all link destination of from and a special type

Parameters:
from - Source-ID
type - Link reference type, this can be null. Current types are classid, child, parent, reference and derivate.
Returns:
List of Strings (Destination-IDs)