Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

oracle.javatools.db
Class AbstractDBObjectBuilder<T extends AbstractBuildableObject>

java.lang.Object
  extended by oracle.javatools.db.AbstractDBObjectBuilder<T>
All Implemented Interfaces:
DBObjectBuilder<T>
Direct Known Subclasses:
DictionaryDBObjectBuilder

public abstract class AbstractDBObjectBuilder<T extends AbstractBuildableObject>
extends java.lang.Object
implements DBObjectBuilder<T>

Abstract implementation of DBObjectbuilder that provides core support for component building of objects.


Nested Class Summary
static interface AbstractDBObjectBuilder.PropertyBuilder
          Annotation to mark methods that build components (properties) of a given object within this builder.
 
Field Summary
 
Fields inherited from interface oracle.javatools.db.DBObjectBuilder
BASE_COMPONENT_KEY
 
Constructor Summary
protected AbstractDBObjectBuilder(AbstractDBObjectProvider pro, java.lang.String type)
           
 
Method Summary
 void buildObject(T object)
          Requests that the specified object be completed.
 void buildObjectComponent(T object, java.lang.String key)
          Uses canBuildComponents() to work out whether this builder can build just the given (key) subcomponent.
protected  boolean canBuildComponents()
          Returns false by default.
abstract  T createObject(java.lang.String name, Schema schema, DBObjectID id)
          Requests the creation of a new SchemaObject of the type built by this DBObjectBuilder instance.
protected  void ensureComponent(T obj, java.lang.String key)
          Ensures that the given component has been built.
protected  void fillInObject(T object)
          Fills in the entire object definition - i.e.
protected  void fillInObjectComponent(T object, java.lang.String key)
          Builds the whole object by default.
protected  java.lang.String getObjectType()
           
protected  AbstractDBObjectProvider getProvider()
           
protected  Schema getSchema(java.lang.String name)
          Gets the schema with the given name from the underlying provider.
protected  boolean isBuildableProperty(java.lang.String key)
          If this returns false, it means that the given property should not trigger any kind of build on the object.
protected  void markAsBuilt(T obj)
           
protected  boolean needsBuilding(T obj, java.lang.String key)
          Returns true if the given subcomponent of the object hasn't been explicitly built yet.
 boolean needsBuilding(T obj, java.lang.String key, boolean checkBuilder)
          Checks whether the given component key on the given object needs building and optionally includes a check as to whether the object has been completely built already.
protected  void registerObject(T object)
          Shared between buildObject and buildObjects to perform any post-build tasks that are needed (e.g.
 void updateTimestamp(DBObject object)
          Sets the timestamp of the given object if the underyling DBObjectProvide supports timestamping.
protected  void updateTimestamp(DBObject object, boolean force)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractDBObjectBuilder

protected AbstractDBObjectBuilder(AbstractDBObjectProvider pro,
                                  java.lang.String type)
Method Detail

getObjectType

protected final java.lang.String getObjectType()

getProvider

protected final AbstractDBObjectProvider getProvider()

getSchema

protected final Schema getSchema(java.lang.String name)
                          throws DBException
Gets the schema with the given name from the underlying provider. Use in preference to getProvider().getSchema( name ) because it skips timestamping checking and is therefore faster.

Throws:
DBException

createObject

public abstract T createObject(java.lang.String name,
                               Schema schema,
                               DBObjectID id)
Description copied from interface: DBObjectBuilder
Requests the creation of a new SchemaObject of the type built by this DBObjectBuilder instance.

Specified by:
createObject in interface DBObjectBuilder<T extends AbstractBuildableObject>
Parameters:
name - The name of the new object
schema - The schema containing the new object
id - the DBObjectID for the new object
Returns:
The newly created object

buildObject

public final void buildObject(T object)
                       throws DBException
Description copied from interface: DBObjectBuilder
Requests that the specified object be completed. The object should be completely initialized after the call completes.

Specified by:
buildObject in interface DBObjectBuilder<T extends AbstractBuildableObject>
Parameters:
object - The object needing building
Throws:
DBException - if an error occurs trying to build the object

fillInObject

protected void fillInObject(T object)
                     throws DBException
Fills in the entire object definition - i.e. builds all components. If the implementation doesn't support component building, this method must be overridden.

Parameters:
object - the object to fill in
Throws:
DBException

registerObject

protected void registerObject(T object)
                       throws DBException
Shared between buildObject and buildObjects to perform any post-build tasks that are needed (e.g. timestamping, registration with the object manager etc. Really we should try and do this for multiple objects at once as well but the timestamping work isn't easy to change that too so for now we'll stick with one at a time.

Throws:
DBException

updateTimestamp

public final void updateTimestamp(DBObject object)
                           throws DBException
Sets the timestamp of the given object if the underyling DBObjectProvide supports timestamping.

Throws:
DBException

updateTimestamp

protected final void updateTimestamp(DBObject object,
                                     boolean force)
                              throws DBException
Throws:
DBException

needsBuilding

protected final boolean needsBuilding(T obj,
                                      java.lang.String key)
Returns true if the given subcomponent of the object hasn't been explicitly built yet. If the object has been wholely built then this will confusingly return true because the object's builder is not checked.

Calling this is the same as needsBuilding( obj, key false ).


needsBuilding

public final boolean needsBuilding(T obj,
                                   java.lang.String key,
                                   boolean checkBuilder)
Checks whether the given component key on the given object needs building and optionally includes a check as to whether the object has been completely built already.


markAsBuilt

protected final void markAsBuilt(T obj)

ensureComponent

protected final void ensureComponent(T obj,
                                     java.lang.String key)
                              throws DBException
Ensures that the given component has been built. Use in a fillInObject implementation to ensure that dependent components are built before the component required.

Throws:
DBException

buildObjectComponent

public final void buildObjectComponent(T object,
                                       java.lang.String key)
                                throws DBException
Uses canBuildComponents() to work out whether this builder can build just the given (key) subcomponent. If it can't the whole object is built.

Specified by:
buildObjectComponent in interface DBObjectBuilder<T extends AbstractBuildableObject>
Throws:
DBException

fillInObjectComponent

protected final void fillInObjectComponent(T object,
                                           java.lang.String key)
                                    throws DBException
Builds the whole object by default. Override if canBuildComponents returns true to build the respective components. Defer to this implementation for unrecongnized keys.

Throws:
DBException

canBuildComponents

protected boolean canBuildComponents()
Returns false by default. Override to enable building by component in this builder. Once enabled, component building is supported by the use of methods annotated with the AbstractDBObjectBuilder.PropertyBuilder annotation.


isBuildableProperty

protected boolean isBuildableProperty(java.lang.String key)
If this returns false, it means that the given property should not trigger any kind of build on the object.

Parameters:
key - the property key for component building
Returns:
false if no build should be performed

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK
11g Release 2 (11.1.2.0.0)

E17493-01

Copyright © 1997, 2011, Oracle. All rights reserved.