public class InsRel extends MMObjectBuilder
This class can be extended to create insrels that can also hold extra values and custom methods (named relations for example).
| Modifier and Type | Field and Description |
|---|---|
static String |
FIELD_DESTINATION
Name of the field containing the destination object number
|
static String |
FIELD_DIR
Name of the field containing the directionality
|
static String |
FIELD_DIRECTIONALITY
Name of the field containing the directionality
|
static String |
FIELD_DNUMBER
Name of the field containing the destination object number
|
static String |
FIELD_RNUMBER
Name of the field containing the role (reldef) object number
|
static String |
FIELD_ROLE
Name of the field containing the role (reldef) object number
|
static String |
FIELD_SNUMBER
Name of the field containing the source object number
|
static String |
FIELD_SOURCE
Name of the field containing the source object number
|
static String |
INSREL_BUILDER
Base 'insrel' builder name
|
int |
relnumber
Hold the relnumber to use when creating a node of this builder.
|
static boolean |
usesdir
Indicates whether the relations use the 'dir' field (that is, whether the
field has been defined in the xml file).
|
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, temporaryNodes, TMP_FIELD_EXISTS, TMP_FIELD_NUMBER, virtual, WRAP_PARAMETERS, wrapFunctionmaxNodesFromQuery, mmb, storageConnector, tableNamefunctions| Constructor and Description |
|---|
InsRel()
needed for autoload
|
| Modifier and Type | Method and Description |
|---|---|
void |
deleteRelationCache()
Deletes the Relation cache.
|
void |
deleteRelationCache(int source)
Delete a specified relation from the relationCache
|
Vector<MMObjectNode> |
getAllRelationsVector(int source)
Deprecated.
|
Vector<MMObjectNode> |
getAllRelationsVector(int source,
int role)
Deprecated.
|
int |
getGuessedNumber(String name)
Search the relation definition table for the identifying number of
a relation, by name.
|
String |
getGUIIndicator(MMObjectNode node)
What should a GUI display for this node.
|
String |
getGUIIndicator(String field,
MMObjectNode node)
Get the display string for a given field of this node.
|
Enumeration<MMObjectNode> |
getRelated(int source,
int otype)
Get MMObjectNodes of a specified type related to a specified MMObjectNode
|
Enumeration<MMObjectNode> |
getRelated(int source,
int otype,
int role)
Get MMObjectNodes of a specified type related to a specified MMObjectNode
|
Enumeration<MMObjectNode> |
getRelated(int source,
String nodeType)
get MMObjectNodes related to a specified MMObjectNode
|
Enumeration<MMObjectNode> |
getRelated(int source,
String nodeType,
String roleName)
get MMObjectNodes related to a specified MMObjectNode
|
Enumeration<MMObjectNode> |
getRelated(String sourceNode,
String nodeType)
get MMObjectNodes related to a specified MMObjectNode
|
Enumeration<MMObjectNode> |
getRelated(String sourceNode,
String nodeType,
String roleName)
get MMObjectNodes related to a specified MMObjectNode
|
Vector<MMObjectNode> |
getRelatedVector(int source,
int otype)
Deprecated.
|
Vector<MMObjectNode> |
getRelatedVector(int source,
int otype,
int role)
Deprecated.
|
MMObjectNode |
getRelation(int source,
int destination,
int role)
Test whether a relation exists and returns the corresponding node.
|
MMObjectNode |
getRelationNode(int source,
int destination,
int role)
Test whether a relation exists and returns the corresponding node.
|
List<MMObjectNode> |
getRelationNodes(int source)
Get relation(s) for an MMObjectNode, using a specified role (reldef) as a filter.
|
List<MMObjectNode> |
getRelationNodes(int source,
boolean useDirectionality)
Get all relation(s) for an MMObjectNode.
|
List<MMObjectNode> |
getRelationNodes(int source,
int role)
Get relation(s) for an MMObjectNode, using a specified role (reldef) as a filter.
|
List<MMObjectNode> |
getRelationNodes(int source,
int role,
boolean useDirectionality)
Get all relation(s) for a MMObjectNode
This function returns all relations in which the node is either a source or
the destination.
|
Enumeration<MMObjectNode> |
getRelations(int source)
Get relation(s) for a MMObjectNode
|
Enumeration<MMObjectNode> |
getRelations(int source,
int role)
Get relation(s) for a MMObjectNode, using a specified role (reldef) as a filter
|
Enumeration<MMObjectNode> |
getRelations(int source,
int otype,
int role)
Get relations for a specified MMObjectNode
|
Enumeration<MMObjectNode> |
getRelations(int source,
int otype,
int role,
boolean usedirectionality)
Gets relations for a specified MMObjectNode
|
Vector<MMObjectNode> |
getRelationsVector(int source)
Deprecated.
|
Vector<MMObjectNode> |
getRelationsVector(int source,
int role)
Deprecated.
|
boolean |
hasRelations(int source)
Checks whether any relations exist for a MMObjectNode.
|
boolean |
init()
Initializes the builder.
|
int |
insert(String owner,
int source,
int destination,
int role)
Deprecated.
Use insert(String, MMObjectNode) instead.
|
int |
insert(String owner,
MMObjectNode node)
Insert a new Instance Relation.
|
boolean |
reldefCorrect(int source,
int destination,
int role)
Deprecated.
Use
TypeRel.reldefCorrect(int, int, int) instead |
void |
removeNode(MMObjectNode node)
Remove a node from the cloud.
|
void |
setDefaults(MMObjectNode node)
Set defaults for a node.
|
void |
setTableName(String tableName)
Set tablename of the builder.
|
addEventListener, addField, addLocalObserver, addRemoteObserver, broadcastChanges, checkAddTmpField, clearBlobCache, commit, create, createAlias, createAlias, createIfNotExists, delete, equals, equals, executeFunction, executeFunction, fieldLocalChanged, getAncestors, getBlobCache, getClassName, getConfigFile, getConfigResource, getDataTypeCollector, getDBState, getDBType, getDefaultTeaser, getDefaultUrl, getDescendants, getDescription, getDescription, getDescriptions, getEmptyNode, getField, getFieldNames, getFields, getFields, getFunction, getFunctionParameters, getFunctions, getGUIIndicator, getHTML, getInitParameter, getInitParameters, getInitParameters, getInternalVersion, getList, getLocaleGUIIndicator, getLocaleGUIIndicator, getMachineName, getMaintainer, getNewNode, getNewTmpNode, getNextField, getNextField, getNode, getNode, getNode, getNodeFromCache, getNodeGUIIndicator, getNumber, getObjectType, getObjectValue, getParentBuilder, getPluralName, getPluralName, getPluralNames, getRelations_main, getSearchAge, getShort, getShortedByte, getShortedInputStream, getShortedText, getSingularName, getSingularName, getSingularNames, getSmartPath, getTmpNode, getURLEncode, getValue, getVersion, getWAP, getXMLPath, hasField, hashCode, hashCode, hostname_function, insert, isExtensionOf, isNodeCached, isNull, isVirtual, loadInitParameters, newFunctionInstance, nodeLocalChanged, nodeRemoteChanged, notify, notify, preCommit, process, removeEventListener, removeField, removeLocalObserver, removeRelations, removeRemoteObserver, removeSyncNodes, replace, safeCache, sendFieldChangeSignal, setDescription, setDescriptions, setFields, setInitParameter, setMaintainer, setPluralNames, setSearchAge, setSingularNames, setUniqueValue, setUniqueValue, setValue, setValue, setVersion, setXMLPath, shutdown, testValidData, toString, toString, update, updateFields, wrapcount, count, created, getFullTableName, getMMBase, getNode, getNodes, getNodes, getNodes, getNodeType, getStorageConnector, getTableName, search, searchVector, setMMBase, sizeaddFunction, createParameters, getFunction, getFunctions, getFunctionValuepublic static final String INSREL_BUILDER
public static final String FIELD_SNUMBER
public static final String FIELD_SOURCE
public static final String FIELD_DNUMBER
public static final String FIELD_DESTINATION
public static final String FIELD_RNUMBER
public static final String FIELD_ROLE
public static final String FIELD_DIR
public static final String FIELD_DIRECTIONALITY
public static boolean usesdir
true - the value is set to false if any of the
relation builders does not contain a dir field (a warning is issued).public int relnumber
public void setTableName(String tableName)
MMTablesetTableName in class MMTabletableName - the name of the tablepublic boolean init()
dir field is defined (and thus whether directionality is supported).
If the field cannot be found, a "Warning: No dir field. Directionality support turned off." warning message is issued.init in class MMObjectBuilderboolean value, always success (true), as any exceptions are
caught and logged.usesdirpublic int insert(String owner, int source, int destination, int role)
owner - Administratorsource - Identifying number of the source objectdestination - Identifying number of the destination objectrole - Identifying number of the relation defintitioninteger value identifying the newly inserted relationpublic int insert(String owner, MMObjectNode node)
insert in class MMObjectBuilderowner - Administratornode - Relation node to addinteger value identifying the newly inserted relationpublic void removeNode(MMObjectNode node)
removeNode in class MMObjectBuildernode - The node to remove.public Enumeration<MMObjectNode> getRelations(int source)
source - Identifying number of the object to find the relations of.Enumeration listing the relations.
If no relations exist, the method returns null.getRelationsVector(int)public Enumeration<MMObjectNode> getRelations(int source, int role)
source - Identifying number of the object to find the relations of.role - The number of the relation definition (role) to filter onEnumeration listing the relations.getRelationsVector(int, int)public Enumeration<MMObjectNode> getRelations(int source, int otype, int role)
source - this is the number of the MMObjectNode requesting the relationsotype - the object type of the nodes you want to have. -1 means any node.role - Identifying number of the role (reldef)Enumeration whose enumeration consists of MMObjectNode object related to the source
according to the specified filter(s).public Enumeration<MMObjectNode> getRelations(int source, int otype, int role, boolean usedirectionality)
source - this is the number of the MMObjectNode requesting the relationsotype - the object type of the nodes you want to have. -1 means any node.role - Identifying number of the role (reldef)usedirectionality - if true teh result si filtered on unidirectional relations.
specify false if you want to show unidoerctional relations
from destination to source.Enumeration whose enumeration consists of MMObjectNode object related to the source
according to the specified filter(s).public boolean hasRelations(int source)
source - Identifying number of the object to find the relations of.true if any relations exist, false otherwise.public List<MMObjectNode> getRelationNodes(int source) throws SearchQueryException
source - Identifying number of the object to find the relations of.List containing the relation nodes.SearchQueryException - if a storage error occurspublic Vector<MMObjectNode> getRelationsVector(int source)
getRelationNodes(int)public List<MMObjectNode> getRelationNodes(int source, int role) throws SearchQueryException
source - Identifying number of the object to find the relations of.role - The number of the relation definition (role) to filter on, -1 means any roleList containing the relation nodes.SearchQueryException - if a storage error occurspublic Vector<MMObjectNode> getRelationsVector(int source, int role)
getRelationNodes(int, int, boolean)public List<MMObjectNode> getRelationNodes(int source, boolean useDirectionality) throws SearchQueryException
source - Identifying number of the object to find the relations of.useDirectionality - if truie, take directionality into account.
If false, returns all relations, even if the direction is unidirectional.List containing the relation nodes.SearchQueryException - if a storage error occurspublic Vector<MMObjectNode> getAllRelationsVector(int source)
getRelationNodes(int, boolean)public List<MMObjectNode> getRelationNodes(int source, int role, boolean useDirectionality) throws SearchQueryException
source - Identifying number of the object to find the relations of.role - The number of the relation definition (role) to filter on, -1 means any roleuseDirectionality - if truie, take directionality into account.
If false, returns all relations, even if the direction is unidirectional.List containing the relation nodes.SearchQueryException - if a storage error occurspublic Vector<MMObjectNode> getAllRelationsVector(int source, int role)
getRelationNodes(int, int, boolean)public MMObjectNode getRelationNode(int source, int destination, int role) throws SearchQueryException
null.source - Identifying number of the source objectdestination - Identifying number of the destination objectrole - Identifying number of the role (reldef)MMObjectNode if the exact relation exists,null otherwiseSearchQueryException - if a storage error occurspublic MMObjectNode getRelation(int source, int destination, int role)
null.source - Identifying number of the source objectdestination - Identifying number of the destination objectrole - Identifying number of the role (reldef)MMObjectNode if the exact relation exists,null otherwisepublic Enumeration<MMObjectNode> getRelated(String sourceNode, String nodeType)
sourceNode - this is the source MMObjectNodenodeType - Specifies the type of the nodes you want to have e.g. "pools"public Enumeration<MMObjectNode> getRelated(int source, String nodeType)
source - this is the number of the source MMObjectNodenodeType - Specifies the type of the nodes you want to have e.g. "pools"public Enumeration<MMObjectNode> getRelated(int source, int otype)
source - this is the number of the source MMObjectNodeotype - the object type of the nodes you want to haveEnumeration of MMObjectNode object related to the sourcepublic Enumeration<MMObjectNode> getRelated(String sourceNode, String nodeType, String roleName)
sourceNode - this is the number of the source MMObjectNode (in string format)nodeType - Specifies the type of the nodes you want to have e.g. "pools"roleName - the role of teh relation (name in reldef)public Enumeration<MMObjectNode> getRelated(int source, String nodeType, String roleName)
source - this is the number of the source MMObjectNodenodeType - Specifies the type of the nodes you want to have e.g. "pools"roleName - the name of the role of the relation (name in reldef)public Enumeration<MMObjectNode> getRelated(int source, int otype, int role)
source - this is the number of the source MMObjectNodeotype - the object type of the nodes you want to haverole - Identifying number of the role (reldef)Enumeration of MMObjectNode object related to the sourcepublic Vector<MMObjectNode> getRelatedVector(int source, int otype)
source - this is the number of the MMObjectNode requesting the relationsotype - the object type of the nodes you want to have. -1 means any node.Vector whose enumeration consists of MMObjectNode object related to the source
according to the specified filter(s).public Vector<MMObjectNode> getRelatedVector(int source, int otype, int role)
source - this is the number of the MMObjectNode requesting the relationsotype - the object type of the nodes you want to have. -1 means any node.role - Identifying number of the role (reldef)Vector whose enumeration consists of MMObjectNode object related to the source
according to the specified filter(s).public String getGUIIndicator(MMObjectNode node)
MMObjectBuilderMMObjectBuilder.getNodeGUIIndicator(org.mmbase.module.core.MMObjectNode, org.mmbase.util.functions.Parameters) for more flexibility.getGUIIndicator in class MMObjectBuildernode - The node to displayStringpublic String getGUIIndicator(String field, MMObjectNode node)
getGUIIndicator in class MMObjectBuilderfield - name of the field to describe.node - Node containing the field data.String describing the requested field's contentpublic boolean reldefCorrect(int source,
int destination,
int role)
TypeRel.reldefCorrect(int, int, int) insteadsource - Number of the source nodedestination - Number of the destination noderole - Number of the relation definitionboolean indicating success when the relation exists, failure if it does not.public void deleteRelationCache()
public void deleteRelationCache(int source)
source - the number of the relation to remove from the cachepublic int getGuessedNumber(String name)
name - The name on which to search for the relationint value indicating the relation's object number, or -1 if not found.public void setDefaults(MMObjectNode node)
setDefaults in class MMObjectBuildernode - The node whose defaults to set.MMBase 1.9-SNAPSHOT - ${javadoctimestamp}