org.mycore.backend.hibernate
Class MCRHIBLinkTableStore

java.lang.Object
  extended by org.mycore.backend.hibernate.MCRHIBLinkTableStore
All Implemented Interfaces:
MCRLinkTableInterface

public class MCRHIBLinkTableStore
extends Object
implements MCRLinkTableInterface

This class implements the MCRLinkTableInterface.

Author:
Heiko Helmbrecht, Jens Kupferschmidt

Field Summary
(package private) static Logger LOGGER
           
 
Constructor Summary
MCRHIBLinkTableStore()
          The constructor for the class MCRHIBLinkTableStore.
 
Method Summary
 int countTo(String fromtype, String to, String type, String restriction)
          The method count the number of references with '%from%' and 'to' and optional 'type' and optional 'restriction%' values of the table.
 void create(String from, String to, String type, String attr)
          The method create a new item in the datastore.
 void delete(String from, String to, String type)
          The method removes a item for the from ID from the datastore.
 Map<String,Number> getCountedMapOfMCRTO(String mcrtoPrefix)
          The method returns a Map of all counted distinct references
 Collection<String> getDestinationsOf(String source, String type)
          Returns a List of all link destinations of destination
 Collection<String> getSourcesOf(String to, String type)
          Returns a List of all link sources of to and a special type
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

static Logger LOGGER
Constructor Detail

MCRHIBLinkTableStore

public MCRHIBLinkTableStore()
The constructor for the class MCRHIBLinkTableStore.

Method Detail

create

public final void create(String from,
                         String to,
                         String type,
                         String attr)
The method create a new item in the datastore.

Specified by:
create in interface MCRLinkTableInterface
Parameters:
from - a string with the link ID MCRFROM
to - a string with the link ID MCRTO
type - a string with the link ID MCRTYPE
attr - a string with the link ID MCRATTR

delete

public final void delete(String from,
                         String to,
                         String type)
The method removes a item for the from ID from the datastore.

Specified by:
delete in interface MCRLinkTableInterface
Parameters:
from - a string with the link ID MCRFROM
to - a string with the link ID MCRTO
type - a string with the link ID MCRTYPE

countTo

public final int countTo(String fromtype,
                         String to,
                         String type,
                         String restriction)
The method count the number of references with '%from%' and 'to' and optional 'type' and optional 'restriction%' values of the table.

Specified by:
countTo in interface MCRLinkTableInterface
Parameters:
fromtype - a substing in the from ID as String, it can be null
to - the object ID as String, which is referenced
type - the refernce type, it can be null
restriction - a first part of the to ID as String, it can be null
Returns:
the number of references

getCountedMapOfMCRTO

public Map<String,Number> getCountedMapOfMCRTO(String mcrtoPrefix)
The method returns a Map of all counted distinct references

Specified by:
getCountedMapOfMCRTO in interface MCRLinkTableInterface
Parameters:
mcrtoPrefix -
Returns:
the result-map of (key,value)-pairs can be visualized as
select count(mcrfrom) as value, mcrto as key from mcrlinkclass|mcrlinkhref where mcrto like mcrtoPrefix + '%' group by mcrto;

getSourcesOf

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

Specified by:
getSourcesOf in interface MCRLinkTableInterface
Parameters:
to - Destination-ID
type - Link reference type, this can be null. Current types are child, classid, parent, reference and derivate.
Returns:
List of Strings (Source-IDs)

getDestinationsOf

public Collection<String> getDestinationsOf(String source,
                                            String type)
Returns a List of all link destinations of destination

Specified by:
getDestinationsOf in interface MCRLinkTableInterface
Parameters:
source - source-ID
type - Link reference type, this can be null. Current types are child, classid, parent, reference and derivate.
Returns:
List of Strings (Destination-IDs)