use of org.alfresco.util.schemacomp.DbProperty in project alfresco-repository by Alfresco.
the class PrimaryKey method doDiff.
@Override
protected void doDiff(DbObject right, DiffContext ctx) {
checkColumnOrders();
PrimaryKey rightPK = (PrimaryKey) right;
comparisonUtils.compareSimpleOrderedLists(new DbProperty(this, "columnNames"), new DbProperty(rightPK, "columnNames"), ctx);
comparisonUtils.compareSimpleOrderedLists(new DbProperty(this, "columnOrders"), new DbProperty(rightPK, "columnOrders"), ctx);
}
use of org.alfresco.util.schemacomp.DbProperty in project alfresco-repository by Alfresco.
the class Schema method doDiff.
@Override
protected void doDiff(DbObject right, DiffContext ctx) {
Schema rightSchema = (Schema) right;
comparisonUtils.compareSimple(new DbProperty(this, "version"), new DbProperty(rightSchema, "version"), ctx);
comparisonUtils.compareCollections(objects, rightSchema.objects, ctx);
}
use of org.alfresco.util.schemacomp.DbProperty in project alfresco-repository by Alfresco.
the class NameValidator method validate.
@Override
public void validate(DbObject reference, DbObject target, DiffContext ctx) {
String name = target.getName();
if (log.isDebugEnabled()) {
log.debug("Validating: pattern: [" + pattern + "], reference: " + reference + ", target: " + target);
}
if (pattern != null && !pattern.matcher(name).matches()) {
if (log.isDebugEnabled()) {
log.debug("Pattern [" + pattern + "] not matched.");
}
String message = I18NUtil.getMessage("system.schema_comp.name_validator", pattern);
ValidationResult result = new ValidationResult(new DbProperty(target, "name"), message);
ctx.getComparisonResults().add(result);
} else {
if (log.isDebugEnabled()) {
log.debug("Pattern [" + pattern + "] matched OK.");
}
}
}
use of org.alfresco.util.schemacomp.DbProperty in project alfresco-repository by Alfresco.
the class AbstractDbObject method diff.
/**
* Provides an implementation of {@link DbObject#diff(DbObject, DiffContext)}. The template
* method {@link #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.
*/
@Override
public void diff(DbObject right, DiffContext ctx) {
DbProperty leftNameProp = new DbProperty(this, "name");
DbProperty rightNameProp = new DbProperty(right, "name");
comparisonUtils.compareSimple(leftNameProp, rightNameProp, ctx);
doDiff(right, ctx);
}
use of org.alfresco.util.schemacomp.DbProperty in project alfresco-repository by Alfresco.
the class Index method doDiff.
@Override
protected void doDiff(DbObject right, DiffContext ctx) {
Index rightIndex = (Index) right;
// DatabaseMetaData provides the columns in the correct order for the index.
// So compare as ordered collections...
comparisonUtils.compareSimpleOrderedLists(new DbProperty(this, "columnNames"), new DbProperty(rightIndex, "columnNames"), ctx);
comparisonUtils.compareSimple(new DbProperty(this, "unique"), new DbProperty(rightIndex, "unique"), ctx);
}
Aggregations