Class Schema
- java.lang.Object
-
- org.alfresco.util.schemacomp.model.AbstractDbObject
-
- org.alfresco.util.schemacomp.model.Schema
-
public class Schema extends AbstractDbObject implements java.lang.Iterable<DbObject>
Instances of this class represent a database schema.- Author:
- Matt Ward
-
-
Field Summary
Fields Modifier and Type Field Description protected booleancheckTableColumnOrderprotected java.lang.StringdbPrefixprotected java.util.List<DbObject>objectsprotected intversion-
Fields inherited from class org.alfresco.util.schemacomp.model.AbstractDbObject
comparisonUtils
-
-
Constructor Summary
Constructors Constructor Description Schema(java.lang.String name)Construct a schema with the given name and no database prefix.Schema(java.lang.String name, java.lang.String dbPrefix, int schemaVersion, boolean checkTableColumnOrder)Construct a schema with the given name and database prefix.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaccept(DbObjectVisitor visitor)Allows a visitor to be invoked against this DbObject.voidadd(DbObject dbObject)Add an object to this schema - this method will set this schema as the object's parent.booleancontains(DbObject object)booleancontainsByName(java.lang.String name)protected voiddoDiff(DbObject right, DiffContext ctx)Override this method to provide subclass specific diffing logic.booleanequals(java.lang.Object obj)java.lang.StringgetDbPrefix()intgetVersion()inthashCode()booleanisCheckTableColumnOrder()java.util.Iterator<DbObject>iterator()booleansameAs(DbObject other)Are the twoDbObjects 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.-
Methods inherited from class org.alfresco.util.schemacomp.model.AbstractDbObject
diff, getName, getParent, getTypeName, getValidators, hasObjectLevelValidator, hasValidators, setComparisonUtils, setName, setParent, setValidators, toString
-
-
-
-
Field Detail
-
objects
protected final java.util.List<DbObject> objects
-
dbPrefix
protected final java.lang.String dbPrefix
-
version
protected final int version
-
checkTableColumnOrder
protected final boolean checkTableColumnOrder
-
-
Constructor Detail
-
Schema
public Schema(java.lang.String name)
Construct a schema with the given name and no database prefix.- Parameters:
name- String
-
Schema
public Schema(java.lang.String name, java.lang.String dbPrefix, int schemaVersion, boolean checkTableColumnOrder)Construct a schema with the given name and database prefix. The database prefix specifies what filtering applies to the high-level (tables and sequences) objects in the schema. If for example dbPrefix is "alf_" then only tables and sequences whose names begin with "alf_" will be represented by this schema. Therefore any comparisons should be performed against another similarly filtered Schema object.- Parameters:
name- StringdbPrefix- StringschemaVersion- intcheckTableColumnOrder- boolean
-
-
Method Detail
-
add
public void add(DbObject dbObject)
Add an object to this schema - this method will set this schema as the object's parent.- Parameters:
dbObject- DbObject
-
iterator
public java.util.Iterator<DbObject> iterator()
- Specified by:
iteratorin interfacejava.lang.Iterable<DbObject>
-
contains
public boolean contains(DbObject object)
- Parameters:
object- DbObject- Returns:
- boolean
-
getDbPrefix
public java.lang.String getDbPrefix()
- Returns:
- the dbPrefix
-
getVersion
public int getVersion()
- Returns:
- the version
-
isCheckTableColumnOrder
public boolean isCheckTableColumnOrder()
- Returns:
- the checkTableColumnOrder
-
hashCode
public int hashCode()
- Overrides:
hashCodein classAbstractDbObject
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classAbstractDbObject
-
doDiff
protected void doDiff(DbObject right, DiffContext ctx)
Description copied from class:AbstractDbObjectOverride this method to provide subclass specific diffing logic.- Overrides:
doDiffin classAbstractDbObject- Parameters:
right- DbObjectctx- DiffContext
-
accept
public void accept(DbObjectVisitor visitor)
Description copied from interface:DbObjectAllows 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.
-
sameAs
public boolean sameAs(DbObject other)
Description copied from interface:DbObjectAre the twoDbObjects 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. Whena.sameAs(b) == trueit 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.- Specified by:
sameAsin interfaceDbObject- Overrides:
sameAsin classAbstractDbObject- Parameters:
other- DbObject- Returns:
- boolean
-
containsByName
public boolean containsByName(java.lang.String name)
-
-