public final class DelegateDDLGenerator extends java.lang.Object implements DDLGenerator
Constructor and Description |
---|
DelegateDDLGenerator(DDLGenerator base, DatabaseDescriptor desc, java.lang.Class<? extends Database> databaseClass, DBObjectProvider pro)
Constructs a DDLGenerator that will check the DBObjectRegistry for a registered DDLGenerator to delegate to for a given object type, and if there isn't one delegates to the base generator given on construction.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canAlterProperty(SystemObject original, SystemObject update, java.lang.String prop)
Convenience method to call
PropertyManager.canChangeProperty(oracle.javatools.db.SystemObject, oracle.javatools.db.SystemObject, java.lang.String) and check the return value is a PropertyAction with a type of ALTER. |
PropertyAction |
canChangeProperty(SystemObject original, SystemObject update, java.lang.String prop)
Queries the support for setting or changing the given property for a create or update.
|
boolean |
canCreateProperty(SystemObject object, java.lang.String prop)
Queries the support for setting or changing the given property for a create or update.
|
PropertyAction |
canUpdateObject(Difference rs)
Convenience method that uses
PropertyManager.canChangeProperty(oracle.javatools.db.SystemObject, oracle.javatools.db.SystemObject, java.lang.String) on all the differences in the given Difference to tell whether the update on the given objects can be done using a CREATE, ALTER or REPLACE as appropriate. |
PropertyAction |
canUpdateObject(SystemObject orig, SystemObject update)
Convenience method that uses
PropertyManager.canChangeProperty(oracle.javatools.db.SystemObject, oracle.javatools.db.SystemObject, java.lang.String) on all the differences in the given object to tell whether the update on the given objects can be done using a CREATE, ALTER or REPLACE as appropriate. |
PropertyInfo |
findPropertyInfo(java.lang.Class<? extends DBObject> objClass, java.lang.String prop)
Finds a PropertyInfo for the given property on the given object class.
|
java.util.Collection |
getAllowedPropertyValues(DBObject originalObject, DBObject updatedObject, java.lang.String property)
Gets the allowed property values for the given object and property in the described database.
|
java.util.Collection<java.lang.String> |
getAllowedReferenceParentTypes(DBObject obj, java.lang.String property)
Gets the allowed object types of the parent object for a given reference property.
|
java.util.Collection<java.lang.String> |
getAllowedReferenceTypes(DBObject object, java.lang.String property)
Gets the list of object types that can be referenced from the given property.
|
java.util.Collection<java.lang.String> |
getAllowedReferenceTypes(PropertyInfo propInfo)
Gets the list of object types that can be referenced from the given property.
|
java.util.Collection<java.lang.String> |
getAllowedReferenceTypes(java.lang.String objectType, java.lang.String property)
Gets the list of object types that can be referenced from the given property.
|
DDLGenerator |
getBaseGenerator()
Gets the base DDLGenerator that this will delegate to for any object type that isn't from the DBObjectRegistry.
|
DDL |
getCreateDDL(DDLOptions options, DBObject... objects)
Gets CREATE statements for the given objects.
|
DDL |
getDeleteDDL(DDLOptions options, DBObject... objects)
Gets DROP statements for the given objects.
|
java.lang.Object |
getImplicitDefaultValue(DBObject obj, java.lang.String property)
Gets the implicit default value for the given object property, if one exists.
|
Nullable.NullBehaviour |
getNullBehaviour(DBObject originalObject, DBObject updatedObject, java.lang.String property)
Gets the null behaviour of the given object property.
|
DDL |
getUndeleteDDL(DDLOptions options, DBObject... objects)
Gets statements to undelete (e.g.
|
DDL |
getUpdateDDL(DDLOptions options, Difference diff)
Gets ALTER statements for the given objects where possible, or DROP/CREATE, or CREATE AND REPLACE where appropriate/necessary.
|
boolean |
supportsAction(java.lang.String type, PropertyAction.Type action)
Asks whether a given action is supported for the specified object type in this provider.
|
boolean |
supportsProperty(java.lang.Class<? extends DBObject> objClz, java.lang.String prop)
Tests whether the given property is supported for the given object type.
|
boolean |
supportsProperty(java.lang.String type, java.lang.String prop)
Tests whether the given property is supported for the given object type.
|
PropertyAction |
supportsPropertyChange(java.lang.Class<? extends SystemObject> objClz, java.lang.String prop)
Tests whether the given property can be changed on the given system object type.
|
public DelegateDDLGenerator(DDLGenerator base, DatabaseDescriptor desc, java.lang.Class<? extends Database> databaseClass, DBObjectProvider pro)
base
- the base generator we will delegate to if the registry doesn't support a given type.desc
- the descriptor for the database we are generating ddl for.databaseClass
- the class of database we are generating ddl for.pro
- can be null.public DDLGenerator getBaseGenerator()
public boolean canCreateProperty(SystemObject object, java.lang.String prop)
PropertyManager
canCreateProperty
in interface PropertyManager
prop
- the property name / path to querypublic DDL getCreateDDL(DDLOptions options, DBObject... objects)
DDLGenerator
getCreateDDL
in interface DDLGenerator
public DDL getDeleteDDL(DDLOptions options, DBObject... objects)
DDLGenerator
getDeleteDDL
in interface DDLGenerator
public DDL getUndeleteDDL(DDLOptions options, DBObject... objects)
DDLGenerator
getUndeleteDDL
in interface DDLGenerator
public DDL getUpdateDDL(DDLOptions options, Difference diff)
DDLGenerator
getUpdateDDL
in interface DDLGenerator
public boolean supportsAction(java.lang.String type, PropertyAction.Type action)
PropertyManager
supportsAction
in interface PropertyManager
public boolean supportsProperty(java.lang.String type, java.lang.String prop)
PropertyManager
supportsProperty
in interface PropertyManager
type
- the object type (e.g. Table.TYPE
).prop
- the property name / path.public PropertyInfo findPropertyInfo(java.lang.Class<? extends DBObject> objClass, java.lang.String prop)
PropertyManager
findPropertyInfo
in interface PropertyManager
objClass
- the object class (e.g. Column.class ).prop
- the property name / path.public boolean supportsProperty(java.lang.Class<? extends DBObject> objClz, java.lang.String prop)
PropertyManager
supportsProperty
in interface PropertyManager
objClz
- the object class (e.g. Table.class or Column.class ).prop
- the property name / path.public java.util.Collection getAllowedPropertyValues(DBObject originalObject, DBObject updatedObject, java.lang.String property)
PropertyManager
getAllowedPropertyValues
in interface PropertyManager
updatedObject
- the object the property is onproperty
- the property to checkpublic java.util.Collection<java.lang.String> getAllowedReferenceParentTypes(DBObject obj, java.lang.String property)
PropertyManager
For example for an FKConstraint referenceID property this will return Table.TYPE.
getAllowedReferenceParentTypes
in interface PropertyManager
obj
- the object the property is set onproperty
- the name of the property to lookuppublic java.util.Collection<java.lang.String> getAllowedReferenceTypes(DBObject object, java.lang.String property)
PropertyManager
getAllowedReferenceTypes
in interface PropertyManager
object
- the object the reference is fromproperty
- the reference property namepublic boolean canAlterProperty(SystemObject original, SystemObject update, java.lang.String prop)
PropertyManager
PropertyManager.canChangeProperty(oracle.javatools.db.SystemObject, oracle.javatools.db.SystemObject, java.lang.String)
and check the return value is a PropertyAction with a type of ALTER.canAlterProperty
in interface PropertyManager
original
- the original object (null for a create query)update
- the updated (or new) objectprop
- the property name / path to querypublic PropertyAction canChangeProperty(SystemObject original, SystemObject update, java.lang.String prop)
PropertyManager
canChangeProperty
in interface PropertyManager
original
- the original object (null for a create query)update
- the updated (or new) objectprop
- the property name / path to querypublic PropertyAction canUpdateObject(Difference rs)
PropertyManager
PropertyManager.canChangeProperty(oracle.javatools.db.SystemObject, oracle.javatools.db.SystemObject, java.lang.String)
on all the differences in the given Difference to tell whether the update on the given objects can be done using a CREATE, ALTER or REPLACE as appropriate. The Difference must be a diff of two SystemObjects.canUpdateObject
in interface PropertyManager
rs
- the changes to testpublic PropertyAction canUpdateObject(SystemObject orig, SystemObject update)
PropertyManager
PropertyManager.canChangeProperty(oracle.javatools.db.SystemObject, oracle.javatools.db.SystemObject, java.lang.String)
on all the differences in the given object to tell whether the update on the given objects can be done using a CREATE, ALTER or REPLACE as appropriate.canUpdateObject
in interface PropertyManager
orig
- the original object (null for a create query)update
- the updated (or new) objectpublic java.util.Collection<java.lang.String> getAllowedReferenceTypes(java.lang.String objectType, java.lang.String property)
PropertyManager
getAllowedReferenceTypes
in interface PropertyManager
objectType
- the type of object the reference is fromproperty
- the reference property namepublic java.util.Collection<java.lang.String> getAllowedReferenceTypes(PropertyInfo propInfo)
PropertyManager
getAllowedReferenceTypes
in interface PropertyManager
propInfo
- the PropertyInfo for the property to testpublic PropertyAction supportsPropertyChange(java.lang.Class<? extends SystemObject> objClz, java.lang.String prop)
PropertyManager
If the property is a child property, and ALTER is supported then the action may contain child information (e.g. whether children can be added/removed/modified) via the supportsChildAction
method.
supportsPropertyChange
in interface PropertyManager
objClz
- the type of system object to testprop
- the property (can be a path) that we want to changePropertyAction.supportsChildAction(oracle.javatools.db.property.PropertyAction.ChildAction)
public java.lang.Object getImplicitDefaultValue(DBObject obj, java.lang.String property)
PropertyManager
nullable
, if null means "Not Specified" then the default is not of interest.getImplicitDefaultValue
in interface PropertyManager
obj
- the object the property is onproperty
- the property namepublic Nullable.NullBehaviour getNullBehaviour(DBObject originalObject, DBObject updatedObject, java.lang.String property)
PropertyManager
getNullBehaviour
in interface PropertyManager
originalObject
- the original object, or null if this isn't an edit.updatedObject
- the updated object (must not be null).property
- the property to test.