org.mycore.datamodel.common
Interface MCRLinkTableInterface

All Known Implementing Classes:
MCRHIBLinkTableStore

public interface MCRLinkTableInterface

This interface is designed to choose the persistence for the link tables.

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

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 remove 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 from, String type)
          Returns a List of all link destination of from and a special type
 Collection<String> getSourcesOf(String to, String type)
          Returns a List of all link sources of to and a special type
 

Method Detail

create

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

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

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

Parameters:
from - a string with the link ID MCRFROM
to - an array of strings with the link ID MCRTO
type - an array of strings with the link ID MCRTYPE

countTo

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.

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

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

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

Collection<String> getSourcesOf(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, this can be null. Current types are classid, child, parent, reference and derivate.
Returns:
List of Strings (Source-IDs)

getDestinationsOf

Collection<String> getDestinationsOf(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)