Methods Summary |
---|
public void | addAdditionChange(java.util.HashMap additions, java.util.HashMap databaseCount)This method takes a hastable of primitive objects and adds them to the add list.
the hashtable stores the number of times the object is in the list
Iterator enumtr = additions.keySet().iterator();
while (enumtr.hasNext()) {
Object object = enumtr.next();
if (databaseCount.containsKey(object)){
getCommitAddMap().put(object, databaseCount.get(object));
}
addAdditionChange(object, (Integer)additions.get(object));
}
|
public void | addAdditionChange(java.lang.Object key, java.lang.Integer count)This method takes a single addition value and records it.
if (getRemoveObjectMap().containsKey(key)){
int removeValue = ((Integer)getRemoveObjectMap().get(key)).intValue();
int addition = count.intValue();
int result = removeValue - addition;
if (result > 0 ) { // more removes still
getRemoveObjectMap().put(key, new Integer(result));
}else if (result < 0) { // more adds now
getRemoveObjectMap().remove(key);
getAddObjectMap().put(key, new Integer(Math.abs(result)));
}else{ // equal
getRemoveObjectMap().remove(key);
}
}else{
if (this.getAddObjectMap().containsKey(key)){
int addValue = ((Integer)this.getAddObjectMap().get(key)).intValue();
addValue += count.intValue();
this.getAddObjectMap().put(key, new Integer(addValue));
}else{
this.getAddObjectMap().put(key, count);
}
}
// this is an attribute change track add keep count
int addValue = count.intValue();
int commitValue = 0;
if (getCommitAddMap().containsKey(key)){
commitValue = ((Integer)getCommitAddMap().get(key)).intValue();
}
getCommitAddMap().put(key, new Integer(addValue+commitValue));
|
public void | addRemoveChange(java.util.HashMap additions, java.util.HashMap databaseCount)This method takes a hashtable of primitive objects and adds them to the remove list.
Each reference in the hashtable lists the number of this object that needs to be removed from the
collection.
Iterator enumtr = additions.keySet().iterator();
while (enumtr.hasNext()) {
Object object = enumtr.next();
if (databaseCount.containsKey(object)){
getCommitAddMap().put(object, databaseCount.get(object));
}
addRemoveChange(object, (Integer)additions.get(object));
}
|
public void | addRemoveChange(java.lang.Object key, java.lang.Integer count)This method takes a single remove change and integrates it with this changeset
if (getAddObjectMap().containsKey(key)){
int removeValue = ((Integer)getAddObjectMap().get(key)).intValue();
int addition = count.intValue();
int result = removeValue - addition;
if (result > 0 ) { // more removes still
getAddObjectMap().put(key, new Integer(result));
}else if (result < 0) { // more adds now
getAddObjectMap().remove(key);
getRemoveObjectMap().put(key, new Integer(Math.abs(result)));
}else{ // equal
getAddObjectMap().remove(key);
}
}else{
if (this.getRemoveObjectMap().containsKey(key)){
int addValue = ((Integer)this.getRemoveObjectMap().get(key)).intValue();
addValue += count.intValue();
this.getRemoveObjectMap().put(key, new Integer(addValue));
}else{
this.getRemoveObjectMap().put(key, count);
}
}
int removeValue = count.intValue();
int commitValue = 0;
if (getCommitAddMap().containsKey(key)){
commitValue = ((Integer)getCommitAddMap().get(key)).intValue();
}
getCommitAddMap().put(key, new Integer(commitValue - removeValue));
|
public java.util.Vector | getAddObjectList()ADVANCED:
This method returns the list of added objects
Vector vector = new Vector();
for (Iterator iterator = getAddObjectMap().keySet().iterator(); iterator.hasNext();){
Object object = iterator.next();
int count = ((Integer)getAddObjectMap().get(object)).intValue();
while (count > 0){
vector.add(object);
--count;
}
}
return vector;
|
public java.util.HashMap | getAddObjectMap()ADVANCED:
This method returns the collection of objects that were added to the collection.
if (this.addObjectMap == null) {
this.addObjectMap = new HashMap(1);
}
return addObjectMap;
|
public java.util.HashMap | getCommitAddMap()ADVANCED:
This method returns the collection of objects that were added to the collection.
if (this.commitAddMap == null) {
this.commitAddMap = new HashMap(1);
}
return commitAddMap;
|
public java.lang.Object | getLatestCollection()Used for change tracking when cutomer sets entire collection
This is the last collection that was set on the object
return latestCollection;
|
public java.lang.Object | getOriginalCollection()Used for change tracking when cutomer sets entire collection
This is the original collection that was set on the object when it was cloned
return originalCollection;
|
public java.util.Vector | getRemoveObjectList()ADVANCED:
This method returns the list of removed objects
Vector vector = new Vector();
for (Iterator iterator = getRemoveObjectMap().keySet().iterator(); iterator.hasNext();){
Object object = iterator.next();
int count = ((Integer)getRemoveObjectMap().get(object)).intValue();
while (count > 0){
vector.add(object);
--count;
}
}
return vector;
|
public java.util.HashMap | getRemoveObjectMap()ADVANCED:
This method returns the collection of objects that were removed from the collection.
if (this.removeObjectMap == null) {
removeObjectMap = new HashMap(1);
}
return removeObjectMap;
|
public boolean | hasChanges()returns true if the change set has changes
return (!(getAddObjectMap().isEmpty() && getRemoveObjectMap().isEmpty())) || getOwner().isNew();
|
public void | mergeRecord(oracle.toplink.essentials.internal.sessions.ChangeRecord mergeFromRecord, oracle.toplink.essentials.internal.sessions.UnitOfWorkChangeSet mergeToChangeSet, oracle.toplink.essentials.internal.sessions.UnitOfWorkChangeSet mergeFromChangeSet)INTERNAL:
This method will be used to merge one record into another
HashMap addMapToMerge = ((DirectCollectionChangeRecord)mergeFromRecord).getAddObjectMap();
HashMap removeMapToMerge = ((DirectCollectionChangeRecord)mergeFromRecord).getRemoveObjectMap();
//merge additions
for (Iterator iterator = addMapToMerge.keySet().iterator(); iterator.hasNext();){
Object added = iterator.next();
if (!((DirectCollectionChangeRecord)mergeFromRecord).getCommitAddMap().containsKey(added)){
// we have not recorded a change of this type in this class before so add it
this.getCommitAddMap().put(added, ((DirectCollectionChangeRecord)mergeFromRecord).getCommitAddMap().get(added));
}
this.addAdditionChange(added, (Integer)addMapToMerge.get(added));
}
//merge removals
for (Iterator iterator = removeMapToMerge.keySet().iterator(); iterator.hasNext();){
Object removed = iterator.next();
if (!((DirectCollectionChangeRecord)mergeFromRecord).getCommitAddMap().containsKey(removed)){
// we have not recorded a change of this type in this class before so add it
this.getCommitAddMap().put(removed, ((DirectCollectionChangeRecord)mergeFromRecord).getCommitAddMap().get(removed));
}
this.addRemoveChange(removed, (Integer)addMapToMerge.get(removed));
}
|
public void | setAddObjectList(java.util.Vector list)INTERNAL:
This method sets the list of added objects. It should only be used in RCM
for (Iterator iterator = list.iterator(); iterator.hasNext();){
Object object = iterator.next();
this.addAdditionChange(object, new Integer(1));
}
|
public void | setCommitAddition(java.util.Hashtable additions)This method takes a hashtable of primitives and adds them to the commit list.
This count value provided is the number of instances that will need to be
inserted into the database once a remove has occured. This is only set
once for each object type
Enumeration enumtr = additions.keys();
while (enumtr.hasMoreElements()) {
Object object = enumtr.nextElement();
getCommitAddMap().put(object, additions.get(object));
}
|
public void | setLatestCollection(java.lang.Object latestCollection)Used for change tracking when cutomer sets entire collection
This is the last collection that was set on the object
this.latestCollection = latestCollection;
|
public void | setOriginalCollection(java.lang.Object originalCollection)Used for change tracking when cutomer sets entire collection
This is the original collection that was set on the object when it was cloned
this.originalCollection = originalCollection;
|
public void | setRemoveObjectList(java.util.Vector list)INTERNAL:
This method sets the list of added objects. It should only be used in RCM
for (Iterator iterator = list.iterator(); iterator.hasNext();){
Object object = iterator.next();
this.addRemoveChange(object, new Integer(1));
}
|
public void | storeDatabaseCounts(java.lang.Object collection, oracle.toplink.essentials.internal.queryframework.ContainerPolicy containerPolicy, oracle.toplink.essentials.internal.sessions.AbstractSession session)This method will iterate over the collection and store the database counts for
the objects within the collection, this is used for minimal updates
Object iterator = containerPolicy.iteratorFor(collection);
while (containerPolicy.hasNext(iterator)){
Object object = containerPolicy.next(iterator, session);
if (getCommitAddMap().containsKey(object)){
int count = ((Integer)getCommitAddMap().get(object)).intValue();
getCommitAddMap().put(object, new Integer(++count));
}else{
getCommitAddMap().put(object, new Integer(1));
}
}
|
public void | updateReferences(oracle.toplink.essentials.internal.sessions.UnitOfWorkChangeSet mergeToChangeSet, oracle.toplink.essentials.internal.sessions.UnitOfWorkChangeSet mergeFromChangeSet)INTERNAL:
This method will be used to update the objectsChangeSets references
//nothing for this record type to do as it does not reference any changesets
|