Don't need to hold a reference to outstandingDao in changeshappened

pull/14/head
Sam Bosley 12 years ago
parent 8a817ad14f
commit 952b0b651c

@ -25,7 +25,6 @@ public class ChangesHappened<TYPE extends RemoteModel, OE extends OutstandingEnt
private final String uuid;
private final List<OE> changes;
private long pushedAt;
private final OutstandingEntryDao<OE> outstandingDao;
public ChangesHappened(TYPE entity, RemoteModelDao<TYPE> modelDao,
OutstandingEntryDao<OE> outstandingDao) {
@ -33,7 +32,6 @@ public class ChangesHappened<TYPE extends RemoteModel, OE extends OutstandingEnt
this.outstandingClass = getOutstandingClass(modelClass);
this.id = entity.getId();
this.changes = new ArrayList<OE>();
this.outstandingDao = outstandingDao;
if (!entity.containsValue(RemoteModel.UUID_PROPERTY)
|| !entity.containsValue(RemoteModel.PUSHED_AT_PROPERTY)) {
@ -45,7 +43,7 @@ public class ChangesHappened<TYPE extends RemoteModel, OE extends OutstandingEnt
} else {
this.uuid = entity.getValue(RemoteModel.UUID_PROPERTY);
this.pushedAt = entity.getValue(RemoteModel.PUSHED_AT_PROPERTY);
populateChanges();
populateChanges(outstandingDao);
}
}
@ -57,7 +55,7 @@ public class ChangesHappened<TYPE extends RemoteModel, OE extends OutstandingEnt
return changes;
}
private void populateChanges() {
private void populateChanges(OutstandingEntryDao<OE> outstandingDao) {
TodorooCursor<OE> cursor = outstandingDao.query(Query.select(getModelProperties(outstandingClass))
.where(OutstandingEntry.ENTITY_ID_PROPERTY.eq(id)).orderBy(Order.asc(OutstandingEntry.CREATED_AT_PROPERTY)));
try {

Loading…
Cancel
Save