Class MCRLinkTableManager

java.lang.Object
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$ $Date$
Author:
Jens Kupferschmidt
  • Field Details

  • Constructor Details

    • MCRLinkTableManager

      protected MCRLinkTableManager()
      The constructor of this class.
  • Method Details

    • 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)
    • create

      public void create(MCRObject obj)
      Creates all references for the given object. You should call delete(MCRObjectID) before using this method otherwise doublets could occur.
      Parameters:
      obj - the object to create the references
    • delete

      public void delete(MCRObjectID id)
      Removes all references of this object.
      Parameters:
      id - the object where all references should be removed
    • update

      public void update(MCRObjectID id)
      Updates all references of this object. Old ones will be removed and new links will be created.
      Parameters:
      id - the mycore object identifer
    • create

      public void create(MCRDerivate der)