Package pl.edu.icm.unity.types.basic
Class Group
- java.lang.Object
-
- pl.edu.icm.unity.types.I18nDescribedObject
-
- pl.edu.icm.unity.types.basic.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
AttributeStatement
s assigned. Group member can automatically get attributes from a statement if she fulfills the statement's condition.Each group can have a set of
AttributesClass
es assigned. Members of the group have those classes automatically assigned.- Author:
- K. Benedyczak
-
-
Field Summary
-
Fields inherited from class pl.edu.icm.unity.types.I18nDescribedObject
description, displayedName
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Group
clone()
int
compareTo(Group toCompare)
boolean
equals(Object obj)
void
fromJsonBase(com.fasterxml.jackson.databind.node.ObjectNode main)
Set<String>
getAttributesClasses()
AttributeStatement[]
getAttributeStatements()
GroupDelegationConfiguration
getDelegationConfiguration()
I18nString
getDisplayedNameShort(MessageSource msg)
This is likely a go-to method to present group name to a person.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).String
getName()
String
getNameShort()
static Set<Group>
getOnlyChildrenOfSet(Set<Group> source)
String
getParentPath()
String[]
getPath()
String
getPathEncoded()
List<String>
getPathsChain()
Map<String,GroupProperty>
getProperties()
String
getRelativeName()
static Set<Group>
getRootsOfSet(Set<Group> source)
int
hashCode()
static boolean
isChild(String group, String potentialParent)
boolean
isChild(Group test)
boolean
isChildNotSame(Group test)
static boolean
isChildOrSame(String group, String potentialParent)
static boolean
isDirectChild(String group, String potentialParent)
boolean
isPublic()
boolean
isTopLevel()
static String
renameParent(String group, String originalParentName, String newParentName)
Changes part of this group path, when parent group is renamed.void
setAttributesClasses(Set<String> attributesClasses)
void
setAttributeStatements(AttributeStatement[] attributeStatements)
void
setDelegationConfiguration(GroupDelegationConfiguration delegationConfiguration)
void
setPath(String path)
void
setProperties(Collection<GroupProperty> properties)
void
setPublic(boolean publicGroup)
com.fasterxml.jackson.databind.node.ObjectNode
toJson()
com.fasterxml.jackson.databind.node.ObjectNode
toJsonBase()
String
toString()
-
Methods inherited from class pl.edu.icm.unity.types.I18nDescribedObject
getDescription, getDisplayedName, setDescription, setDisplayedName
-
-
-
-
Method Detail
-
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
-
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
-
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 interfaceNamedObject
- 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()
-
getAttributeStatements
public AttributeStatement[] getAttributeStatements()
-
setAttributeStatements
public void setAttributeStatements(AttributeStatement[] attributeStatements)
-
getDelegationConfiguration
public GroupDelegationConfiguration getDelegationConfiguration()
-
setDelegationConfiguration
public void setDelegationConfiguration(GroupDelegationConfiguration delegationConfiguration)
-
isPublic
public boolean isPublic()
-
setPublic
public void setPublic(boolean publicGroup)
-
getProperties
public Map<String,GroupProperty> getProperties()
-
setProperties
public void setProperties(Collection<GroupProperty> properties)
-
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)
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classI18nDescribedObject
-
compareTo
public int compareTo(Group toCompare)
- Specified by:
compareTo
in interfaceComparable<Group>
-
equals
public boolean equals(Object obj)
- Overrides:
equals
in classI18nDescribedObject
-
-