Class IntersectedSubCubeProperties

java.lang.Object
com.activeviam.activepivot.core.impl.internal.context.subcube.impl.IntersectedSubCubeProperties
All Implemented Interfaces:
IContextValue, ISubCubeProperties, IIntersectable<ISubCubeProperties>, IClone<IContextValue>, Serializable, Cloneable

public class IntersectedSubCubeProperties extends Object implements ISubCubeProperties
This class represents and handles the behavior of a set of intersected subCubeProperties.

The intersection is a logical AND: a measure/member is granted in the intersection, if it is granted in all the intersected subCubeProperties.

Author:
ActiveViam
See Also:
  • Method Details

    • getIntersectedSubCubeProperties

      public Set<SubCubeProperties> getIntersectedSubCubeProperties()
    • intersect

      public static ISubCubeProperties intersect(ISubCubeProperties... subcubes)
      Constructs an intersection of the given ISubCubeProperties subcube properties.

      Note that this method may or may not return an instance of IntersectedSubCubeProperties: this method is allowed to perform any optimizations that will simplify the resulting intersection.

      Parameters:
      subcubes - The ISubCubeProperties to intersect
      Returns:
      The intersection of the given ISubCubeProperties, or null if null was given as argument.
    • intersect

      public ISubCubeProperties intersect(ISubCubeProperties other)
      Description copied from interface: ISubCubeProperties
      Returns an ISubCubeProperties that only grants the members and measures that are granted by this ISubCubeProperties and the given one.

      The intersection is like a logical AND.

      Specified by:
      intersect in interface IIntersectable<ISubCubeProperties>
      Specified by:
      intersect in interface ISubCubeProperties
      Parameters:
      other - The ISubCubeProperties instance to intersect
      Returns:
      the intersection of the sub cubes.
    • getRestrictedHierarchies

      public Map<String,Set<String>> getRestrictedHierarchies()
      Description copied from interface: ISubCubeProperties
      Retrieves the mapping dimension => restricted hierarchies. If a dimension is absent, it has no restricted hierarchies.
      Specified by:
      getRestrictedHierarchies in interface ISubCubeProperties
      Returns:
      A map of dimensions with restricted hierarchies. If the dimensions has restricted hierarchies, the set of all restricted hierarchies is contained.
    • isAccessGranted

      public boolean isAccessGranted()
      Description copied from interface: ISubCubeProperties
      Returns true if this user can access to the pivot, false otherwise.
      Specified by:
      isAccessGranted in interface ISubCubeProperties
      Returns:
      true if this user can access to the pivot, false otherwise.
    • isMeasureGranted

      public boolean isMeasureGranted(String measureName)
      Description copied from interface: ISubCubeProperties
      Tells if the measure is granted.
      Specified by:
      isMeasureGranted in interface ISubCubeProperties
      Parameters:
      measureName - The name of the aggregated measure.
      Returns:
      true if granted, false otherwise.
    • isHierarchyRestricted

      public int isHierarchyRestricted(HierarchyIdentifier hierarchyIdentifier)
      Description copied from interface: ISubCubeProperties
      Returns a positive integer if this cube filter restricts access to any member of the given hierarchy.

      The returned integer corresponds to the depth of the deepest member that cannot be accessed with this cube filter.

      Specified by:
      isHierarchyRestricted in interface ISubCubeProperties
      Parameters:
      hierarchyIdentifier - The unique identifier for the hierarchy
      Returns:
      -1 if no restriction, the maximum depth of the restriction otherwise.
    • removeRestriction

      public ISubCubeProperties removeRestriction(HierarchyIdentifier hierarchy)
      Description copied from interface: ISubCubeProperties
      Removes the restriction on the specified hierarchy.

      This method could return this, when there is no restriction on the hierarchy.

      Specified by:
      removeRestriction in interface ISubCubeProperties
      Parameters:
      hierarchy - The target hierarchy
      Returns:
      an ISubCubeProperties without restriction on the specified hierarchy.
    • getGrantedMembers

      public Set<List<?>> getGrantedMembers(String dimension, String hierarchy)
      Returns the axis members that are granted by this intersection.

      An axis member is granted only if all the sub cube properties in the intersection grant it, or when a sub cube property does not define any granted member (all are granted).

      Specified by:
      getGrantedMembers in interface ISubCubeProperties
      Parameters:
      dimension - The name of the target dimension
      hierarchy - the name of the hierarchy
      Returns:
      set of granted members. The return result can contain a list of member paths of granted members or/and a list of ICondition defining which members are allowed.
    • findIntersection

      public static List<?> findIntersection(List<?> left, List<?> right)
      Find the member restriction common to two member restrictions by intersecting them. For instance: - if List(A,B,C) and List(A) are given, the result is List(A,B,C) "if we grant access to [AllMember] on one side and [AllMember].[EUR].[foo] on the other side, the granted member is [AllMember].[EUR].[foo]" - if List(A) and List(B) are given, there is no common member so null is returned.

      It should take into account the fact some elements can be null among the list. null is like a wildcard i.e means everything on the given level. For instance: if List(A,null,C) and List(A,B) are given, the intersection is List(A,B,C).

      Parameters:
      left - list of member paths to merge with right
      right - list of member paths to merge with left
      Returns:
      the intersection list resulting from the merge described above between left and right.
    • isLocationGranted

      public int isLocationGranted(List<? extends IHierarchyInfo> hierarchies, ILocation location)
      Description copied from interface: ISubCubeProperties
      Tells if the user can access to a specific location.
      Specified by:
      isLocationGranted in interface ISubCubeProperties
      Parameters:
      hierarchies - all the IHierarchyInfo including the measures.
      location - tested target location, aligned with the context hierarchies
      Returns:
      -1 if no access granted, 0 otherwise and the ordinal of the limiting hierarchy if it exists.
      See Also:
    • isLocationGrantedMultiple

      public Set<Integer> isLocationGrantedMultiple(List<? extends IHierarchyInfo> hierarchies, ILocation location)
      Description copied from interface: ISubCubeProperties
      Tells if the user can access to a specific location.
      Specified by:
      isLocationGrantedMultiple in interface ISubCubeProperties
      Parameters:
      hierarchies - list of hierarchies, including the measure hierarchy
      location - A target location, aligned with the context hierarchies
      Returns:
      NULL is filtered out completely. An empty collection if no restrictions, otherwise the set of restricted hierarchy ordinals.
      See Also:
    • getContextInterface

      public Class<? extends IContextValue> getContextInterface()
      Description copied from interface: IContextValue
      Returns the reference interface of the context value.
      Specified by:
      getContextInterface in interface IContextValue
      Returns:
      The reference interface of the context value.
    • getSubCubeTree

      @Deprecated(since="6.1.0", forRemoval=true) public ISubCubeTree getSubCubeTree(String dimension, String hierarchy)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns the subCubeTree attached to a given hierarchy name.
      Parameters:
      dimension - The name of the target dimension
      hierarchy - The name of the target hierarchy
      Returns:
      the subCubeTree attached to a given hierarchy name
    • clone

      public ISubCubeProperties clone()
      Description copied from interface: ISubCubeProperties
      Deep clone of the sub cube properties.
      Specified by:
      clone in interface IClone<IContextValue>
      Specified by:
      clone in interface IIntersectable<ISubCubeProperties>
      Specified by:
      clone in interface ISubCubeProperties
      Returns:
      a clone of the object
    • isGranted

      public static boolean isGranted(ISubCubeProperties scp, String dimension, List<?> memberPath)
      Test if a subcube is granting access on the given dimension and hierarchy to the member designated by its path.
      Parameters:
      scp - ISubCubeProperties to test
      dimension - name of the dimension
      memberPath - the path of the member
      Returns:
      true if the member whose path corresponds to the input is granted.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object