public abstract class AbstractDbObject extends java.lang.Object implements DbObject
DbObject implementations.| Modifier and Type | Field and Description |
|---|---|
protected ComparisonUtils |
comparisonUtils |
| Constructor and Description |
|---|
AbstractDbObject(DbObject parent,
java.lang.String name)
Instantiate, giving the object a parent and a name.
|
| Modifier and Type | Method and Description |
|---|---|
void |
diff(DbObject right,
DiffContext ctx)
Provides an implementation of
DbObject#diff(DbObject, Results). |
protected void |
doDiff(DbObject right,
DiffContext ctx)
Override this method to provide subclass specific diffing logic.
|
boolean |
equals(java.lang.Object obj) |
java.lang.String |
getName()
All items can be asked for their name, but it may be null.
|
DbObject |
getParent()
Get the parent object for which this object is a child.
|
java.lang.String |
getTypeName()
Type name, e.g.
|
java.util.List |
getValidators()
Retrieve the list of validators associated with this database object.
|
int |
hashCode() |
boolean |
hasObjectLevelValidator()
Is there at least one validator that assumes object-level validation
that removes the requirement for reporting of differences for this object?
|
boolean |
hasValidators()
Does the database object have any validators associated with it?
|
boolean |
sameAs(DbObject other)
Are the two
DbObjects logically the same? For example two Index objects may have
different names, but are the same index as they both index the same columns for the same table. |
void |
setComparisonUtils(ComparisonUtils comparisonUtils)
If a ComparisonUtils other than the default is required, then this setter can be used.
|
void |
setName(java.lang.String name) |
void |
setParent(DbObject parent)
Sets the parent object.
|
void |
setValidators(java.util.List validators)
Set/override the validators associated with this database object.
|
java.lang.String |
toString() |
protected ComparisonUtils comparisonUtils
public AbstractDbObject(DbObject parent, java.lang.String name)
parent - name - public java.lang.String getName()
DbObjectpublic void setName(java.lang.String name)
name - the name to setpublic boolean sameAs(DbObject other)
DbObjectDbObjects logically the same? For example two Index objects may have
different names, but are the same index as they both index the same columns for the same table.
If two objects a and b have the same logical identity, it does not mean that a.equals(b) == true.
The two objects may well have differences and will be flagged as such by the schema comparison tool. When
a.sameAs(b) == true it makes it easier to show the differences as related, i.e. a and b are
different rather than, a is only in the 'left' tree and b is only in the 'right' tree.
public int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic void diff(DbObject right, DiffContext ctx)
DbObject#diff(DbObject, Results). The template
method #doDiff(DbObject, Results) provides the subclass specific diffing logic,
whilst this method handles the workflow required in most cases: set the path's prefix that will be
used to explain where differences occur; compare the name fields of the two objects; delegate to the
subclass specific diffing (if any); remove the last path addition ready for the next object to perform
its diff correctly.public DbObject getParent()
DbObjectpublic void setParent(DbObject parent)
DbObjectsetParent in interface DbObjectDbObject.getParent()protected void doDiff(DbObject right, DiffContext ctx)
right - differences - public void setComparisonUtils(ComparisonUtils comparisonUtils)
comparisonUtils - the comparisonUtils to setpublic java.util.List getValidators()
DbObjectgetValidators in interface DbObjectDbValidatorpublic void setValidators(java.util.List validators)
DbObjectsetValidators in interface DbObjectvalidators - the validators to setpublic boolean hasValidators()
DbObjecthasValidators in interface DbObjectpublic boolean hasObjectLevelValidator()
DbObjecthasObjectLevelValidator in interface DbObjectpublic java.lang.String getTypeName()
DbObjectgetTypeName in interface DbObjectCopyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.