Package org.projectbarbel.histo
Class BarbelQueries
- java.lang.Object
-
- org.projectbarbel.histo.BarbelQueries
-
public final class BarbelQueries extends Object
Convenience methods to perform queries onBarbelHisto.retrieve(Query)
and the like. All queries can be combined with additional CqEngine queries created byQueryFactory
.- Author:
- Niklas Schlimm
-
-
Field Summary
Fields Modifier and Type Field Description static com.googlecode.cqengine.attribute.Attribute<Object,Long>
CREATED_AT
static com.googlecode.cqengine.attribute.SimpleAttribute<Object,Object>
DOCUMENT_ID
static com.googlecode.cqengine.attribute.Attribute<Object,Long>
EFFECTIVE_FROM
static com.googlecode.cqengine.attribute.Attribute<Object,Long>
EFFECTIVE_UNTIL
static com.googlecode.cqengine.attribute.Attribute<Object,Long>
INACTIVATED_AT
static com.googlecode.cqengine.attribute.Attribute<Object,BitemporalObjectState>
STATE
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static <T> com.googlecode.cqengine.query.Query<T>
all()
Get all versions from the backbone.static <T> com.googlecode.cqengine.query.Query<T>
all(Object id)
Get all versions for one document id.static <T> com.googlecode.cqengine.query.Query<T>
allActive(Object id)
Get all active (valid) versions.static <T> com.googlecode.cqengine.query.Query<T>
allInactive(Object id)
Get all versions for a document id, that have been inactivated.static <T> com.googlecode.cqengine.query.Query<T>
effectiveAfter(Object id, ZonedDateTime time)
Get the versions effective on or after a given day.static <T> com.googlecode.cqengine.query.Query<T>
effectiveAt(Object id, ZonedDateTime time)
Get the version effective at given time.static <T> com.googlecode.cqengine.query.Query<T>
effectiveBetween(Object id, EffectivePeriod period)
Get effective versions in a certain period of time.static <T> com.googlecode.cqengine.query.Query<T>
effectiveNow(Object id)
Get the version effective today.static <T> com.googlecode.cqengine.query.Query<T>
journalAt(Object id, ZonedDateTime time)
Get the list of active records at a given record time.static Object
returnIDForQuery(com.googlecode.cqengine.query.Query query)
static List<Object>
returnIDsForQuery(com.googlecode.cqengine.query.Query query, List<Object> ids)
-
-
-
Field Detail
-
DOCUMENT_ID
public static final com.googlecode.cqengine.attribute.SimpleAttribute<Object,Object> DOCUMENT_ID
-
STATE
public static final com.googlecode.cqengine.attribute.Attribute<Object,BitemporalObjectState> STATE
-
EFFECTIVE_FROM
public static final com.googlecode.cqengine.attribute.Attribute<Object,Long> EFFECTIVE_FROM
-
EFFECTIVE_UNTIL
public static final com.googlecode.cqengine.attribute.Attribute<Object,Long> EFFECTIVE_UNTIL
-
-
Method Detail
-
all
public static <T> com.googlecode.cqengine.query.Query<T> all()
Get all versions from the backbone.- Type Parameters:
T
- the POJO type- Returns:
- all versions stored
-
all
public static <T> com.googlecode.cqengine.query.Query<T> all(Object id)
Get all versions for one document id.- Type Parameters:
T
- the POJO type- Parameters:
id
- the document id- Returns:
- the versions
-
allActive
public static <T> com.googlecode.cqengine.query.Query<T> allActive(Object id)
Get all active (valid) versions. These will have distinct (non-overlapping) effective periods.- Type Parameters:
T
- the POJO type- Parameters:
id
- the document id- Returns:
- the active versions
-
returnIDForQuery
public static Object returnIDForQuery(com.googlecode.cqengine.query.Query query)
-
returnIDsForQuery
public static List<Object> returnIDsForQuery(com.googlecode.cqengine.query.Query query, List<Object> ids)
-
allInactive
public static <T> com.googlecode.cqengine.query.Query<T> allInactive(Object id)
Get all versions for a document id, that have been inactivated.- Type Parameters:
T
- the POJO type- Parameters:
id
- the document id- Returns:
- the inactivated versions
-
effectiveNow
public static <T> com.googlecode.cqengine.query.Query<T> effectiveNow(Object id)
Get the version effective today. Unique object result. Valid query forBarbelHisto.retrieveOne(Query)
.- Type Parameters:
T
- the POJO type- Parameters:
id
- the document- Returns:
- the unique result
-
effectiveAt
public static <T> com.googlecode.cqengine.query.Query<T> effectiveAt(Object id, ZonedDateTime time)
Get the version effective at given time. Unique object result. Valid query forBarbelHisto.retrieveOne(Query)
.- Type Parameters:
T
- the POJO type- Parameters:
id
- the documenttime
- effective-at time- Returns:
- the unique result
-
effectiveAfter
public static <T> com.googlecode.cqengine.query.Query<T> effectiveAfter(Object id, ZonedDateTime time)
Get the versions effective on or after a given day.- Type Parameters:
T
- the POJO type- Parameters:
id
- the documenttime
- the effective-after time- Returns:
- the unique result
-
effectiveBetween
public static <T> com.googlecode.cqengine.query.Query<T> effectiveBetween(Object id, EffectivePeriod period)
Get effective versions in a certain period of time.- Type Parameters:
T
- the POJO type- Parameters:
id
- the dicument idperiod
- the period- Returns:
- the list of effective versions
-
journalAt
public static <T> com.googlecode.cqengine.query.Query<T> journalAt(Object id, ZonedDateTime time)
Get the list of active records at a given record time. These will have distinct (non-overlapping) effective periods.- Type Parameters:
T
- the POJO type- Parameters:
id
- the document idtime
- the point in time, must be in the past- Returns:
- the list of versions active at the given time
-
-