Class BarbelQueries


  • public final class BarbelQueries
    extends Object
    Convenience methods to perform queries on BarbelHisto.retrieve(Query) and the like. All queries can be combined with additional CqEngine queries created by QueryFactory.
    Author:
    Niklas Schlimm
    • Field Detail

      • DOCUMENT_ID

        public static final com.googlecode.cqengine.attribute.SimpleAttribute<Object,​Object> DOCUMENT_ID
      • 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
      • CREATED_AT

        public static final com.googlecode.cqengine.attribute.Attribute<Object,​Long> CREATED_AT
      • INACTIVATED_AT

        public static final com.googlecode.cqengine.attribute.Attribute<Object,​Long> INACTIVATED_AT
    • 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 for BarbelHisto.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 for BarbelHisto.retrieveOne(Query).
        Type Parameters:
        T - the POJO type
        Parameters:
        id - the document
        time - 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 document
        time - 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 id
        period - 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 id
        time - the point in time, must be in the past
        Returns:
        the list of versions active at the given time