Modifier and Type | Field and Description |
---|---|
protected ComparisonUtils |
comparisonUtils |
Constructor and Description |
---|
AbstractDbObject(DbObject parent,
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, DiffContext) . |
protected void |
doDiff(DbObject right,
DiffContext ctx)
Override this method to provide subclass specific diffing logic.
|
boolean |
equals(Object obj) |
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.
|
String |
getTypeName()
Type name, e.g.
|
List<DbValidator> |
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
DbObject s 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(String name) |
void |
setParent(DbObject parent)
Sets the parent object.
|
void |
setValidators(List<DbValidator> validators)
Set/override the validators associated with this database object.
|
String |
toString() |
protected ComparisonUtils comparisonUtils
public String getName()
DbObject
public void setName(String name)
name
- the name to setpublic boolean sameAs(DbObject other)
DbObject
DbObject
s 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 void diff(DbObject right, DiffContext ctx)
DbObject.diff(DbObject, DiffContext)
. The template
method doDiff(DbObject, DiffContext)
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()
DbObject
public void setParent(DbObject parent)
DbObject
setParent
in interface DbObject
parent
- DbObjectDbObject.getParent()
protected void doDiff(DbObject right, DiffContext ctx)
right
- DbObjectctx
- DiffContextpublic void setComparisonUtils(ComparisonUtils comparisonUtils)
comparisonUtils
- the comparisonUtils to setpublic List<DbValidator> getValidators()
DbObject
getValidators
in interface DbObject
DbValidator
public void setValidators(List<DbValidator> validators)
DbObject
setValidators
in interface DbObject
validators
- the validators to setpublic boolean hasValidators()
DbObject
hasValidators
in interface DbObject
public boolean hasObjectLevelValidator()
DbObject
hasObjectLevelValidator
in interface DbObject
public String getTypeName()
DbObject
getTypeName
in interface DbObject
Copyright © 2005–2017 Alfresco Software. All rights reserved.