Package org.mycore.datamodel.common
Class MCRLinkTableManager
java.lang.Object
org.mycore.datamodel.common.MCRLinkTableManager
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 Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addReferenceLink
(String from, String to, String type, String attr) The method add a reference link pair.void
addReferenceLink
(MCRObjectID from, MCRObjectID to, String type, String attr) The method add a reference link pair.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 Mapint
countReferenceCategory
(String classid, String categid) The method count the number of references to a category of a classification.int
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.int
The method count the reference links for a given target MCRobjectID.void
create
(MCRDerivate der) void
Creates all references for the given object.void
delete
(MCRObjectID id) Removes all references of this object.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.void
The method delete a reference link.getDestinationOf
(String from, String type) Returns a List of all link destination offrom
and a specialtype
getDestinationOf
(MCRObjectID from, String type) Returns a List of all link destinations offrom
and a specialtype
getSourceOf
(String to) Returns a List of all link sources ofto
getSourceOf
(String[] to, String type) The method return a list of all source ID's of the refernce target to with the given type.getSourceOf
(String to, String type) Returns a List of all link sources ofto
and a specialtype
Returns a List of all link sources ofto
getSourceOf
(MCRObjectID to, String type) Returns a List of all link sources ofto
and a specialtype
static MCRLinkTableManager
instance()
Returns the link table manager singleton.void
update
(MCRObjectID id) Updates all references of this object.
-
Field Details
-
ENTRY_TYPE_CHILD
The list of entry types- See Also:
-
ENTRY_TYPE_DERIVATE
- See Also:
-
ENTRY_TYPE_DERIVATE_LINK
- See Also:
-
ENTRY_TYPE_PARENT
- See Also:
-
ENTRY_TYPE_REFERENCE
- See Also:
-
singleton
The link table manager singleton
-
-
Constructor Details
-
MCRLinkTableManager
protected MCRLinkTableManager()The constructor of this class.
-
-
Method Details
-
instance
Returns the link table manager singleton.- Returns:
- Returns a MCRLinkTableManager instance.
-
addReferenceLink
The method add a reference link pair.- Parameters:
from
- the source of the reference as MCRObjectIDto
- the target of the reference as MCRObjectIDtype
- the type of the reference as Stringattr
- the optional attribute of the reference as String
-
addReferenceLink
The method add a reference link pair.- Parameters:
from
- the source of the reference as Stringto
- the target of the reference as Stringtype
- the type of the reference as Stringattr
- the optional attribute of the reference as String
-
deleteReferenceLink
The method delete a reference link.- Parameters:
from
- the source of the reference as MCRObjectID
-
deleteReferenceLink
The method delete a reference link.- Parameters:
from
- the source of the reference as String
-
deleteReferenceLink
The method delete a reference link pair for the given type to the store.- Parameters:
from
- the source of the reference as Stringto
- the target of the reference as Stringtype
- the type of the reference as String
-
countReferenceLinkTo
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
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
counts the reference links for a given to object ID.- Parameters:
types
- Array of document type slected by the mcrfrom contentrestriction
- a first part of the to ID as String, it can be null- Returns:
- the number of references
-
countReferenceCategory
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
The method count the number of references to a category of a classification.- Parameters:
classid
- the classification ID as Stringcategid
- the category ID as String- Returns:
- the number of references
-
getSourceOf
Returns a List of all link sources ofto
- Parameters:
to
- The MCRObjectID to referenced.- Returns:
- List of Strings (Source-IDs)
-
getSourceOf
Returns a List of all link sources ofto
- Parameters:
to
- The ID to referenced.- Returns:
- List of Strings (Source-IDs)
-
getSourceOf
Returns a List of all link sources ofto
and a specialtype
- Parameters:
to
- Destination-IDtype
- link reference type- Returns:
- List of Strings (Source-IDs)
-
getSourceOf
Returns a List of all link sources ofto
and a specialtype
- Parameters:
to
- Destination-IDtype
- link reference type- Returns:
- List of Strings (Source-IDs)
-
getSourceOf
The method return a list of all source ID's of the refernce target to with the given type.- Parameters:
to
- the refernce target totype
- type of the refernce- Returns:
- a list of ID's
-
getDestinationOf
Returns a List of all link destinations offrom
and a specialtype
- Parameters:
from
- Destination-IDtype
- link reference type- Returns:
- List of Strings (Source-IDs)
-
getDestinationOf
Returns a List of all link destination offrom
and a specialtype
- Parameters:
from
- Source-IDtype
- Link reference type, this can be null. Current types are classid, child, parent, reference and derivate.- Returns:
- List of Strings (Destination-IDs)
-
create
Creates all references for the given object. You should calldelete(MCRObjectID)
before using this method otherwise doublets could occur.- Parameters:
obj
- the object to create the references
-
delete
Removes all references of this object.- Parameters:
id
- the object where all references should be removed
-
update
Updates all references of this object. Old ones will be removed and new links will be created.- Parameters:
id
- the mycore object identifer
-
create
-