public final class RelationshipUtils
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static void |
cloneAttributes(java.lang.String fromRelId,
java.lang.String toRelId)
Tries to clone the attributes from one relationship to the other.
|
static void |
delete(matrix.db.Relationship rel)
Removes this connection in database, i.e disconnects the objects.
|
static void |
delete(java.lang.String relationshipId)
Removes this connection in database, i.e disconnects the objects.
|
static boolean |
exists(java.lang.String relId) |
static matrix.db.AttributeList |
getAttributes(java.lang.String connectionId)
Returns the attribute values for a specific connection
|
static java.lang.String |
getFromRelationshipID(java.lang.String fromObjectId,
java.lang.String toObjectId,
java.lang.String relType)
Returns the ID of the from relationship between the specified business
objects using business object print
|
static java.lang.String |
getRelationshipID(java.lang.String fromObjectId,
java.lang.String toObjectId,
java.lang.String relType)
Returns the ID of the relationship between the specified business
objects.
|
static java.lang.String |
getToRelationshipID(java.lang.String toObjectId,
java.lang.String fromObjectId,
java.lang.String relType)
Returns the ID of the to relationship between the specified business
objects using business object print
|
static boolean |
hasAttribute(java.lang.String relationship,
java.lang.String attribute)
Check whether the relationship has an attribute with the specified name
or not.
|
static boolean |
hasRelationship(java.lang.String fromObjectId,
java.lang.String toObjectId,
java.lang.String relType)
Returns true or false, if the provided objects are connected with the
specified relationship type.
|
static boolean |
hasRelationship(java.lang.String fromObjectId,
java.lang.String toObjectId,
java.lang.String relType,
boolean useQueryConnection)
Returns true or false, if the provided objects are connected with the
specified relationship type.
|
static boolean |
modify(java.lang.String relid,
java.lang.String expr,
java.lang.String newValue)
Modify a connection value given by a select expression (e.g., modifying
the expression attribute[Weight] will modify the attribute
Weight on the relationship).
|
static void |
modifyAttribute(matrix.db.Relationship rel,
matrix.db.Attribute attribute)
Modifies a relationship attribute.
|
static void |
modifyAttribute(java.lang.String relid,
java.lang.String attribute,
java.lang.String value)
Modifies a relationship attribute.
|
static void |
modifyAttributes(matrix.db.Relationship rel,
matrix.db.AttributeList attrs)
Modified the attributes.
|
static void |
modifyAttributes(java.lang.String relationshipId,
matrix.db.AttributeList attrs)
Modified the attributes.
|
static java.lang.String |
modifyFrom(java.lang.String relid,
java.lang.String newFromObjectId)
Modify which object should be connected on the from side of the
relationship.
|
static java.lang.String |
modifyObject(java.lang.String relid,
boolean from,
java.lang.String newObjectId)
Modify which object should be connected on the specified side of the
relationship.
|
static java.lang.String |
modifyTo(java.lang.String relid,
java.lang.String newToObjectId)
Modify which object should be connected on the to side of the
relationship.
|
static void |
modifyType(java.lang.String relid,
java.lang.String type)
Modifies a relationship attribute.
|
static java.lang.String |
replaceObject(java.lang.String relid,
java.lang.String sourceObjectId,
java.lang.String targetObjectId)
Replaces the source object with the target object on the specified
relationship
|
static matrix.db.RelationshipWithSelect |
select(matrix.db.Relationship rel,
matrix.util.StringList selects)
Does a select on a relationship.
|
static java.lang.String[] |
select(java.lang.String[] ids,
Statement statement)
Selects the statement on all connections.
|
static matrix.db.RelationshipWithSelectList |
select(java.lang.String[] relIds,
Statement[] statements)
Does a select on a relationship list.
|
static matrix.db.RelationshipWithSelectList |
select(java.lang.String[] relIds,
java.lang.String select)
Does a select on a relationship list.
|
static matrix.db.RelationshipWithSelectList |
select(java.lang.String[] relIds,
matrix.util.StringList selects)
Does a select on a relationship list.
|
static java.lang.String[] |
select(java.lang.String id,
Statement... statements)
Select the specified statements on a particular relationship.
|
static java.lang.String[] |
select(java.lang.String id,
java.lang.String... statements)
Select the specified statements on a particular relationship.
|
static java.lang.String |
select(java.lang.String relId,
java.lang.String statement)
Selects the statement from the connection.
|
static matrix.db.RelationshipWithSelect |
select(java.lang.String relId,
matrix.util.StringList selects)
Does a select on a relationship.
|
static matrix.util.StringList[] |
selectList(java.lang.String rid,
Statement[] statements)
Select an array of statements on a particular relationship.
|
static matrix.util.StringList[] |
selectList(java.lang.String rid,
java.lang.String... statements)
Select an array of statements on a particular relationship.
|
static void |
setAttribute(java.lang.String relId,
java.lang.String attribute,
java.lang.String... values)
Modifies a multivalue attribute on relationship.
|
static void |
setAttributes(matrix.db.Relationship relationship,
java.util.Collection<matrix.db.Attribute> attributes)
Sets attributes on a relationship.
|
static void |
setAttributes(java.lang.String relationshipId,
java.util.Collection<matrix.db.Attribute> attributes)
Sets attributes on a relationship.
|
static boolean |
typeExists(java.lang.String relationshipType)
Checks whether or not the specified relationship type exists in the
database.
|
public static boolean typeExists(java.lang.String relationshipType)
public static boolean hasAttribute(java.lang.String relationship,
java.lang.String attribute)
throws TVCException
relationship - The name of the relationship.attribute - The name of the attribute.TVCExceptionpublic static void cloneAttributes(java.lang.String fromRelId,
java.lang.String toRelId)
throws TVCException
TVCExceptionpublic static void delete(matrix.db.Relationship rel)
throws TVCException
TVCExceptionpublic static void delete(java.lang.String relationshipId)
throws TVCException
TVCExceptionpublic static void modifyAttribute(matrix.db.Relationship rel,
matrix.db.Attribute attribute)
throws TVCException
rel - The relationship to modifyattribute - The attribute to modifyTVCException - If unable to modify the specified attribute.public static void modifyAttribute(java.lang.String relid,
java.lang.String attribute,
java.lang.String value)
throws TVCException
relid - Relationship id for connection to modifyattribute - The name of the attribute to modifyvalue - The new valueTVCException - If unable to modify the specified attribute.public static void setAttribute(java.lang.String relId,
java.lang.String attribute,
java.lang.String... values)
throws TVCException
relid - Relationship id for connection to modifyattribute - The name of the attribute to modifyvalue - The new values to setTVCException - If unable to modify the specified attribute.public static void modifyAttributes(java.lang.String relationshipId,
matrix.db.AttributeList attrs)
throws TVCException
relationshipId - The id of the relationship to modify the attributes
on.attrs - The attributes that should be modified.TVCException - If unable to modify the specified attributes.public static void modifyAttributes(matrix.db.Relationship rel,
matrix.db.AttributeList attrs)
throws TVCException
rel - The relationship to modify attributes on.attrs - The attributes that should be modified.TVCException - If unable to modify the specified attributes.public static void modifyType(java.lang.String relid,
java.lang.String type)
throws TVCException
relid - Relationship id for connection to modifytype - The name of the new relationship type.TVCException - If unable to modify the specified attributepublic static java.lang.String replaceObject(java.lang.String relid,
java.lang.String sourceObjectId,
java.lang.String targetObjectId)
throws TVCException
relid - The relationship idsourceObjectId - The object id of the object to be replacedtargetObjectId - The object id of the object that will be used as
replacementTVCException - upon failurepublic static java.lang.String modifyFrom(java.lang.String relid,
java.lang.String newFromObjectId)
throws TVCException
newFromObjectId - The ID of the business object that should be
connected on the from side of the relationship.TVCException - If unable to modify.public static java.lang.String modifyTo(java.lang.String relid,
java.lang.String newToObjectId)
throws TVCException
relid - The ID of the relationship.newToObjectId - The ID of the business object that should be
connected on the to side of the relationship.TVCException - If unable to modify.public static java.lang.String modifyObject(java.lang.String relid,
boolean from,
java.lang.String newObjectId)
throws TVCException
relid - The ID of the relationship.from - True to modify which object is connected on the from side,
false to modify which is connected on the to side.newObjectId - The ID of the business object that should be connected
on the specified side of the relationship.TVCException - If unable to modify.public static boolean modify(java.lang.String relid,
java.lang.String expr,
java.lang.String newValue)
throws TVCException
relid - Relationship id for connection to modify.expr - Select expression specifying which value to modify.newValue - New value.TVCExceptionpublic static java.lang.String[] select(java.lang.String id,
java.lang.String... statements)
throws TVCException
id - The ID of the relationship.statements - The select statements.TVCException - If an error occurs when selecting data.public static java.lang.String[] select(java.lang.String id,
Statement... statements)
throws TVCException
id - The ID of the relationship.statements - The select statements.TVCException - If an error occurs when selecting data.public static matrix.util.StringList[] selectList(java.lang.String rid,
java.lang.String... statements)
throws TVCException
rid - The ID of the relationship.statements - An array of select statements.TVCException - If unable to select data from the database.public static matrix.util.StringList[] selectList(java.lang.String rid,
Statement[] statements)
throws TVCException
rid - The ID of the relationship.statements - An array of select statements.TVCException - If unable to select data from the database.public static java.lang.String select(java.lang.String relId,
java.lang.String statement)
throws TVCException
relId - A relationship ID.statement - A select statement.TVCException - If unable to select.public static matrix.db.RelationshipWithSelect select(matrix.db.Relationship rel,
matrix.util.StringList selects)
throws TVCException
rel - The relationship to select information from.selects - A list of select statements.TVCException - If an error occurs.public static matrix.db.RelationshipWithSelect select(java.lang.String relId,
matrix.util.StringList selects)
throws TVCException
relId - The relationship ID.selects - A list of select statements.TVCException - If an error occurs.public static matrix.db.RelationshipWithSelectList select(java.lang.String[] relIds,
java.lang.String select)
throws TVCException
relIds - The relationship IDs.select - A select statement.TVCException - If an error occurs.public static matrix.db.RelationshipWithSelectList select(java.lang.String[] relIds,
Statement[] statements)
throws TVCException
relIds - The relationship IDs.statements - An array of select statements.TVCException - If an error occurs.public static matrix.db.RelationshipWithSelectList select(java.lang.String[] relIds,
matrix.util.StringList selects)
throws TVCException
relIds - The relationship IDs.selects - A list of select statements.TVCException - If an error occurs.public static java.lang.String getFromRelationshipID(java.lang.String fromObjectId,
java.lang.String toObjectId,
java.lang.String relType)
throws TVCException
fromObjectId - The ID of the business object on the from side
of the relationship.toObjectId - The ID of the business object on the to side of
the relationship.relType - The type of relationship that the objects have been
connected with.TVCException - If unable to communicate with the database.public static java.lang.String getToRelationshipID(java.lang.String toObjectId,
java.lang.String fromObjectId,
java.lang.String relType)
throws TVCException
toObjectId - The ID of the business object on the to side of
the relationship.fromObjectId - The ID of the business object on the from side
of the relationship.relType - The type of relationship that the objects have been
connected with.TVCException - If unable to communicate with the database.public static java.lang.String getRelationshipID(java.lang.String fromObjectId,
java.lang.String toObjectId,
java.lang.String relType)
throws TVCException
fromObjectId - The ID of the business object on the from side
of the relationship.toObjectId - The ID of the business object on the to side of
the relationship.relType - The type of relationship that the objects have been
connected with.TVCException - If unable to communicate with the database.public static boolean hasRelationship(java.lang.String fromObjectId,
java.lang.String toObjectId,
java.lang.String relType,
boolean useQueryConnection)
throws TVCException
If the parameter useQueryConnection is set to true, we will use the MQL command "query connection" to determine if the objects are connected, otherwise we will use the MQL command print connection bus A to B rel X select id dump IF there is a transaction active. If the latter is not the case, we will perform a standard expand to determine if the objects are connected.
fromObjectId - The from object idtoObjectId - The to object idrelType - The relationship typeuseQueryConnection - Uses MQL Query connection if availableTVCException - In case something funny happens in Matrixpublic static boolean hasRelationship(java.lang.String fromObjectId,
java.lang.String toObjectId,
java.lang.String relType)
throws TVCException
fromObjectId - The from object idtoObjectId - The to object idrelType - The relationship typeTVCExceptionpublic static matrix.db.AttributeList getAttributes(java.lang.String connectionId)
throws TVCException
connectionId - The connection idTVCExceptionpublic static java.lang.String[] select(java.lang.String[] ids,
Statement statement)
throws TVCException
ids - An array of connection IDs.statement - A select statement.TVCException - If unable to select.public static boolean exists(java.lang.String relId)
throws TVCException
TVCExceptionpublic static void setAttributes(java.lang.String relationshipId,
java.util.Collection<matrix.db.Attribute> attributes)
throws TVCException
relationshipId - Relationship id to set attributes onattributes - Attributes to setTVCExceptionpublic static void setAttributes(matrix.db.Relationship relationship,
java.util.Collection<matrix.db.Attribute> attributes)
throws TVCException
relationship - Relationship to set attributes onattributes - Attributes to setTVCExceptionCopyright ? Technia AB. All Rights Reserved.