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

E17493-01

oracle.ide.db.dialogs
Class DBEditorConfig

java.lang.Object
  extended by oracle.ide.db.dialogs.DBEditorConfig

public final class DBEditorConfig
extends java.lang.Object

Configuration class for launching a database object "Create" or "Edit" dialog.

Creating a DBEditorConfig

Create a new config using the static methods newCreateConfig or newEditConfig as appropriate, the methods are overloaded for the various scenarios of create or edit.

Example 1: config for creating a new Table in a provider in schema1
 final DBEditorConfig config =
   DBEditorConfig.newCreateConfig( pro, Table.TYPE, schema1 );
 
Example 2: config for editing an existing Table (table1) in a provider
 final DBEditorConfig config =
   DBEditorConfig.newEditConfig( pro, table1 );
 
Once you have a config, launch it using launchDialog method on the appropriate DBEditorFactory.

Using a DBEditorConfig

After the dialog has been launched, the config can be inspected to find out what the result of the edit was. Calling config.getResult() will return a DBEditorConfig.Result object which indicates success or failure.

Obtaining a DBEditorConfig in a dialog

For traversable panels in the dialog, the config is accessed via the context passed into onEntry or onExit as follows:
   final DBEditorConfig config = dataContext.find( DBEditorConfig.class );
 

Since:
11.1.2.0.0
See Also:
DBEditorFactory.launchDialog(DBEditorConfig)

Nested Class Summary
static class DBEditorConfig.Result
          Result class for the commit operation to the provider.
 
Method Summary
 java.util.List<SystemObject> getAdditionalObjects()
          Gets any additional objects that have been created as part of the create or edit operation.
 DBObject getChildObject()
          Gets the child object being edited (if there is one).
 DBException getException()
          If the dialog result is Result.FAILED this method will return the exception encountered in commiting to the DBObjectProvider.
 SystemObject getNewObject()
          Gets the "newObject".
 java.lang.String getObjectType()
          Gets the type of SystemObject that the create or edit operation is for.
 SystemObject getOriginalObject()
          For an edit operation, this returns the original objec that the DBObjectProvider has in memory.
 DBObjectNode getOriginalObjectNode()
          If this config was created using a DBObjectNode representing the object to edit, this returns that node.
 DBObjectProvider getProvider()
          Gets the DBObjectProvider for the create or edit operation.
 DBEditorConfig.Result getResult()
          Gets the dialog result.
 Schema getSchema()
          Gets the schema for the current dialog.
 Schema[] getSchemaList()
          Gets the list of Schemas to use in the dialog for any schema pickers.
 boolean isChildEditOnly()
          Checks whether we are editing a child object in isolation rather than within the context of the parent's edit dialog.
 boolean isCommitToProvider()
          Tests whether this dialog invocation should commit any changes to the underlying DBObjectProvider on exit.
 boolean isEditable()
          Returns true if the object in the dialog can be edited, or false if the object is read only.
 boolean isReplaceAllowed()
          Tests whether the commit is allowed to replace existing objects (drop/create) rather than just update them.
 boolean isUseBackgroundTask()
          Not used yet.
static DBEditorConfig newCreateConfig(DBObjectProvider pro, DBObject obj)
          Creates a new config for launching a database object create dialog.
static DBEditorConfig newCreateConfig(DBObjectProvider pro, java.lang.String type, DBObject parent)
          Creates a new config for launching a database object create dialog.
static DBEditorConfig newCreateConfig(DBObjectProvider pro, java.lang.String type, Schema schema)
          Creates a new config for launching a database object create dialog.
static DBEditorConfig newCreateConfig(DBObjectTypeNode node)
          Creates a new config for launching a database object create dialog.
static DBEditorConfig newEditConfig(DBObjectNode node)
          Creates a new config for launching a database object edit dialog.
static DBEditorConfig newEditConfig(DBObjectProvider pro, DBObject obj)
          Creates a new config for launching a database object edit dialog.
 void setChildEditOnly(boolean childEditOnly)
          If there is a child object, this property governs whether the dialog launched is solely for that object, or edits the parent SystemObject and initial focus is on the child object.
 void setChildObject(DBObject childObject)
          Sets the child object.
 void setCommitToProvider(boolean commit)
          Sets whether the dialog should commit any changes to the underlying DBObjectProvider on exit, or just update the memory model.
 void setEditable(boolean editable)
          Sets whether the object should be editable or not.
 void setException(DBException exception)
          If the commit operation fails with a DBException, this method is used by the framework to specify the failure.
 void setNewObject(SystemObject newObject)
          Sets the newObject - i.e.
 void setObjectType(java.lang.String objectType)
          Sets the type of SystemObject that the create or edit operation is for.
 void setOriginalObject(SystemObject originalObject)
          Sets the original object for an edit operation.
 void setReplaceAllowed(boolean allowReplace)
          If the operation is an edit, this sets whether the operation is allowed to replace objects in the database rather than just update.
 void setReplaceAlwaysAllowed(boolean allowReplace)
          Registers that the object being edited can always be replaced regardless of the properties that are changed.
 void setResult(DBEditorConfig.Result dialogResult)
          Sets the dialog result.
 void setSchema(Schema schema)
          Sets the default schema to use in the dialog for any schema pickers.
 void setSchemaList(Schema[] schemaList)
          Sets the schema list for the dialog.
 void setUseBackgroundTask(boolean backgroundTask)
          Not used yet.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProvider

public DBObjectProvider getProvider()
Gets the DBObjectProvider for the create or edit operation. This cannot be null and is set when the config is created.

Returns:
the DBObjectProvider for the operation

setReplaceAlwaysAllowed

public void setReplaceAlwaysAllowed(boolean allowReplace)
Registers that the object being edited can always be replaced regardless of the properties that are changed.

Parameters:
allowReplace - true if the api can replace objects rather than just update them.

setReplaceAllowed

public void setReplaceAllowed(boolean allowReplace)
If the operation is an edit, this sets whether the operation is allowed to replace objects in the database rather than just update. This should only be set as a result of an explicit confirmation by the user that replace is allowed.

Parameters:
allowReplace - true if the api can replace objects rather than just update them.

isReplaceAllowed

public boolean isReplaceAllowed()
Tests whether the commit is allowed to replace existing objects (drop/create) rather than just update them.

Returns:
true if the commit can replace existing objects.

setCommitToProvider

public void setCommitToProvider(boolean commit)
Sets whether the dialog should commit any changes to the underlying DBObjectProvider on exit, or just update the memory model.

Parameters:
commit - whether to commit changes to the provider

isCommitToProvider

public boolean isCommitToProvider()
Tests whether this dialog invocation should commit any changes to the underlying DBObjectProvider on exit.

Returns:
true if the dialog should commit the changes to the provider.

setChildObject

public void setChildObject(DBObject childObject)
Sets the child object. If isChildEditOnly() then the launched dialog will be solely for this object. When editing, during creation of the config (i.e. before launch) this should be a child of the originalObject.

Parameters:
childObject - a child of the original object to edit.

getChildObject

public DBObject getChildObject()
Gets the child object being edited (if there is one).

Returns:
a child of the SystemObject returned by getNewObject()

setSchema

public void setSchema(Schema schema)
Sets the default schema to use in the dialog for any schema pickers.

Parameters:
schema - a schema in the underlying DBObjectProvider to use by default when picking a schema.

getSchema

public Schema getSchema()
Gets the schema for the current dialog. If this hasn't explictly been set using setSchema this will query (and remember) the default schema for the underlying DBObjectProvider.

Returns:
the default Schema to use in the dialog

setSchemaList

public void setSchemaList(Schema[] schemaList)
Sets the schema list for the dialog. Note this will effect all schema pickers in the dialog.

Parameters:
schemaList - the list of schemas available to the user.

getSchemaList

public Schema[] getSchemaList()
Gets the list of Schemas to use in the dialog for any schema pickers. If this list has not been explictly set on the config using setSchemaList, this will list (and cache) the schemas visible to the current user in the underlying DBObjectProvider.

Returns:
a list of schemas to use in pickers in the dialogs.

setNewObject

public void setNewObject(SystemObject newObject)
Sets the newObject - i.e. the object being created or the updatable copy of the object being edited in the dialog.

Parameters:
newObject - the object the panels in the dialog can edit

getNewObject

public SystemObject getNewObject()
Gets the "newObject". This is the object that all edits in the dialog should commit to. For a create operation it is a new object, for an edit operation is it a temporary copy of an existing object that will be commited back by the DBObjectProvider.

Returns:
the newObject that all edits should modify.

setOriginalObject

public void setOriginalObject(SystemObject originalObject)
Sets the original object for an edit operation.


getOriginalObject

public SystemObject getOriginalObject()
For an edit operation, this returns the original objec that the DBObjectProvider has in memory. This object should not be modified.

Returns:
the original object

getAdditionalObjects

public java.util.List<SystemObject> getAdditionalObjects()
Gets any additional objects that have been created as part of the create or edit operation. For example column sequences and triggers might appear in this list when a new column sequence has been defined.

The list is modifiable so any new objects can be added to the returned list for them to be recorded in this config.

Returns:
any additional objects to create as part of the operation

setUseBackgroundTask

public void setUseBackgroundTask(boolean backgroundTask)
Not used yet.

Sets whether to do the commit as background task, rather than with a progress bar, when the user ok's the dialog.

Parameters:
backgroundTask - if true a progress bar isn't used on commit and the create or update is fired in the background instead.

isUseBackgroundTask

public boolean isUseBackgroundTask()
Not used yet.

Gets whether the commit should happen in the background, or in a progress bar

Returns:
true if the operation should be commited in the background rather than making the user wait with a cancellable progress bar.

setEditable

public void setEditable(boolean editable)
Sets whether the object should be editable or not. If this is false, all editing controls in the dialog should be disabled.

Parameters:
editable - whether the object is actually editable (e.g. the current user has permissions to alter the object).

isEditable

public boolean isEditable()
Returns true if the object in the dialog can be edited, or false if the object is read only.


setChildEditOnly

public void setChildEditOnly(boolean childEditOnly)
If there is a child object, this property governs whether the dialog launched is solely for that object, or edits the parent SystemObject and initial focus is on the child object.

Parameters:
childEditOnly -

isChildEditOnly

public boolean isChildEditOnly()
Checks whether we are editing a child object in isolation rather than within the context of the parent's edit dialog.


setResult

public void setResult(DBEditorConfig.Result dialogResult)
Sets the dialog result. Generally this will only be used internally by the dialog code to specify whether the commit was successful or not.


getResult

public DBEditorConfig.Result getResult()
Gets the dialog result. If and only if this is Result.SUCCESS then the operation has fully commited to the underlying DBObjectProvider.

Returns:
the result of the operation

setException

public void setException(DBException exception)
If the commit operation fails with a DBException, this method is used by the framework to specify the failure.

Parameters:
exception - an exception encountered on commit.

getException

public DBException getException()
If the dialog result is Result.FAILED this method will return the exception encountered in commiting to the DBObjectProvider.

Returns:
any failure exception for the commit.

setObjectType

public void setObjectType(java.lang.String objectType)
Sets the type of SystemObject that the create or edit operation is for.


getObjectType

public java.lang.String getObjectType()
Gets the type of SystemObject that the create or edit operation is for.


getOriginalObjectNode

public DBObjectNode getOriginalObjectNode()
If this config was created using a DBObjectNode representing the object to edit, this returns that node.


newEditConfig

public static DBEditorConfig newEditConfig(DBObjectNode node)
Creates a new config for launching a database object edit dialog.

Parameters:
node - the node for the object to be edited
Returns:
a new config for launching the edit object dialog
See Also:
DBEditorFactory.launchDialog(DBEditorConfig)

newEditConfig

public static DBEditorConfig newEditConfig(DBObjectProvider pro,
                                           DBObject obj)
Creates a new config for launching a database object edit dialog.

Parameters:
pro - the containing object provider
obj - the object to edit in a dialog
Returns:
a new config for launching the edit object dialog
See Also:
DBEditorFactory.launchDialog(DBEditorConfig)

newCreateConfig

public static DBEditorConfig newCreateConfig(DBObjectTypeNode node)
Creates a new config for launching a database object create dialog.

Parameters:
node - the node containing the type/schema/provider needed for the create
Returns:
a new config for launching the create object dialog
See Also:
DBEditorFactory.launchDialog(DBEditorConfig)

newCreateConfig

public static DBEditorConfig newCreateConfig(DBObjectProvider pro,
                                             java.lang.String type,
                                             Schema schema)
Creates a new config for launching a database object create dialog.

Parameters:
pro - the provider the object will be created in
type - the type of object to create
schema - the Schema to create the object in (ignored if the type is not a SchemaObject.
Returns:
a new config for launching the create object dialog
See Also:
DBEditorFactory.launchDialog(DBEditorConfig)

newCreateConfig

public static DBEditorConfig newCreateConfig(DBObjectProvider pro,
                                             DBObject obj)
Creates a new config for launching a database object create dialog.

Parameters:
pro - the provider the object will be created in
obj - a new object definition to "edit" in the dialog before commiting to the provider.
Returns:
a new config for launching the create object dialog
See Also:
DBEditorFactory.launchDialog(DBEditorConfig)

newCreateConfig

public static DBEditorConfig newCreateConfig(DBObjectProvider pro,
                                             java.lang.String type,
                                             DBObject parent)
Creates a new config for launching a database object create dialog.

Parameters:
pro - the provider the object will be created in
type - the type of object to create
parent - the parent object to create the new object under (e.g. the Table if type is Column.TYPE.
Returns:
a new config for launching the create object dialog
See Also:
DBEditorFactory.launchDialog(DBEditorConfig)

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.