#118 - ENH: Add support for for Soft Deletes (Logical Deletion) ... - initial

This commit is contained in:
Robin Bygrave
2015-12-01 23:21:11 +13:00
parent 51bee836d4
commit 0ad52cf6a7
24 changed files with 531 additions and 105 deletions
@@ -180,6 +180,8 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
private Timestamp versionsStart;
private Timestamp versionsEnd;
private List<String> softDeletePredicates;
private boolean disableReadAudit;
private int bufferFetchSizeHint;
@@ -287,6 +289,19 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
return this;
}
@Override
public void addSoftDeletePredicate(String softDeletePredicate) {
if (softDeletePredicates == null) {
softDeletePredicates = new ArrayList<String>();
}
softDeletePredicates.add(softDeletePredicate);
}
@Override
public List<String> getSoftDeletePredicates() {
return softDeletePredicates;
}
/**
* This table alias is for a @History entity involved in the query and as
* such we need to add a 'as of predicate' to the query using this alias.
@@ -317,6 +332,12 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
return this;
}
@Override
public Query<T> includeSoftDeletes() {
this.temporalMode = TemporalMode.SOFT_DELETED;
return this;
}
/**
* Set the BeanDescriptor for the root type of this query.
*/
@@ -660,6 +681,11 @@ public class DefaultOrmQuery<T> implements SpiQuery<T> {
return TemporalMode.DRAFT == temporalMode;
}
@Override
public boolean isIncludeSoftDeletes() {
return TemporalMode.SOFT_DELETED == temporalMode;
}
public void setMode(Mode mode) {
this.mode = mode;
}