org.eclipse.datatools.sqltools.schemaobjecteditor.model
Class AbstractSchemaObjectEditModel

java.lang.Object
  extended by org.eclipse.datatools.sqltools.schemaobjecteditor.model.AbstractSchemaObjectEditModel
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, ISchemaObjectEditModel
Direct Known Subclasses:
ASATableSchemaEditModel, ASAUserDefinedTypeObjectEditModel, ProceduralObjectEditModel

public abstract class AbstractSchemaObjectEditModel
extends java.lang.Object
implements ISchemaObjectEditModel

The class is resoponsible for cloning SQL objects for edit purpose.

Author:
Idull

Field Summary
 
Fields inherited from interface org.eclipse.datatools.sqltools.schemaobjecteditor.model.ISchemaObjectEditModel
ERROR_REFRESH_ADDITIONAL_OBJ, FATAL_ERROR_MAIN_OBJ_LOST, REFRESH_SUCCESSFUL
 
Constructor Summary
AbstractSchemaObjectEditModel(ISchemaObjectImmutableModel model, org.eclipse.datatools.sqltools.core.DatabaseIdentifier databaseIdentifier)
           
 
Method Summary
 boolean checkModelExistence()
          Check model existence
 java.util.Map getAdditionalSQLObjects()
          Returns the additional SQL objects, the items defined here should has an onte-to-one relationship with those additional SQL objects defined in ISchemaObjectImmutableModel
 java.lang.String getBackupedDDL()
          if the Main SQLObject is lost, to call the method to get the backuped DDL.
 org.eclipse.emf.ecore.util.EcoreUtil.Copier getCopier()
          Returns the copier
 java.lang.String getDeltaDDL()
          Sub class should override this method to return the delta ddl
 java.lang.String getEditorTooltipText()
          Returns the tooltip text for the editor in which this edit model is being edited
 SQLObject getMainSQLObject()
          Returns the underlying SQL object
 ISchemaObjectImmutableModel getSchemaObjectImmutableModel()
          Returns the immutable model of this edit model
 int refreshFromDB()
          After the model is refreshed, should re-clone these objects
 void revert()
          Reverts the edit model using the immutable model
 void startLogging()
          Starts logging, this can be manually called when the editing is started.
 void stopLogging()
          Stops logging, this should be manually called when the editing is finished
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Constructor Detail

AbstractSchemaObjectEditModel

public AbstractSchemaObjectEditModel(ISchemaObjectImmutableModel model,
                                     org.eclipse.datatools.sqltools.core.DatabaseIdentifier databaseIdentifier)
Method Detail

getAdditionalSQLObjects

public java.util.Map getAdditionalSQLObjects()
Description copied from interface: ISchemaObjectEditModel
Returns the additional SQL objects, the items defined here should has an onte-to-one relationship with those additional SQL objects defined in ISchemaObjectImmutableModel

Specified by:
getAdditionalSQLObjects in interface ISchemaObjectEditModel
Returns:

getCopier

public org.eclipse.emf.ecore.util.EcoreUtil.Copier getCopier()
Description copied from interface: ISchemaObjectEditModel
Returns the copier

Specified by:
getCopier in interface ISchemaObjectEditModel
Returns:

getMainSQLObject

public SQLObject getMainSQLObject()
Description copied from interface: ISchemaObjectEditModel
Returns the underlying SQL object

Specified by:
getMainSQLObject in interface ISchemaObjectEditModel
Returns:

getSchemaObjectImmutableModel

public ISchemaObjectImmutableModel getSchemaObjectImmutableModel()
Description copied from interface: ISchemaObjectEditModel
Returns the immutable model of this edit model

Specified by:
getSchemaObjectImmutableModel in interface ISchemaObjectEditModel
Returns:

refreshFromDB

public int refreshFromDB()
After the model is refreshed, should re-clone these objects

Specified by:
refreshFromDB in interface ISchemaObjectEditModel
Returns:
0 if successfully refresh, returns error code otherwise
See Also:
ISchemaObjectEditModel.FATAL_ERROR_MAIN_OBJ_LOST, ISchemaObjectEditModel.ERROR_REFRESH_ADDITIONAL_OBJ

revert

public void revert()
Description copied from interface: ISchemaObjectEditModel
Reverts the edit model using the immutable model

Specified by:
revert in interface ISchemaObjectEditModel

checkModelExistence

public boolean checkModelExistence()
Description copied from interface: ISchemaObjectEditModel
Check model existence

Specified by:
checkModelExistence in interface ISchemaObjectEditModel

startLogging

public void startLogging()
Description copied from interface: ISchemaObjectEditModel
Starts logging, this can be manually called when the editing is started. And it is called after the model is cloned.

Specified by:
startLogging in interface ISchemaObjectEditModel

stopLogging

public void stopLogging()
Description copied from interface: ISchemaObjectEditModel
Stops logging, this should be manually called when the editing is finished

Specified by:
stopLogging in interface ISchemaObjectEditModel

getDeltaDDL

public java.lang.String getDeltaDDL()
Sub class should override this method to return the delta ddl

Specified by:
getDeltaDDL in interface ISchemaObjectEditModel
Returns:

getEditorTooltipText

public java.lang.String getEditorTooltipText()
Description copied from interface: ISchemaObjectEditModel
Returns the tooltip text for the editor in which this edit model is being edited

Specified by:
getEditorTooltipText in interface ISchemaObjectEditModel
Returns:

getBackupedDDL

public java.lang.String getBackupedDDL()
if the Main SQLObject is lost, to call the method to get the backuped DDL.

Returns: