|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mmbase.util.functions.FunctionProvider
org.mmbase.module.core.MMTable
org.mmbase.module.core.MMObjectBuilder
org.mmbase.module.corebuilders.TypeRel
public class TypeRel
TypeRel defines the allowed relations between two object types. Every relations also specifies a 'role', which is a reference to the RelDef table. Relations do principally have a 'source' and a 'destination' object type, but most functions of this class do ignore this distinction. TypeRel is a 'core' MMBase builder. You can get a reference to it via the MMBase instance.
RelDef,
InsRel,
MMBase| Nested Class Summary | |
|---|---|
protected class |
TypeRel.InverseTypeRelSet
An InverseTypeRelSet is a Set of typerel nodes. |
protected class |
TypeRel.TypeRelSet
A TypeRelSet is a Set of typerel nodes. |
(package private) static class |
TypeRel.VirtualTypeRel
Of course, virtual typerel nodes need a virtual typerel builder. |
protected class |
TypeRel.VirtualTypeRelNode
A VirtualTypeRelNode is a MMObjectNode which is added to the typerelset with extensions of the actual builders specified. |
| Field Summary | |
|---|---|
static int |
INCLUDE_DESCENDANTS
Constant for contains(int, int, int): return typerels where source/destination match with a
builder or its descendants |
static int |
INCLUDE_PARENTS
Constant for contains(int, int, int): return typerels where source/destination match with a
builder or its parents |
static int |
INCLUDE_PARENTS_AND_DESCENDANTS
Constant for contains(int, int, int): return typerels where source/destination match with a
builder, its descendants, or its parents |
TypeRel.InverseTypeRelSet |
inverseTypeRelNodes
|
protected TypeRel.TypeRelSet |
parentTypeRelNodes
|
static int |
STRICT
Constant for contains(int, int, int): return only typerels that exactly match. |
protected TypeRel.TypeRelSet |
typeRelNodes
TypeRel should contain only a limited amount of nodes, so we can simply cache them all, and avoid all further querying. |
| Fields inherited from class org.mmbase.module.core.MMObjectBuilder |
|---|
AGE_PARAMETERS, broadCastChanges, DEFAULT_ALINEA, DEFAULT_EOL, description, descriptions, EVENT_TYPE_LOCAL, EVENT_TYPE_REMOTE, FIELD_NUMBER, FIELD_OBJECT_TYPE, FIELD_OWNER, fields, genericBlobCache, getFunctions, GUI_INDICATOR, GUI_PARAMETERS, guiFunction, infoFunction, internalVersion, nodeCache, oType, pluralNames, searchAge, singularNames, SYSTEM_OWNER, TEMPNODE_DEFAULT_SIZE, TMP_FIELD_EXISTS, TMP_FIELD_NUMBER, virtual, WRAP_PARAMETERS, wrapFunction |
| Fields inherited from class org.mmbase.module.core.MMTable |
|---|
maxNodesFromQuery, mmb, storageConnector, tableName |
| Fields inherited from class org.mmbase.util.functions.FunctionProvider |
|---|
functions |
| Constructor Summary | |
|---|---|
TypeRel()
|
|
| Method Summary | |
|---|---|
protected TypeRel.TypeRelSet |
addCacheEntry(MMObjectNode typeRel,
boolean buildersInitialized)
Addes one typerel cache entries, plus inherited relations (if builder are initialized) |
boolean |
contains(int n1,
int n2,
int r)
Tests if a specific relation type is defined. |
boolean |
contains(int n1,
int n2,
int r,
int restriction)
Tests if a specific relation type is defined. |
boolean |
equals(MMObjectNode o1,
MMObjectNode o2)
Implements equals for a typerel node. |
Enumeration<MMObjectNode> |
getAllowedRelations(int otype)
|
Enumeration<MMObjectNode> |
getAllowedRelations(int builder1,
int builder2)
An enumeration of all allowed relations between two builders. |
Set<MMObjectNode> |
getAllowedRelations(int builder1,
int builder2,
int role)
A Set of all allowed relations of a certain role between two builders. |
Set<MMObjectNode> |
getAllowedRelations(int builder1,
int builder2,
int role,
int directionality)
A Set of all allowed relations of a certain role between two builders. |
Enumeration<MMObjectNode> |
getAllowedRelations(MMObjectNode node)
Retrieves all relations which are 'allowed' for a specified node, that is, where the node is either allowed to be the source, or to be the destination (but where the corresponing relation definition is bidirectional). |
Enumeration<MMObjectNode> |
getAllowedRelations(MMObjectNode node1,
MMObjectNode node2)
Retrieves all relations which are 'allowed' between two specified nodes. |
protected Vector<String> |
getAllowedRelationsNames(int snum,
int dnum)
Retrieves all relations which are 'allowed' between two specified nodes. |
int |
getAllowedRelationType(int snum,
int dnum)
Retrieves the identifying number of the relation definition that is 'allowed' between two specified node types. |
String |
getGUIIndicator(MMObjectNode node)
Returns the display string for this node It returns a commbination of objecttypes and rolename : "source->destination (role)". |
String |
getGUIIndicator(String field,
MMObjectNode node)
Returns the display string for a specified field. |
Vector<String> |
getList(PageInfo sp,
StringTagger tagger,
StringTokenizer tok)
Processes the BUILDER-typerel-ALLOWEDRELATIONSNAMES in the LIST command, and (possibly) returns a Vector containing requested data (based on the content of TYPE and NODE, which can be retrieved through tagger). |
int |
hashCode(MMObjectNode o)
Implements for MMObjectNode |
boolean |
init()
Initializes this builder The property 'mmb' needs to be set for the builder before this method can be called. |
int |
insert(String owner,
MMObjectNode node)
Insert a new object (content provided) in the cloud, including an entry for the object alias (if provided). |
void |
notify(NodeEvent event)
Watch for changes on relation types and adjust our memory table accordingly |
void |
notify(SystemEvent se)
|
boolean |
optimizeRelationStep(BasicRelationStep relationStep,
int sourceType,
int destinationType,
int roleInt,
int searchDir)
Optimize as relation step by considering restrictions of TypeRel. |
void |
readCache()
The TypeRel cache contains all TypeRels MMObjectNodes. |
boolean |
reldefCorrect(int n1,
int n2,
int r)
Deprecated. use contains(int, int, int)instead |
void |
removeNode(MMObjectNode node)
Remove a node from the cloud. |
String |
toString(MMObjectNode n)
Implements for MMObjectNode |
| Methods inherited from class org.mmbase.module.core.MMTable |
|---|
count, count, created, getFullTableName, getMMBase, getNode, getNodes, getNodes, getNodes, getNodeType, getStorageConnector, getTableName, search, searchVector, setMMBase, setTableName, size |
| Methods inherited from class org.mmbase.util.functions.FunctionProvider |
|---|
addFunction, createParameters, getFunction, getFunctions, getFunctionValue |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int STRICT
contains(int, int, int): return only typerels that exactly match.
public static final int INCLUDE_DESCENDANTS
contains(int, int, int): return typerels where source/destination match with a
builder or its descendants
public static final int INCLUDE_PARENTS
contains(int, int, int): return typerels where source/destination match with a
builder or its parents
public static final int INCLUDE_PARENTS_AND_DESCENDANTS
contains(int, int, int): return typerels where source/destination match with a
builder, its descendants, or its parents
protected TypeRel.TypeRelSet typeRelNodes
protected TypeRel.TypeRelSet parentTypeRelNodes
public TypeRel.InverseTypeRelSet inverseTypeRelNodes
| Constructor Detail |
|---|
public TypeRel()
| Method Detail |
|---|
public boolean init()
MMObjectBuilder
init in class MMObjectBuilderMMObjectBuilder.create()public void notify(SystemEvent se)
notify in interface SystemEventListenerpublic void readCache()
protected TypeRel.TypeRelSet addCacheEntry(MMObjectNode typeRel,
boolean buildersInitialized)
public int insert(String owner,
MMObjectNode node)
MMObjectBuilder.preCommit(org.mmbase.module.core.MMObjectNode). If the typerel node
specified already exists (i.e. same snumber, dnumber,a nd rnumber fielfds), the typerel
creation fails and returns -1.
insert in class MMObjectBuilderowner - The administrator creating the nodenode - The object to insert. The object need be of the same type as the current builder.
int value which is the new object's unique number, -1 if the insert
failed.public void removeNode(MMObjectNode node)
removeNode in class MMObjectBuildernode - The node to remove.public Enumeration<MMObjectNode> getAllowedRelations(MMObjectNode node)
node - The node to retrieve the allowed relations of.
Enumeration of nodes containing the typerel relation datapublic Enumeration<MMObjectNode> getAllowedRelations(int otype)
public Enumeration<MMObjectNode> getAllowedRelations(MMObjectNode node1,
MMObjectNode node2)
node1 - The first objectnodenode2 - The second objectnode
Enumeration of nodes containing the typerel relation data
public Enumeration<MMObjectNode> getAllowedRelations(int builder1,
int builder2)
public Set<MMObjectNode> getAllowedRelations(int builder1,
int builder2,
int role)
public Set<MMObjectNode> getAllowedRelations(int builder1,
int builder2,
int role,
int directionality)
protected Vector<String> getAllowedRelationsNames(int snum,
int dnum)
snum - The first objectnode type (the source)dnum - The second objectnode type (the destination)
Enumeration of nodes containing the reldef (not typerel!) sname
field
public int getAllowedRelationType(int snum,
int dnum)
snum - The first objectnode type (the source)dnum - The second objectnode type (the destination)
public String getGUIIndicator(MMObjectNode node)
getGUIIndicator in class MMObjectBuildernode - Node from which to retrieve the data
String describing the content of the node
public String getGUIIndicator(String field,
MMObjectNode node)
getGUIIndicator in class MMObjectBuilderfield - The name of the field to retrievenode - Node from which to retrieve the data
String describing the content of the field
public Vector<String> getList(PageInfo sp,
StringTagger tagger,
StringTokenizer tok)
getList in class MMObjectBuildersp - The PageInfo (containing http and user info) that calls the functiontagger - a Hashtable of parameters (name-value pairs) for the commandtok - a list of strings that describe the (sub)command to execute
Vector containing the result values as a String
public boolean reldefCorrect(int n1,
int n2,
int r)
contains(int, int, int)instead
Note that this routine returns false both when a snumber/dnumber are swapped, and when a typecombo does not exist - it is not possible to derive whether one or the other has occurred.
n1 - The source type number.n2 - The destination type number.r - The relation definition (role) number, or -1 if the role does not matter
true when the relation exists, false otherwise.
public boolean contains(int n1,
int n2,
int r)
Note that this routine returns false both when a snumber/dnumber are swapped, and when a typecombo does not exist - it is not possible to derive whether one or the other has occurred.
n1 - The source type number.n2 - The destination type number.r - The relation definition (role) number, or -1 if the role does not matter
true when the relation exists, false otherwise.
public boolean contains(int n1,
int n2,
int r,
int restriction)
Note that this routine returns false both when a snumber/dnumber are swapped, and when a typecombo does not exist - it is not possible to derive whether one or the other has occurred.
n1 - The source type number.n2 - The destination type number.r - The relation definition (role) number, or -1 if the role does not matter r can only
be -1 if virtual is truerestriction - if STRICT, contains only returns true if the typerel occurs
as-is in the database. if INCLUDE_DESCENDANTS, contains returns true if the typerel
occurs as a virtual (derived) node, where source or destination may also be descendants of
the specified type. if INCLUDE_PARENTS, contains returns true if the typerel occurs
as a virtual (derived) node, where source or destination may also be parents of the specified
type. if INCLUDE_PARENTS_AND_DESCENDANTS, contains returns true if the typerel
occurs as a virtual (derived) node, where source or destination may also be descendants or
parents of the specified type.
true when the relation exists, false otherwise.public void notify(NodeEvent event)
notify in interface NodeEventListenernotify in class MMObjectBuilderhere we handle all the backward compatibility stuff.
this method covers for both node and relation events.
public boolean optimizeRelationStep(BasicRelationStep relationStep,
int sourceType,
int destinationType,
int roleInt,
int searchDir)
public boolean equals(MMObjectNode o1,
MMObjectNode o2)
equals in class MMObjectBuilderpublic int hashCode(MMObjectNode o)
hashCode in class MMObjectBuilderpublic String toString(MMObjectNode n)
MMObjectBuilder
toString in class MMObjectBuilder
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||