Class Group

  • All Implemented Interfaces:
    Comparable<Group>, NamedObject

    public class Group
    extends I18nDescribedObject
    implements NamedObject, Comparable<Group>
    Group holds set of other elements: other groups and identities. This class only denotes group, it doesn't hold group's content.

    Each group can have a list of AttributeStatements assigned. Group member can automatically get attributes from a statement if she fulfills the statement's condition.

    Each group can have a set of AttributesClasses assigned. Members of the group have those classes automatically assigned.

    Author:
    K. Benedyczak
    • Constructor Detail

      • Group

        public Group​(String path)
      • Group

        public Group​(com.fasterxml.jackson.databind.node.ObjectNode src)
    • Method Detail

      • getPathsChain

        public List<String> getPathsChain()
      • isChild

        public static boolean isChild​(String group,
                                      String potentialParent)
        Parameters:
        group -
        potentialParent -
        Returns:
        true only if potentialParent is group's parent and is not equal to group
      • isDirectChild

        public static boolean isDirectChild​(String group,
                                            String potentialParent)
      • isChildOrSame

        public static boolean isChildOrSame​(String group,
                                            String potentialParent)
        Parameters:
        group -
        potentialParent -
        Returns:
        true only if potentialParent is group's parent or is not equal to group
      • getOnlyChildrenOfSet

        public static Set<Group> getOnlyChildrenOfSet​(Set<Group> source)
      • getMissingGroups

        public static Deque<String> getMissingGroups​(String finalGroup,
                                                     Collection<String> existingGroups)
        Computes deque of full group names which are not in the collection of existingGroups and are on the path to the finalGroup (inclusive).
        Parameters:
        finalGroup -
        existingGroups -
        Returns:
      • renameParent

        public static String renameParent​(String group,
                                          String originalParentName,
                                          String newParentName)
        Changes part of this group path, when parent group is renamed.
        Parameters:
        originalParentName -
        newParentName -
        Returns:
        updated path
      • isChild

        public boolean isChild​(Group test)
      • isChildNotSame

        public boolean isChildNotSame​(Group test)
      • isTopLevel

        public boolean isTopLevel()
      • getPath

        public String[] getPath()
      • getPathEncoded

        public String getPathEncoded()
      • getName

        public String getName()
        Specified by:
        getName in interface NamedObject
        Returns:
        human readable name of the object. Must be unique for the object class.
      • getDisplayedNameShort

        public I18nString getDisplayedNameShort​(MessageSource msg)
        This is likely a go-to method to present group name to a person. If displayed name was set to non default value (which is sadly group path :/) then it is returned. Otherwise last component of the path is returned.
      • setPath

        public void setPath​(String path)
      • getRelativeName

        public String getRelativeName()
      • getParentPath

        public String getParentPath()
      • setAttributeStatements

        public void setAttributeStatements​(AttributeStatement[] attributeStatements)
      • getAttributesClasses

        public Set<String> getAttributesClasses()
      • setAttributesClasses

        public void setAttributesClasses​(Set<String> attributesClasses)
      • isPublic

        public boolean isPublic()
      • setPublic

        public void setPublic​(boolean publicGroup)
      • getNameShort

        public String getNameShort()
        Returns:
        last component of the group path
      • toJson

        public com.fasterxml.jackson.databind.node.ObjectNode toJson()
      • toJsonBase

        public com.fasterxml.jackson.databind.node.ObjectNode toJsonBase()
      • fromJsonBase

        public void fromJsonBase​(com.fasterxml.jackson.databind.node.ObjectNode main)