|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthelma.objectmodel.db.Relation
public final class Relation
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.
Field Summary | |
---|---|
static java.lang.String |
AND
|
static int |
COLLECTION
|
static int |
COMPLEX_REFERENCE
|
static int |
INVALID
|
static java.lang.String |
OR
|
static int |
PRIMITIVE
|
static int |
REFERENCE
|
static java.lang.String |
XOR
|
Constructor Summary | |
---|---|
Relation(java.lang.String propName,
DbMapping ownType)
Reads a relation entry from a line in a properties file. |
Method Summary | |
---|---|
protected void |
addConstraint(helma.objectmodel.db.Relation.Constraint c)
Add a constraint to the current list of constraints |
protected void |
appendAdditionalTables(java.lang.StringBuffer q)
|
protected void |
appendFilter(java.lang.StringBuffer q,
INode nonvirtual,
java.lang.String prefix)
Build the filter. |
java.lang.String |
buildQuery(INode home,
INode nonvirtual,
DbMapping otherDbm,
java.lang.String kstr,
java.lang.String pre,
boolean useOrder)
Build the second half of an SQL select statement according to this relation and a local object. |
java.lang.String |
buildQuery(INode home,
INode nonvirtual,
java.lang.String kstr,
java.lang.String pre,
boolean useOrder)
Build the second half of an SQL select statement according to this relation and a local object. |
boolean |
checkConstraints(Node parent,
Node child)
Check if the child node fullfills the constraints defined by this relation. |
int |
countConstraints()
Returns the number of constraints for this relation. |
boolean |
createOnDemand()
Returns true if the object represented by this Relation has to be created on demand at runtime by the NodeManager. |
java.lang.String |
getAccessName()
|
int |
getColumnType()
|
ResourceProperties |
getConfig()
Get the configuration properties for this relation. |
java.lang.String |
getDbField()
Return the local field name for updates. |
java.lang.String |
getGroup()
Get the group for a collection relation, if defined. |
java.util.Map |
getKeyParts(INode home)
Returns a map containing the key/value pairs for a specific Node |
java.lang.String |
getOrder()
Get the order section to use for this relation |
DbMapping |
getPropertyMapping()
Return the db mapping for a propery relation. |
java.lang.String |
getPropName()
Return the name of the local property this relation is defined for |
java.lang.String |
getPrototype()
Return the prototype to be used for object reached by this relation |
int |
getRefType()
Get the reference type of this relation. |
Relation |
getSubnodeRelation()
|
DbMapping |
getTargetType()
Return the target type of this relation, or null if this is a primitive mapping. |
DbMapping |
getVirtualMapping()
get a DbMapping to use for virtual aka collection nodes. |
boolean |
hasAccessName()
|
boolean |
isCollection()
Returns true if this Relation describes a collection. |
boolean |
isComplexReference()
Returns true if this Relation describes a complex object reference property |
boolean |
isPrimitive()
Tell if this relation represents a primitive (scalar) value mapping. |
boolean |
isPrimitiveOrReference()
Returns true if this Relation describes either a primitive value or an object reference. |
boolean |
isPrivate()
Tell wether the property described by this relation is to be handled as private, i.e. |
boolean |
isReadonly()
Tell wether the property described by this relation is to be handled as readonly/write protected. |
boolean |
isReference()
Returns true if this Relation describes an object reference property |
boolean |
isVirtual()
Does this relation describe a virtual (collection) node? |
boolean |
loadAggressively()
Check whether aggressive loading is set for this relation |
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(java.util.Vector cnst,
java.util.Properties config)
|
protected void |
parsePropertyString(java.lang.String value,
java.util.Vector fragments,
java.util.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. |
void |
renderConstraints(java.lang.StringBuffer q,
INode home,
INode nonvirtual,
DbMapping otherDbm,
java.lang.String prefix)
Render contraints and filter conditions to an SQL query string buffer. |
void |
renderConstraints(java.lang.StringBuffer q,
INode home,
INode nonvirtual,
java.lang.String prefix)
Render contraints and filter conditions to an SQL query string buffer. |
void |
renderJoinConstraints(java.lang.StringBuffer select,
boolean isOracle)
Render the constraints for this relation for use within a left outer join select statement for the base object. |
void |
setColumnType(int ct)
|
void |
setConstraints(Node parent,
Node child)
Make sure that the child node fullfills the constraints defined by this relation by setting the appropriate properties |
java.lang.String |
toString()
|
void |
unsetConstraints(Node parent,
INode child)
Unset the constraints that link two objects together. |
void |
update(java.lang.String desc,
ResourceProperties props)
|
boolean |
usesPrimaryKey()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int INVALID
public static final int PRIMITIVE
public static final int REFERENCE
public static final int COLLECTION
public static final int COMPLEX_REFERENCE
public static final java.lang.String AND
public static final java.lang.String OR
public static final java.lang.String XOR
Constructor Detail |
---|
public Relation(java.lang.String propName, DbMapping ownType)
Method Detail |
---|
public void update(java.lang.String desc, ResourceProperties props)
protected void parseOptions(java.util.Vector cnst, java.util.Properties config)
public ResourceProperties getConfig()
public boolean isVirtual()
public DbMapping getTargetType()
public int getRefType()
public boolean isPrimitive()
public boolean isReference()
public boolean isPrimitiveOrReference()
public boolean isCollection()
public boolean isComplexReference()
public boolean isPrivate()
public boolean loadAggressively()
public int countConstraints()
public boolean createOnDemand()
public boolean needsPersistence()
public java.lang.String getPrototype()
public java.lang.String getPropName()
public void setColumnType(int ct)
ct
- ...public int getColumnType()
public java.lang.String getGroup()
protected void addConstraint(helma.objectmodel.db.Relation.Constraint c)
public boolean usesPrimaryKey()
public boolean hasAccessName()
public java.lang.String getAccessName()
public Relation getSubnodeRelation()
public java.lang.String getDbField()
protected void parsePropertyString(java.lang.String value, java.util.Vector fragments, java.util.Vector propertyRefs)
${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.
value
- Text to parse. Must not be null
.fragments
- List to add text fragments to.
Must not be null
.propertyRefs
- List to add property names to.
Must not be null
.public DbMapping getVirtualMapping()
public DbMapping getPropertyMapping()
public java.lang.String buildQuery(INode home, INode nonvirtual, java.lang.String kstr, java.lang.String pre, boolean useOrder) throws java.sql.SQLException, java.lang.ClassNotFoundException
java.sql.SQLException
java.lang.ClassNotFoundException
public java.lang.String buildQuery(INode home, INode nonvirtual, DbMapping otherDbm, java.lang.String kstr, java.lang.String pre, boolean useOrder) throws java.sql.SQLException, java.lang.ClassNotFoundException
java.sql.SQLException
java.lang.ClassNotFoundException
protected void appendAdditionalTables(java.lang.StringBuffer q)
protected void appendFilter(java.lang.StringBuffer q, INode nonvirtual, java.lang.String prefix)
public void renderConstraints(java.lang.StringBuffer q, INode home, INode nonvirtual, java.lang.String prefix) throws java.sql.SQLException, java.lang.ClassNotFoundException
q
- the query stringhome
- our home nodenonvirtual
- our non-virtual home nodeprefix
- the prefix to use to append to the existing query (e.g. " AND ")
java.sql.SQLException
- sql related exception
java.lang.ClassNotFoundException
- driver class not foundpublic void renderConstraints(java.lang.StringBuffer q, INode home, INode nonvirtual, DbMapping otherDbm, java.lang.String prefix) throws java.sql.SQLException, java.lang.ClassNotFoundException
q
- the query stringhome
- our home nodenonvirtual
- our non-virtual home nodotherDbm
- the DbMapping of the remote Nodeprefix
- the prefix to use to append to the existing query (e.g. " AND ")
java.sql.SQLException
- sql related exception
java.lang.ClassNotFoundException
- driver class not foundpublic void renderJoinConstraints(java.lang.StringBuffer select, boolean isOracle)
select
- the string buffer to write toisOracle
- create Oracle pre-9 style left outer joinpublic java.lang.String getOrder()
public boolean isReadonly()
public boolean checkConstraints(Node parent, Node child)
parent
- the parent object - may be a virtual or group nodechild
- the child object
public void setConstraints(Node parent, Node child)
public void unsetConstraints(Node parent, INode child)
public java.util.Map getKeyParts(INode home)
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |