1 21 package oracle.toplink.essentials.internal.queryframework; 23 24 import java.util.List ; 25 import oracle.toplink.essentials.internal.sessions.ObjectChangeSet; 26 import oracle.toplink.essentials.internal.sessions.CollectionChangeRecord; 27 28 38 public class ListContainerPolicy extends CollectionContainerPolicy { 39 43 public ListContainerPolicy() { 44 super(); 45 } 46 47 51 public ListContainerPolicy(Class containerClass) { 52 super(containerClass); 53 } 54 55 59 public ListContainerPolicy(String containerClassName) { 60 super(containerClassName); 61 } 62 63 67 public boolean hasOrder() { 68 return true; 69 } 70 71 75 public boolean isListPolicy() { 76 return true; 77 } 78 79 83 public boolean isValidContainer(Object container) { 84 return container instanceof List ; 86 } 87 88 95 public void recordAddToCollectionInChangeRecord(ObjectChangeSet changeSetToAdd, CollectionChangeRecord collectionChangeRecord){ 96 if (collectionChangeRecord.getRemoveObjectList().containsKey(changeSetToAdd)) { 97 collectionChangeRecord.getRemoveObjectList().remove(changeSetToAdd); 98 } else { 99 if (collectionChangeRecord.getAddObjectList().contains(changeSetToAdd)) { 100 collectionChangeRecord.getAddOverFlow().add(changeSetToAdd); 101 } else { 102 collectionChangeRecord.getAddObjectList().put(changeSetToAdd, changeSetToAdd); 103 } 104 } 105 } 106 107 114 public void recordRemoveFromCollectionInChangeRecord(ObjectChangeSet changeSetToRemove, CollectionChangeRecord collectionChangeRecord){ 115 if (collectionChangeRecord.getAddObjectList().containsKey(changeSetToRemove)) { 116 if (collectionChangeRecord.getAddOverFlow().contains(changeSetToRemove)){ 117 collectionChangeRecord.getAddOverFlow().remove(changeSetToRemove); 118 } else { 119 collectionChangeRecord.getAddObjectList().remove(changeSetToRemove); 120 } 121 } else { 122 collectionChangeRecord.getRemoveObjectList().put(changeSetToRemove, changeSetToRemove); 123 } 124 } 125 } 126 | Popular Tags |