org.alfresco.util.schemacomp.model
Interface DbObject

All Known Implementing Classes:
AbstractDbObject, AbstractDbObjectTest.AnotherConcreteDbObject, AbstractDbObjectTest.ConcreteDbObject, Column, DbPropertyTest.MyDbObject, DefaultComparisonUtilsTest.DatabaseObject, DefaultComparisonUtilsTest.DbObjectWithCollection, ForeignKey, Index, PrimaryKey, Schema, Sequence, Table

public interface DbObject

All database objects to be modelled for schema comparisons must implement this interface, examples of which include: schemas, tables, indexes, primary keys, foreign keys, sequences and columns.


Method Summary
 void accept(DbObjectVisitor visitor)
          Allows a visitor to be invoked against this DbObject.
 void diff(DbObject right, DiffContext ctx, Result.Strength strength)
          Generate a report of differences between this object ('left') and another object ('right').
 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.
 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 setParent(DbObject parent)
          Sets the parent object.
 void setValidators(java.util.List validators)
          Set/override the validators associated with this database object.
 

Method Detail

sameAs

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.

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.

Parameters:
other -
Returns:

getName

java.lang.String getName()
All items can be asked for their name, but it may be null.

Returns:
Name if available, null otherwise.

diff

void diff(DbObject right,
          DiffContext ctx,
          Result.Strength strength)
Generate a report of differences between this object ('left') and another object ('right'). Differences between the left and right objects under inspection are captured in the Results object passed in to this method.

Parameters:
right - The object to compare against.
ctx - The DiffContext

accept

void accept(DbObjectVisitor visitor)
Allows a visitor to be invoked against this DbObject. Implementations should ensure that child objects are visited first (by calling accept on them) before invoking the visitor on itself.

Parameters:
visitor -

getParent

DbObject getParent()
Get the parent object for which this object is a child. If this is the root object then null should be returned.

Returns:
Parent reference or null

setParent

void setParent(DbObject parent)
Sets the parent object.

Parameters:
parent -
See Also:
DbObject.getParent()

getValidators

java.util.List getValidators()
Retrieve the list of validators associated with this database object.

Returns:
DbValidator List
See Also:
DbValidator

setValidators

void setValidators(java.util.List validators)
Set/override the validators associated with this database object.

Parameters:
validators -

getTypeName

java.lang.String getTypeName()
Type name, e.g. "column", "foreign key"

Returns:
String


Copyright © 2005 - 2010 Alfresco Software, Inc. All Rights Reserved.