Class CriteriaUtility



  • public final class CriteriaUtility
    extends java.lang.Object
    The Class CriteriaUtility.
    Version:
    $Id: $Id
    Author:
    steiner
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static <C> Criteria doRemovePartitionCriteria​(Criteria aCriteria, java.lang.String aKey, java.util.Set<C> aPartitions)
      Removes the criteria for the provided partitions given key.
      static <P> java.util.Set<P> getPartitions​(Criteria aCriteria, java.lang.String aKey, java.lang.Class<P> aType)
      Tries to determine the partitions specified by the given key and type being addressed by the query represented by the given criteria.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • getPartitions

        public static <P> java.util.Set<P> getPartitions​(Criteria aCriteria,
                                                         java.lang.String aKey,
                                                         java.lang.Class<P> aType)
        Tries to determine the partitions specified by the given key and type being addressed by the query represented by the given criteria. Actually EqualWithCriteria values for the partition key and type (compared to the partition value) are determined embedded in CriteriaNodes. ------------------------------------------------------------------------- Caution: In order for partitioning to work, the provided key specifying the partition must be reflected in the criteria's key. The following rules are required in order to determine the partition from the criteria: The provided criteria must be of type CriteriaNode or EqualWithCriteria. The CriteriaNode must contain one ore more EqualWithCriteria referring the provided key and partition. -------------------------------------------------------------------------
        Type Parameters:
        P - the generic type
        Parameters:
        aCriteria - The criteria from which to retrieve the according partition.
        aKey - The key representing the partition criteria's key.
        aType - The type representing the partition criteria's value's type.
        Returns:
        A set with the values for the given key and type addressing partition(s) to which the Criteria are targeted at.
      • doRemovePartitionCriteria

        public static <C> Criteria doRemovePartitionCriteria​(Criteria aCriteria,
                                                             java.lang.String aKey,
                                                             java.util.Set<C> aPartitions)
        Removes the criteria for the provided partitions given key. Make sure that the criteria does not address more than one(!) partition in case you use this method with a e.g. PartedLoggerImpl. Only in case one partition is addressed by the criteria, then the partition to be addressed is known and then we can safely remove the criteria. Use the getPartitions(Criteria, String, Class) method for getting the partitions being addressed by the given criteria. When there is just one partition being addressed, then this partition's criteria may be removed from the criteria: The criteria's query is targeted at the according partition, we do not need to include the select statement for that partition! Actually EqualWithCriteria for the partition columns and the given partition are removed. ------------------------------------------------------------------------- Caution: In order for partitioning to work, the provided key specifying the partition must be reflected in the criteria's key. The following rules are required in order to determine the partition from the criteria: The provided criteria must be of type CriteriaNode or EqualWithCriteria. The CriteriaNode must contain one ore more EqualWithCriteria referring the provided key and partition. -------------------------------------------------------------------------
        Type Parameters:
        C - the generic type
        Parameters:
        aCriteria - The criteria from which to retrieve the according partition
        aKey - The key representing the partition criteria's key.
        aPartitions - The partitions for which to remove the criteria
        Returns:
        The criteria without the criteria referring to the provided key and the provided partitions