public class ReturningPolicy extends Object implements Serializable, Cloneable
Purpose: Allows for INSERT or UPDATE operations to return values back into the object being written. This allows for table default values, trigger or stored procedures computed values to be set back into the object. This can be used with generated SQL on the Oracle platform using the RETURNING clause, or through stored procedures on other platforms.
Modifier and Type | Class and Description |
---|---|
static class |
ReturningPolicy.Info
INTERNAL:
|
Modifier and Type | Field and Description |
---|---|
protected static int |
ALL |
protected ClassDescriptor |
descriptor
owner of the policy
|
protected Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> |
fieldsNotFromDescriptor_DefaultTable
contains all default table the returning fields that are either unmapped or mapped supplied with types.
|
protected Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> |
fieldsNotFromDescriptor_OtherTables
contains all the other tables returning fields that are either unmapped or mapped supplied with types.
|
protected List<ReturningPolicy.Info> |
infos
Stores an object of type Info for every call to any of addField..
|
protected static int |
INSERT |
protected boolean |
isUsedToSetPrimaryKey
indicates whether ReturningPolicy is used for generation of the PK.
|
protected Collection<org.eclipse.persistence.internal.helper.DatabaseField>[][] |
main
The following attributes are initialized by initialize() method.
|
protected static int |
MAIN_SIZE |
protected static int |
MAPPED |
protected static int |
NUM_OPERATIONS |
protected static int |
RETURN_ONLY |
protected Map<org.eclipse.persistence.internal.helper.DatabaseTable,Vector<org.eclipse.persistence.internal.helper.DatabaseField>>[] |
tableToFieldsForGenerationMap
maps ClassDescriptor's tables into Vectors of fields to be used for call generation.
|
protected static int |
UNMAPPED |
protected static int |
UPDATE |
protected static int |
WRITE_RETURN |
Constructor and Description |
---|
ReturningPolicy() |
Modifier and Type | Method and Description |
---|---|
protected void |
addCollectionToMain(int operation,
int state,
Collection collection) |
protected void |
addField(org.eclipse.persistence.internal.helper.DatabaseField field,
boolean isInsert,
boolean isInsertModeReturnOnly,
boolean isUpdate)
INTERNAL:
|
void |
addFieldForInsert(org.eclipse.persistence.internal.helper.DatabaseField field)
PUBLIC:
Define that the field will be returned from an insert operation.
|
void |
addFieldForInsert(String qualifiedName)
PUBLIC:
Define that the field will be returned from an insert operation.
|
void |
addFieldForInsert(String qualifiedName,
Class type)
PUBLIC:
Define that the field will be returned from an insert operation.
|
void |
addFieldForInsertReturnOnly(org.eclipse.persistence.internal.helper.DatabaseField field)
PUBLIC:
Define that the field will be returned from an insert operation.
|
void |
addFieldForInsertReturnOnly(String qualifiedName)
PUBLIC:
Define that the field will be returned from an insert operation.
|
void |
addFieldForInsertReturnOnly(String qualifiedName,
Class type)
PUBLIC:
Define that the field will be returned from an insert operation.
|
void |
addFieldForUpdate(org.eclipse.persistence.internal.helper.DatabaseField field)
PUBLIC:
Define that the field will be returned from an update operation.
|
void |
addFieldForUpdate(String qualifiedName)
PUBLIC:
Define that the field will be returned from an update operation.
|
void |
addFieldForUpdate(String qualifiedName,
Class type)
PUBLIC:
Define that the field will be returned from an update operation.
|
protected void |
addFieldToMain(int operation,
int state,
org.eclipse.persistence.internal.helper.DatabaseField field) |
protected void |
addMappedFieldToMain(org.eclipse.persistence.internal.helper.DatabaseField field,
ReturningPolicy.Info info) |
protected void |
addUnmappedFieldToMain(org.eclipse.persistence.internal.helper.DatabaseField field,
ReturningPolicy.Info info) |
static boolean |
areCollectionsEqualAsSets(Collection col1,
Collection col2)
INTERNAL:
Compares two Collections as sets (ignoring the order of the elements).
|
protected void |
clearInitialization() |
Object |
clone()
INTERNAL:
Normally cloned when not yet initialized.
|
protected void |
copyMainFrom(ReturningPolicy policy) |
protected Collection |
createCollection()
INTERNAL:
|
protected org.eclipse.persistence.internal.helper.DatabaseField |
createField(String qualifiedName,
Class type)
INTERNAL:
|
protected void |
fieldIsNotFromDescriptor(org.eclipse.persistence.internal.helper.DatabaseField field)
INTERNAL:
|
ClassDescriptor |
getDescriptor()
PUBLIC:
Return the owner of the policy.
|
org.eclipse.persistence.internal.helper.DatabaseField |
getField(org.eclipse.persistence.internal.helper.DatabaseField field)
INTERNAL:
Returns an equal field held by ReturningPolicy, or null.
|
List<ReturningPolicy.Info> |
getFieldInfos()
INTERNAL:
|
Vector |
getFieldsToGenerateInsert(org.eclipse.persistence.internal.helper.DatabaseTable table)
INTERNAL:
|
Vector |
getFieldsToGenerateUpdate(org.eclipse.persistence.internal.helper.DatabaseTable table)
INTERNAL:
|
Collection<org.eclipse.persistence.internal.helper.DatabaseField> |
getFieldsToMergeInsert()
INTERNAL:
|
Collection<org.eclipse.persistence.internal.helper.DatabaseField> |
getFieldsToMergeUpdate()
INTERNAL:
|
protected Vector<org.eclipse.persistence.internal.helper.DatabaseField> |
getVectorOfFieldsToGenerate(int operation,
org.eclipse.persistence.internal.helper.DatabaseTable table)
INTERNAL:
|
boolean |
hasEqualFieldInfos(List<ReturningPolicy.Info> infosToCompare)
INTERNAL:
Used for testing only
|
boolean |
hasEqualFieldInfos(ReturningPolicy returningPolicyToCompare)
INTERNAL:
Used for testing only
|
boolean |
hasEqualMains(ReturningPolicy policy)
INTERNAL:
Both ReturningPolicies should be initialized
|
void |
initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:
|
protected void |
initializeIsUsedToSetPrimaryKey() |
protected static boolean |
isThereATypeConflict(org.eclipse.persistence.internal.helper.DatabaseField field1,
org.eclipse.persistence.internal.helper.DatabaseField field2)
INTERNAL:
|
boolean |
isUsedToSetPrimaryKey()
PUBLIC:
|
protected Hashtable |
removeDuplicateAndValidateInfos(org.eclipse.persistence.internal.sessions.AbstractSession session) |
void |
setDescriptor(ClassDescriptor descriptor)
INTERNAL:
|
void |
setFieldInfos(List<ReturningPolicy.Info> infos)
INTERNAL:
|
protected void |
trimModifyRow(org.eclipse.persistence.internal.sessions.AbstractRecord modifyRow,
int operation) |
void |
trimModifyRowForInsert(org.eclipse.persistence.internal.sessions.AbstractRecord modifyRow)
INTERNAL:
|
void |
validationAfterDescriptorInitialization(org.eclipse.persistence.internal.sessions.AbstractSession session)
INTERNAL:
|
protected static boolean |
verifyField(org.eclipse.persistence.internal.sessions.AbstractSession session,
org.eclipse.persistence.internal.helper.DatabaseField field,
ClassDescriptor descriptor) |
protected boolean |
verifyFieldAndMapping(org.eclipse.persistence.internal.sessions.AbstractSession session,
org.eclipse.persistence.internal.helper.DatabaseField field) |
protected static boolean |
verifyFieldAndMapping(org.eclipse.persistence.internal.sessions.AbstractSession session,
org.eclipse.persistence.internal.helper.DatabaseField field,
ClassDescriptor descriptor,
DatabaseMapping mapping) |
protected static final int INSERT
protected static final int UPDATE
protected static final int NUM_OPERATIONS
protected static final int RETURN_ONLY
protected static final int WRITE_RETURN
protected static final int MAPPED
protected static final int UNMAPPED
protected static final int ALL
protected static final int MAIN_SIZE
protected ClassDescriptor descriptor
protected List<ReturningPolicy.Info> infos
protected Collection<org.eclipse.persistence.internal.helper.DatabaseField>[][] main
main[INSERT][RETURN_ONLY] main[INSERT][WRITE_RETURN] main[INSERT][MAPPED] main[INSERT][UNMAPPED] main[INSERT][ALL] main[UPDATE][RETURN_ONLY] main[UPDATE][WRITE_RETURN] main[UPDATE][MAPPED] main[UPDATE][UNMAPPED] main[UPDATE][ALL]After initialization main[UPDATE,WRITE_RETURN] will contain all DatabaseFields that should be returned on Update as read-write.
main[i][RETURN_ONLY] + main[i][WRITE_RETURN] = main[i][MAPPED] main[i][MAPPED] + main[i][UNMAPPED] = main[i][ALL]
protected Map<org.eclipse.persistence.internal.helper.DatabaseTable,Vector<org.eclipse.persistence.internal.helper.DatabaseField>>[] tableToFieldsForGenerationMap
protected boolean isUsedToSetPrimaryKey
protected Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> fieldsNotFromDescriptor_DefaultTable
protected Map<org.eclipse.persistence.internal.helper.DatabaseField,org.eclipse.persistence.internal.helper.DatabaseField> fieldsNotFromDescriptor_OtherTables
public ClassDescriptor getDescriptor()
protected void fieldIsNotFromDescriptor(org.eclipse.persistence.internal.helper.DatabaseField field)
public Vector getFieldsToGenerateInsert(org.eclipse.persistence.internal.helper.DatabaseTable table)
public Vector getFieldsToGenerateUpdate(org.eclipse.persistence.internal.helper.DatabaseTable table)
public List<ReturningPolicy.Info> getFieldInfos()
public void setFieldInfos(List<ReturningPolicy.Info> infos)
public boolean hasEqualFieldInfos(ReturningPolicy returningPolicyToCompare)
public boolean hasEqualFieldInfos(List<ReturningPolicy.Info> infosToCompare)
public static boolean areCollectionsEqualAsSets(Collection col1, Collection col2)
protected Vector<org.eclipse.persistence.internal.helper.DatabaseField> getVectorOfFieldsToGenerate(int operation, org.eclipse.persistence.internal.helper.DatabaseTable table)
public Collection<org.eclipse.persistence.internal.helper.DatabaseField> getFieldsToMergeInsert()
public Collection<org.eclipse.persistence.internal.helper.DatabaseField> getFieldsToMergeUpdate()
public Object clone()
public void setDescriptor(ClassDescriptor descriptor)
public void addFieldForInsert(String qualifiedName)
public void addFieldForInsert(String qualifiedName, Class type)
public void addFieldForInsert(org.eclipse.persistence.internal.helper.DatabaseField field)
public void addFieldForInsertReturnOnly(String qualifiedName)
public void addFieldForInsertReturnOnly(String qualifiedName, Class type)
public void addFieldForInsertReturnOnly(org.eclipse.persistence.internal.helper.DatabaseField field)
public void addFieldForUpdate(String qualifiedName)
public void addFieldForUpdate(String qualifiedName, Class type)
public void addFieldForUpdate(org.eclipse.persistence.internal.helper.DatabaseField field)
protected void addField(org.eclipse.persistence.internal.helper.DatabaseField field, boolean isInsert, boolean isInsertModeReturnOnly, boolean isUpdate)
protected static boolean isThereATypeConflict(org.eclipse.persistence.internal.helper.DatabaseField field1, org.eclipse.persistence.internal.helper.DatabaseField field2)
protected org.eclipse.persistence.internal.helper.DatabaseField createField(String qualifiedName, Class type)
protected Collection createCollection()
protected void addFieldToMain(int operation, int state, org.eclipse.persistence.internal.helper.DatabaseField field)
protected void addCollectionToMain(int operation, int state, Collection collection)
protected void addMappedFieldToMain(org.eclipse.persistence.internal.helper.DatabaseField field, ReturningPolicy.Info info)
protected void addUnmappedFieldToMain(org.eclipse.persistence.internal.helper.DatabaseField field, ReturningPolicy.Info info)
protected Hashtable removeDuplicateAndValidateInfos(org.eclipse.persistence.internal.sessions.AbstractSession session)
public void initialize(org.eclipse.persistence.internal.sessions.AbstractSession session)
protected void copyMainFrom(ReturningPolicy policy)
public boolean hasEqualMains(ReturningPolicy policy)
public void trimModifyRowForInsert(org.eclipse.persistence.internal.sessions.AbstractRecord modifyRow)
protected void trimModifyRow(org.eclipse.persistence.internal.sessions.AbstractRecord modifyRow, int operation)
public boolean isUsedToSetPrimaryKey()
protected void clearInitialization()
protected void initializeIsUsedToSetPrimaryKey()
protected boolean verifyFieldAndMapping(org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.helper.DatabaseField field)
protected static boolean verifyFieldAndMapping(org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.helper.DatabaseField field, ClassDescriptor descriptor, DatabaseMapping mapping)
protected static boolean verifyField(org.eclipse.persistence.internal.sessions.AbstractSession session, org.eclipse.persistence.internal.helper.DatabaseField field, ClassDescriptor descriptor)
public void validationAfterDescriptorInitialization(org.eclipse.persistence.internal.sessions.AbstractSession session)
public org.eclipse.persistence.internal.helper.DatabaseField getField(org.eclipse.persistence.internal.helper.DatabaseField field)
Copyright © 2007–2020 Eclipse.org - EclipseLink Project. All rights reserved.