|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mmbase.module.core.MMTable
org.mmbase.module.core.MMObjectBuilder
org.mmbase.module.corebuilders.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. |
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 |
static int |
STRICT
Constant for contains(int, int, int): return only typerels that
exactly match. |
| Fields inherited from class org.mmbase.module.core.MMObjectBuilder |
AGE_PARAMETERS, broadcastChanges, database, DEFAULT_ALINEA, DEFAULT_EOL, description, descriptions, fields, GUI_PARAMETERS, listCache, nodeCache, OBJ2TYPE_MAX_SIZE, oType, REPLACE_CACHE, searchAge, sortedDBLayout, TEMPNODE_DEFAULT_SIZE, TemporaryNodes, virtual |
| Fields inherited from class org.mmbase.module.core.MMTable |
mmb, tableName |
| 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. |
java.util.Enumeration |
getAllowedRelations(int otype)
|
java.util.Enumeration |
getAllowedRelations(int builder1,
int builder2)
An enumeration of all allowed relations between two builders. |
java.util.Set |
getAllowedRelations(int builder1,
int builder2,
int role)
A Set of all allowed relations of a certain role between two builders. |
java.util.Enumeration |
getAllowedRelations(MMObjectNode mmnode)
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). |
java.util.Enumeration |
getAllowedRelations(MMObjectNode n1,
MMObjectNode n2)
Retrieves all relations which are 'allowed' between two specified nodes. |
protected java.util.Vector |
getAllowedRelationsNames(int number1,
int number2)
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. |
java.lang.String |
getGUIIndicator(MMObjectNode node)
Returns the display string for this node It returns a commbination of objecttypes and rolename : "source->destination (role)". |
java.lang.String |
getGUIIndicator(java.lang.String field,
MMObjectNode node)
Returns the display string for a specified field. |
java.util.Vector |
getList(scanpage sp,
StringTagger tagger,
java.util.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(java.lang.String owner,
MMObjectNode node)
Insert a new object (content provided) in the cloud, including an entry for the object alias (if provided). |
boolean |
nodeChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
Watch for changes on relation types and adjust our memory table accordingly |
boolean |
nodeLocalChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
Called when a local node is changed. |
boolean |
nodeRemoteChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
Called when a remote node is changed. |
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. |
java.lang.String |
toString(MMObjectNode n)
Implements for MMObjectNode |
| Methods inherited from class org.mmbase.module.core.MMTable |
created, getFullTableName, getTableName, size |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, 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
| Constructor Detail |
public TypeRel()
| Method Detail |
public boolean init()
MMObjectBuilder
init in class MMObjectBuilderMMObjectBuilder.create()public void readCache()
protected TypeRel.TypeRelSet addCacheEntry(MMObjectNode typerel,
boolean buildersInitialized)
public int insert(java.lang.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 java.util.Enumeration getAllowedRelations(MMObjectNode mmnode)
mmnode - The node to retrieve the allowed relations of.
Enumeration of nodes containing the typerel relation datapublic java.util.Enumeration getAllowedRelations(int otype)
public java.util.Enumeration getAllowedRelations(MMObjectNode n1,
MMObjectNode n2)
n1 - The first objectnoden2 - The second objectnode
Enumeration of nodes containing the typerel relation data
public java.util.Enumeration getAllowedRelations(int builder1,
int builder2)
public java.util.Set getAllowedRelations(int builder1,
int builder2,
int role)
protected java.util.Vector getAllowedRelationsNames(int number1,
int number2)
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 java.lang.String getGUIIndicator(MMObjectNode node)
getGUIIndicator in class MMObjectBuildernode - Node from which to retrieve the data
String describing the content of the node
public java.lang.String getGUIIndicator(java.lang.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 java.util.Vector getList(scanpage sp,
StringTagger tagger,
java.util.StringTokenizer tok)
getList in class MMObjectBuildersp - The scanpage (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 boolean nodeRemoteChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
MMBaseObserver
nodeRemoteChanged in interface MMBaseObservernodeRemoteChanged in class MMObjectBuildermachine - Name of the machine that changed the node.number - Number of the changed node as a Stringbuilder - type of the changed nodectype - command type, 'c'=changed, 'd'=deleted', 'r'=relations changed, 'n'=new
true
public boolean nodeLocalChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
MMBaseObserver
nodeLocalChanged in interface MMBaseObservernodeLocalChanged in class MMObjectBuildermachine - Name of the machine that changed the node.number - Number of the changed node as a Stringbuilder - type of the changed nodectype - command type, 'c'=changed, 'd'=deleted', 'r'=relations changed, 'n'=new
true
public boolean nodeChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
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 java.lang.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 | ||||||||