| java.lang.Object helma.objectmodel.db.Relation
Relation | final public class Relation (Code) | | This describes how a property of a persistent Object is stored in a
relational database table. This can be either a scalar property (string, date, number etc.)
or a reference to one or more other objects.
|
Inner Class :class Constraint | |
Constructor Summary | |
public | Relation(String propName, DbMapping ownType) Reads a relation entry from a line in a properties file. |
Method Summary | |
protected void | addConstraint(Constraint c) | protected void | appendAdditionalTables(StringBuffer q) | protected void | appendFilter(StringBuffer q, INode nonvirtual, String prefix) Build the filter. | public String | buildQuery(INode home, INode nonvirtual, String kstr, String pre, boolean useOrder) Build the second half of an SQL select statement according to this relation
and a local object. | public String | buildQuery(INode home, INode nonvirtual, DbMapping otherDbm, String kstr, String pre, boolean useOrder) Build the second half of an SQL select statement according to this relation
and a local object. | public boolean | checkConstraints(Node parent, Node child) Check if the child node fullfills the constraints defined by this relation. | public int | countConstraints() Returns the number of constraints for this relation. | public boolean | createOnDemand() Returns true if the object represented by this Relation has to be
created on demand at runtime by the NodeManager. | public String | getAccessName() | public int | getColumnType() | public ResourceProperties | getConfig() Get the configuration properties for this relation. | public String | getDbField() Return the local field name for updates. | public String | getGroup() Get the group for a collection relation, if defined. | Relation | getGroupbyPropertyRelation() Return a Relation that defines the properties of a group-by node. | Relation | getGroupbySubnodeRelation() Return a Relation that defines the subnodes of a group-by node. | public Map | getKeyParts(INode home) | public String | getOrder() | public String | getPropName() | public DbMapping | getPropertyMapping() Return the db mapping for a propery relation. | public String | getPrototype() | public int | getRefType() Get the reference type of this relation. | public Relation | getSubnodeRelation() | public DbMapping | getTargetType() Return the target type of this relation, or null if this is a primitive mapping. | public DbMapping | getVirtualMapping() get a DbMapping to use for virtual aka collection nodes. | Relation | getVirtualPropertyRelation() Return a Relation that defines the properties of a virtual node. | Relation | getVirtualSubnodeRelation() Return a Relation that defines the subnodes of a virtual node. | public boolean | hasAccessName() | public boolean | isCollection() Returns true if this Relation describes a collection. | public boolean | isComplexReference() | public boolean | isPrimitive() Tell if this relation represents a primitive (scalar) value mapping. | public boolean | isPrimitiveOrReference() Returns true if this Relation describes either a primitive value
or an object reference. | public boolean | isPrivate() Tell wether the property described by this relation is to be handled as private, i.e. | public boolean | isReadonly() Tell wether the property described by this relation is to be handled
as readonly/write protected. | public boolean | isReference() | public boolean | isVirtual() | public boolean | loadAggressively() | public boolean | needsPersistence() Returns true if the object represented by this Relation has to be
persisted in the internal db in order to be functional. | protected void | parseOptions(Vector cnst, Properties config) | protected void | parsePropertyString(String value, Vector fragments, Vector propertyRefs) This is taken from org.apache.tools.ant ProjectHelper.java
distributed under the Apache Software License, Version 1.1
Parses a string containing ${xxx} style property
references into two lists. | public void | renderConstraints(StringBuffer q, INode home, INode nonvirtual, String prefix) Render contraints and filter conditions to an SQL query string buffer.
Parameters: q - the query string Parameters: home - our home node Parameters: nonvirtual - our non-virtual home node Parameters: prefix - the prefix to use to append to the existing query (e.g. | public void | renderConstraints(StringBuffer q, INode home, INode nonvirtual, DbMapping otherDbm, String prefix) Render contraints and filter conditions to an SQL query string buffer.
Parameters: q - the query string Parameters: home - our home node Parameters: nonvirtual - our non-virtual home nod Parameters: otherDbm - the DbMapping of the remote Node Parameters: prefix - the prefix to use to append to the existing query (e.g. | public void | renderJoinConstraints(StringBuffer select, boolean isOracle) Render the constraints for this relation for use within
a left outer join select statement for the base object. | public void | setColumnType(int ct) | public void | setConstraints(Node parent, Node child) | public String | toString() | public void | unsetConstraints(Node parent, INode child) Unset the constraints that link two objects together. | public void | update(String desc, ResourceProperties props) | public boolean | usesPrimaryKey() |
COLLECTION | final public static int COLLECTION(Code) | | |
COMPLEX_REFERENCE | final public static int COMPLEX_REFERENCE(Code) | | |
INVALID | final public static int INVALID(Code) | | |
PRIMITIVE | final public static int PRIMITIVE(Code) | | |
REFERENCE | final public static int REFERENCE(Code) | | |
aggressiveCaching | boolean aggressiveCaching(Code) | | |
aggressiveLoading | boolean aggressiveLoading(Code) | | |
autoSorted | boolean autoSorted(Code) | | |
columnType | int columnType(Code) | | |
constraints | Constraint[] constraints(Code) | | |
isPrivate | boolean isPrivate(Code) | | |
readonly | boolean readonly(Code) | | |
referencesPrimaryKey | boolean referencesPrimaryKey(Code) | | |
Relation | public Relation(String propName, DbMapping ownType)(Code) | | Reads a relation entry from a line in a properties file.
|
addConstraint | protected void addConstraint(Constraint c)(Code) | | Add a constraint to the current list of constraints
|
checkConstraints | public boolean checkConstraints(Node parent, Node child)(Code) | | Check if the child node fullfills the constraints defined by this relation.
FIXME: This always returns false if the relation has a filter value set,
since we can't determine if the filter constraints are met without
querying the database.
Parameters: parent - the parent object - may be a virtual or group node Parameters: child - the child object true if all constraints are met |
countConstraints | public int countConstraints()(Code) | | Returns the number of constraints for this relation.
|
createOnDemand | public boolean createOnDemand()(Code) | | Returns true if the object represented by this Relation has to be
created on demand at runtime by the NodeManager. This is true for:
- collection (aka virtual) nodes
- nodes accessed via accessname
- group nodes
- complex reference nodes
|
getColumnType | public int getColumnType()(Code) | | ... |
getDbField | public String getDbField()(Code) | | Return the local field name for updates.
|
getGroup | public String getGroup()(Code) | | Get the group for a collection relation, if defined.
the name of the column used to group child objects, if any. |
getGroupbyPropertyRelation | Relation getGroupbyPropertyRelation()(Code) | | Return a Relation that defines the properties of a group-by node.
|
getGroupbySubnodeRelation | Relation getGroupbySubnodeRelation()(Code) | | Return a Relation that defines the subnodes of a group-by node.
|
getKeyParts | public Map getKeyParts(INode home)(Code) | | Returns a map containing the key/value pairs for a specific Node
|
getOrder | public String getOrder()(Code) | | Get the order section to use for this relation
|
getPropName | public String getPropName()(Code) | | Return the name of the local property this relation is defined for
|
getPropertyMapping | public DbMapping getPropertyMapping()(Code) | | Return the db mapping for a propery relation.
the target mapping of this property relation |
getPrototype | public String getPrototype()(Code) | | Return the prototype to be used for object reached by this relation
|
getRefType | public int getRefType()(Code) | | Get the reference type of this relation.
|
getTargetType | public DbMapping getTargetType()(Code) | | Return the target type of this relation, or null if this is a primitive mapping.
|
getVirtualMapping | public DbMapping getVirtualMapping()(Code) | | get a DbMapping to use for virtual aka collection nodes.
|
getVirtualPropertyRelation | Relation getVirtualPropertyRelation()(Code) | | Return a Relation that defines the properties of a virtual node.
|
getVirtualSubnodeRelation | Relation getVirtualSubnodeRelation()(Code) | | Return a Relation that defines the subnodes of a virtual node.
|
hasAccessName | public boolean hasAccessName()(Code) | | ... |
isCollection | public boolean isCollection()(Code) | | Returns true if this Relation describes a collection.
NOTE: this will return true both for collection objects
(aka virtual nodes) and direct child object relations, so
isVirtual() should be used to identify relations that define
collection properties!
|
isComplexReference | public boolean isComplexReference()(Code) | | Returns true if this Relation describes a complex object reference property
|
isPrimitive | public boolean isPrimitive()(Code) | | Tell if this relation represents a primitive (scalar) value mapping.
|
isPrimitiveOrReference | public boolean isPrimitiveOrReference()(Code) | | Returns true if this Relation describes either a primitive value
or an object reference.
|
isPrivate | public boolean isPrivate()(Code) | | Tell wether the property described by this relation is to be handled as private, i.e.
a change on it should not result in any changed object/collection relations.
|
isReadonly | public boolean isReadonly()(Code) | | Tell wether the property described by this relation is to be handled
as readonly/write protected.
|
isReference | public boolean isReference()(Code) | | Returns true if this Relation describes an object reference property
|
isVirtual | public boolean isVirtual()(Code) | | Does this relation describe a virtual (collection) node?
|
loadAggressively | public boolean loadAggressively()(Code) | | Check whether aggressive loading is set for this relation
|
needsPersistence | public boolean needsPersistence()(Code) | | Returns true if the object represented by this Relation has to be
persisted in the internal db in order to be functional. This is true if
the subnodes contained in this collection are stored in the embedded
database. In this case, the collection itself must also be an ordinary
object stored in the db, since a virtual collection would lose its
its content after restarts.
|
parsePropertyString | protected void parsePropertyString(String value, Vector fragments, Vector propertyRefs)(Code) | | This is taken from org.apache.tools.ant ProjectHelper.java
distributed under the Apache Software License, Version 1.1
Parses a string containing ${xxx} style property
references into two lists. The first list is a collection
of text fragments, while the other is a set of string property names.
null entries in the first list indicate a property
reference from the second list.
Parameters: value - Text to parse. Must not be null . Parameters: fragments - List to add text fragments to.Must not be null . Parameters: propertyRefs - List to add property names to.Must not be null . |
renderConstraints | public void renderConstraints(StringBuffer q, INode home, INode nonvirtual, String prefix) throws SQLException, ClassNotFoundException(Code) | | Render contraints and filter conditions to an SQL query string buffer.
Parameters: q - the query string Parameters: home - our home node Parameters: nonvirtual - our non-virtual home node Parameters: prefix - the prefix to use to append to the existing query (e.g. " AND ") throws: SQLException - sql related exception throws: ClassNotFoundException - driver class not found |
renderConstraints | public void renderConstraints(StringBuffer q, INode home, INode nonvirtual, DbMapping otherDbm, String prefix) throws SQLException, ClassNotFoundException(Code) | | Render contraints and filter conditions to an SQL query string buffer.
Parameters: q - the query string Parameters: home - our home node Parameters: nonvirtual - our non-virtual home nod Parameters: otherDbm - the DbMapping of the remote Node Parameters: prefix - the prefix to use to append to the existing query (e.g. " AND ") throws: SQLException - sql related exception throws: ClassNotFoundException - driver class not found |
renderJoinConstraints | public void renderJoinConstraints(StringBuffer select, boolean isOracle)(Code) | | Render the constraints for this relation for use within
a left outer join select statement for the base object.
Parameters: select - the string buffer to write to Parameters: isOracle - create Oracle pre-9 style left outer join |
setColumnType | public void setColumnType(int ct)(Code) | | Parameters: ct - ... |
setConstraints | public void setConstraints(Node parent, Node child)(Code) | | Make sure that the child node fullfills the constraints defined by this relation by setting the
appropriate properties
|
unsetConstraints | public void unsetConstraints(Node parent, INode child)(Code) | | Unset the constraints that link two objects together.
|
usesPrimaryKey | public boolean usesPrimaryKey()(Code) | | true if the foreign key used for this relation is theother object's primary key. |
|
|