PATH |
EOSynchronizationFactory
Inherits from: Object
Implements: EOSchemaGeneration, EOSchemaSynchronization
Package: com.webobjects.eoaccess
Class Description
This class has been introduced to implement the new interfaces, EOSchemaGeneration and EOSchemaSynchronization. The methods used to be declared and implemented in EOSQLExpression. The 5.0 API is essentially the same. The only difference is that in 4.5 the methods were methods. In 5.0 the methods are instance methods. See the EOSchemaGeneration and EOSchemaSynchronization sections for more information.
Method Types
Constructors EOSynchronizationFactory Creating a schema generation script schemaCreationScriptForEntities schemaCreationStatementsForEntities appendExpressionToScript createTableStatementsForEntityGroup createTableStatementsForEntityGroups dropTableStatementsForEntityGroup dropTableStatementsForEntityGroups primaryKeyConstraintStatementsForEntityGroup primaryKeyConstraintStatementsForEntityGroups primaryKeySupportStatementsForEntityGroup primaryKeySupportStatementsForEntityGroups dropPrimaryKeySupportStatementsForEntityGroup dropPrimaryKeySupportStatementsForEntityGroups foreignKeyConstraintStatementsForRelationship createDatabaseStatementsForConnectionDictionary dropDatabaseStatementsForConnectionDictionary Synchronizing the database with a model statementsToUpdateObjectStoreForModel statementsToUpdateObjectStoreForEntityGroups statementsToCopyTableNamed phraseCastingColumnNamed statementsToRenameTableNamed statementsToInsertColumnForAttribute statementsToDeleteColumnNamed statementsToRenameColumnNamed statementsToConvertColumnType isColumnTypeEquivalentToColumnType statementsToDropForeignKeyConstraintsOnEntityGroups statementsToDropPrimaryKeyConstraintsOnEntityGroups statementsToDropPrimaryKeySupportForEntityGroups statementsToImplementForeignKeyConstraintsOnEntityGroups statementsToImplementPrimaryKeyConstraintsOnEntityGroups statementsToImplementPrimaryKeySupportForEntityGroups Querying about database synchronization support supportsSchemaSynchronization supportsDirectColumnCoercion supportsDirectColumnDeletion supportsDirectColumnInsertion supportsDirectColumnNullRuleModification supportsDirectColumnRenaming
Constructors
EOSynchronizationFactory
public EOSynchronizationFactory(EOAdaptor adaptor)
Instance Methods
appendExpressionToScript
public void appendExpressionToScript( EOSQLExpression anSQLExpression, StringBuffer script)
See Also: createTableStatementsForEntityGroup
createDatabaseStatementsForConnectionDictionary
public NSArray createDatabaseStatementsForConnectionDictionary( NSDictionary connectionDictionary, NSDictionary adminDictionary)
See Also: dropDatabaseStatementsForConnectionDictionary
createTableStatementsForEntityGroup
public NSArray createTableStatementsForEntityGroup(NSArray entityGroup)
EOSQLExpression's implementation does the following:
- Creates an EOSQLExpression object.
- Sets the expression's entity to the first entity in entityGroup.
- Adds a create clause for each Attribute in entityGroup's Entities.
- Sets the expression's statement to CREATE TABLE TABLE_NAME (LIST_STRING), where TABLE_NAME is the externalName of the Entity objects in entityGroup and LIST_STRING is the expression's listString.
- Adds the expression to an array.
- Returns the array.
The following is an example of a CREATE TABLE statement produced by the default implementation:
create table EMPLOYEE ( EMP_ID int not null, DEPT_ID int null, LAST_NAME varchar(40) not null, PHONE char(12) null, HIRE_DATE date null, SALARY number(7, 2) null )
If a subclass's database server's table creation semantics are different, the subclass should override this method or one or more of the following methods as appropriate:
- addCreateClauseForAttribute
- columnTypeStringForAttribute
- allowsNullClauseForConstraint
See Also: createTableStatementsForEntityGroup, dropTableStatementsForEntityGroup
createTableStatementsForEntityGroups
public NSArray createTableStatementsForEntityGroups(NSArray entityGroups)
null
or empty. EOSQLExpression's implementation invokes createTableStatementsForEntityGroup for each entity group in entityGroups and returns an array of all the resulting EOSQLExpressions.
See Also: schemaCreationStatementsForEntities
dropDatabaseStatementsForConnectionDictionary
public NSArray dropDatabaseStatementsForConnectionDictionary( NSDictionary connectionDictionary, NSDictionary adminDictionary)
See Also: createDatabaseStatementsForConnectionDictionary
dropPrimaryKeySupportStatementsForEntityGroup
public NSArray dropPrimaryKeySupportStatementsForEntityGroup(NSArray entityGroup)
EOSQLExpression's implementation creates a statement of the following form:
drop sequence SEQUENCE_NAME
Where SEQUENCE_NAME is the primaryKeyRootName for the first entity in entityGroup concatenated with "_SEQ" (EMP_ID_SEQ, for example).
If a subclass uses a different primary key generation mechanism or if the subclass's database server's drop semantics are different, the subclass should override this method.
dropPrimaryKeySupportStatementsForEntityGroups
public NSArray dropPrimaryKeySupportStatementsForEntityGroups(NSArray entityGroups)
See Also: schemaCreationStatementsForEntities
dropTableStatementsForEntityGroup
public NSArray dropTableStatementsForEntityGroup(NSArray entityGroup)
EOSQLExpression's implementation creates a statement of the following form:
DROP TABLE TABLE_NAME
Where TABLE_NAME is the externalName of the first entity in entityGroup.
If a subclass's database server's drop semantics are different, the subclass should override this method.
dropTableStatementsForEntityGroups
public NSArray dropTableStatementsForEntityGroups(NSArray entityGroups)
See Also: schemaCreationStatementsForEntities
foreignKeyConstraintStatementsForRelationship
public NSArray foreignKeyConstraintStatementsForRelationship(EORelationship aRelationship)
ALTER TABLE EMPLOYEE ADD CONSTRAINT TO_DEPARTMENT FOREIGN KEY (DEPT_ID) REFERENCES DEPARTMENT(DEPT_ID)
It returns an empty array if either of the following are true:
- aRelationship spans models (if aRelationship's destinationEntity is in a different model than aRelationship's source entity)
- aRelationship is a to-many relationship, or if the inverse relationship of aRelationship is not a to-many. In other words, foreign key constraint statements are only created for to-one relationships whose inverse is a to-many.
If a subclass's database server's foreign key constraint semantics are different, the subclass should override this method or override the method prepareConstraintStatementForRelationship:sourceColumns:destinationColumns:.
See Also: schemaCreationStatementsForEntities
isCaseSensitive
public boolean isCaseSensitive()
isColumnTypeEquivalentToColumnType
public boolean isColumnTypeEquivalentToColumnType( EOSchemaSynchronization.ColumnTypes columnTypeA, EOSchemaSynchronization.ColumnTypes columnTypeB, NSDictionary options)
true
if values in a column of columnTypeA can be copied into a column of columnTypeB without the use of a casting phrase, false
otherwise. The options dictionary describes the aspects of the schema for which to create SQL statements; for more information, see "The Options Dictionary" (page 306).
logicalErrorsInChangeDictionaryForModelOptions
public NSArray logicalErrorsInChangeDictionaryForModelOptions( NSDictionary, EOModel, NSDictionary)
objectStoreChangesFromAttributeToAttribute
public NSDictionary objectStoreChangesFromAttributeToAttribute( EOAttribute anAttribute, EOAttribute anotherAttribute)
phraseCastingColumnNamed
public String phraseCastingColumnNamed( String columnName, EOSchemaSynchronization.ColumnTypes fromType, EOSchemaSynchronization.ColumnTypes castType NSDictionary options)
primaryKeyConstraintStatementsForEntityGroup
public NSArray primaryKeyConstraintStatementsForEntityGroup(NSArray entityGroup)
EOSQLExpression's implementation creates a statement of the following form:
ALTER TABLE TABLE_NAME ADD PRIMARY KEY (PRIMARY_KEY_COLUMN_NAMES)
Where TABLE_NAME is the externalName for the first entity in entityGroup and PRIMARY_KEY_COLUMN_NAMES is a comma-separated list of the columnNames of the first entity's primaryKeyAttributes.
If the subclass's database server's primary key constraint semantics are different, the subclass should override this method.
primaryKeyConstraintStatementsForEntityGroups
public NSArray primaryKeyConstraintStatementsForEntityGroups(NSArray entityGroups)
primaryKeySupportStatementsForEntityGroup
public NSArray primaryKeySupportStatementsForEntityGroup(NSArray entityGroup)
create sequence SEQUENCE_NAME
Where SEQUENCE_NAME is the primaryKeyRootName for the first entity in entityGroup concatenated with "_SEQ" (EMP_ID_SEQ, for example).
If a subclass uses a different primary key generation mechanism or if the subclass's database server's drop semantics are different, the subclass should override this method.
See Also: dropPrimaryKeySupportStatementsForEntityGroup, primaryKeyForNewRowWithEntity (EOAdaptorChannel)
primaryKeySupportStatementsForEntityGroups
public NSArray primaryKeySupportStatementsForEntityGroups(NSArray entityGroups)
schemaCreationScriptForEntities
public String schemaCreationScriptForEntities( NSArray entities, NSDictionary options)
schemaCreationStatementsForEntities
public NSArray schemaCreationStatementsForEntities( NSArray entities, NSDictionary options)
EOSQLExpression's implementation uses the following methods:
- createTableStatementsForEntityGroups
- dropTableStatementsForEntityGroups
- primaryKeySupportStatementsForEntityGroups
- dropPrimaryKeySupportStatementsForEntityGroups
- primaryKeyConstraintStatementsForEntityGroups
- foreignKeyConstraintStatementsForRelationship
to generate EOSQLExpressions for the support identified in options.
See Also: schemaCreationScriptForEntities
schemaSynchronizationDelegate
public EOSynchronizationFactory.Delegate schemaSynchronizationDelegate()
setSchemaSynchronizationDelegate
public void setSchemaSynchronizationDelegate( EOSynchronizationFactory.Delegate aDelegate)
statementsToConvertColumnType
public NSArray statementsToConvertColumnType( String columnName, String tableName, EOSchemaSynchronization.ColumnTypes type, EOSchemaSynchronization.ColumnTypes newType, NSDictionary options)
statementsToCopyTableNamed
public NSArray statementsToCopyTableNamed( String tableName, NSArray entityGroup, NSDictionary changes, NSDictionary options)
The changes dictionary identifies the changes to make to the database schema; for more information, see "The Change Dictionary" (page 306). The options dictionary describes the aspects of the schema for which to create SQL statements; for more information, see "The Options Dictionary" (page 306).
statementsToDeleteColumnNamed
public NSArray statementsToDeleteColumnNamed( String columnName, String tableName, NSDictionary options)
statementsToDropForeignKeyConstraintsOnEntityGroups
public NSArray statementsToDropForeignKeyConstraintsOnEntityGroups( NSArray entityGroup, NSDictionary changes, NSDictionary options)
statementsToDropPrimaryKeyConstraintsOnEntityGroups
public NSArray statementsToDropPrimaryKeyConstraintsOnEntityGroups( NSArray entityGroup, NSDictionary changes, NSDictionary options)
statementsToDropPrimaryKeySupportForEntityGroups
public NSArray statementsToDropPrimaryKeySupportForEntityGroups( NSArray entityGroup, NSDictionary changes, NSDictionary options)
statementsToImplementForeignKeyConstraintsOnEntityGroups
public NSArray statementsToImplementForeignKeyConstraintsOnEntityGroups( NSArray entityGroup, NSDictionary changes, NSDictionary options)
statementsToImplementPrimaryKeyConstraintsOnEntityGroups
public NSArray statementsToImplementPrimaryKeyConstraintsOnEntityGroups( NSArray entityGroup, NSDictionary changes, NSDictionary options)
statementsToImplementPrimaryKeySupportForEntityGroups
public NSArray statementsToImplementPrimaryKeySupportForEntityGroups( NSArray entityGroup, NSDictionary changes, NSDictionary options)
statementsToInsertColumnForAttribute
public NSArray statementsToInsertColumnForAttribute( EOAttribute attribute, NSDictionary options)
statementsToModifyColumnNullRule
public NSArray statementsToModifyColumnNullRule( String, String, boolean, NSDictionary)
statementsToRenameColumnNamed
public NSArray statementsToRenameColumnNamed( String columnName, String tableName, String newName, NSDictionary options)
statementsToRenameTableNamed
public NSArray statementsToRenameTableNamed( String tableName, String newName, NSDictionary options)
statementsToUpdateObjectStoreForEntityGroups
public NSArray statementsToUpdateObjectStoreForEntityGroups( NSArray entityGroup, NSDictionary changes, NSDictionary options)
statementsToUpdateObjectStoreForModel
public NSArray statementsToUpdateObjectStoreForModel( EOModel model, NSDictionary changes, NSDictionary options)
supportsDirectColumnCoercion
public boolean supportsDirectColumnCoercion()
true
if the adaptor can change the type of an existing column in place, false
otherwise.
supportsDirectColumnDeletion
public boolean supportsDirectColumnDeletion()
true
if the adaptor can delete columns, false
otherwise.
supportsDirectColumnInsertion
public boolean supportsDirectColumnInsertion()
true
if the adaptor can add columns to a table, false
otherwise.
supportsDirectColumnNullRuleModification
public boolean supportsDirectColumnNullRuleModification()
true
if the adaptor can modify the null rule of an existing column in place, false
otherwise.
supportsDirectColumnRenaming
public boolean supportsDirectColumnRenaming()
true
if the adaptor can rename table columns, false
otherwise.
supportsSchemaSynchronization
public boolean supportsSchemaSynchronization()
true
if the adaptor can update the database to reflect changes in a model, false
otherwise.
isCaseSensitive
public boolean isCaseSensitive()
logicalErrorsInChangeDictionaryForModelOptions
public NSArray logicalErrorsInChangeDictionaryForModelOptions( NSDictionary changes, EOModel model, NSDictionary options)
objectStoreChangesFromAttributeToAttribute
public NSDictionary objectStoreChangesFromAttributeToAttribute(EOAttribute schemaAttribute, EOAttribute modelAttribute)
schemaSynchronizationDelegate
public Delegate schemaSynchronizationDelegate()
setSchemaSynchronizationDelegate
public void setSchemaSynchronizationDelegate(Delegate delegate)
tableEntityGroupsForEntities
public NSArray tableEntityGroupsForEntities(NSArray entities)
© 2001 Apple Computer, Inc. (Last Published April 13, 2001)