1 56 57 package org.objectstyle.cayenne.access; 58 59 import java.util.ArrayList ; 60 import java.util.HashMap ; 61 import java.util.List ; 62 import java.util.Map ; 63 64 import org.objectstyle.cayenne.map.ObjEntity; 65 import org.objectstyle.cayenne.query.Query; 66 67 73 class DataNodeCommitAction { 74 75 static final int INSERT = 1; 76 static final int UPDATE = 2; 77 static final int DELETE = 3; 78 79 DataNode node; 80 List objEntitiesForInsert = new ArrayList (); 81 List objEntitiesForDelete = new ArrayList (); 82 List objEntitiesForUpdate = new ArrayList (); 83 Map flattenedInsertQueries = new HashMap (); 84 Map flattenedDeleteQueries = new HashMap (); 85 List queries = new ArrayList (); 86 87 DataNodeCommitAction(DataNode node) { 88 this.node = node; 89 } 90 91 void addToEntityList(ObjEntity ent, int listType) { 92 switch (listType) { 93 case 1: 94 objEntitiesForInsert.add(ent); 95 break; 96 case 2: 97 objEntitiesForUpdate.add(ent); 98 break; 99 case 3: 100 objEntitiesForDelete.add(ent); 101 break; 102 } 103 } 104 105 void addToQueries(Query q) { 106 queries.add(q); 107 } 108 109 112 DataNode getNode() { 113 return node; 114 } 115 116 119 List getQueries() { 120 return queries; 121 } 122 123 128 List getObjEntitiesForDelete() { 129 return objEntitiesForDelete; 130 } 131 132 137 List getObjEntitiesForInsert() { 138 return objEntitiesForInsert; 139 } 140 141 146 List getObjEntitiesForUpdate() { 147 return objEntitiesForUpdate; 148 } 149 150 Map getFlattenedDeleteQueries() { 151 return flattenedDeleteQueries; 152 } 153 154 Map getFlattenedInsertQueries() { 155 return flattenedInsertQueries; 156 } 157 } | Popular Tags |