Class Group

java.lang.Object
org.opengrok.indexer.configuration.Group
All Implemented Interfaces:
Comparable<Group>, Nameable

public class Group extends Object implements Comparable<Group>, Nameable
Placeholder for the information about subgroups of projects and repositories. Supports natural ordering based on case insensitive group names.
Version:
$Revision$
Author:
Krystof Tulinger
  • Constructor Details

    • Group

      public Group()
      No-arg constructor is needed for deserialization.
    • Group

      public Group(String name)
    • Group

      public Group(String name, String pattern)
  • Method Details

    • getProjects

      public Set<Project> getProjects()
    • addProject

      public void addProject(Project p)
    • addRepository

      public void addRepository(Project p)
    • getDescendants

      public Set<Group> getDescendants()
    • setDescendants

      public void setDescendants(Set<Group> descendants)
    • addDescendant

      public void addDescendant(Group g)
    • removeDescendant

      public void removeDescendant(Group g)
    • getRepositories

      public Set<Project> getRepositories()
    • setSubgroups

      public void setSubgroups(Set<Group> subgroups)
    • setProjects

      public void setProjects(Set<Project> projects)
    • setRepositories

      public void setRepositories(Set<Project> repositories)
    • getSubgroups

      public Set<Group> getSubgroups()
    • addGroup

      public void addGroup(Group g)
    • getParents

      public Set<Group> getParents()
    • getRelatedGroups

      public Set<Group> getRelatedGroups()
      Collect all related groups to this group. A related group is
      • any ancestor
      • any subgroup
      Returns:
      all collected related groups to this group
    • getAllProjects

      public Set<Project> getAllProjects()
      Collect all group's projects and repositories included in this group and in any subgroup.
      Returns:
      all collected projects and repositories
    • getParent

      public Group getParent()
    • setParent

      public void setParent(Group parent)
    • getName

      public String getName()
      Specified by:
      getName in interface Nameable
    • setName

      public void setName(String name)
      Specified by:
      setName in interface Nameable
    • getPattern

      public String getPattern()
    • setPattern

      public final void setPattern(String pattern) throws PatternSyntaxException
      Set the group pattern.
      Parameters:
      pattern - the regexp pattern for this group
      Throws:
      PatternSyntaxException - when the pattern is invalid
    • getFlag

      public int getFlag()
    • setFlag

      public void setFlag(int flag)
    • match

      public boolean match(Project p)
      Test group for a match.
      Parameters:
      p - project
      Returns:
      true if project's name matches the group pattern
    • match

      public boolean match(String name)
      Test group for a match.
      Parameters:
      name - string to match
      Returns:
      true if given name matches the group pattern
    • compareTo

      public int compareTo(Group o)
      Specified by:
      compareTo in interface Comparable<Group>
    • hashCode

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

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

      @Nullable public static @Nullable Group getByName(String name)
      Returns group object by its name.
      Parameters:
      name - name of a group
      Returns:
      group that fits the name
    • matching

      public static Set<Group> matching(Project project, Set<Group> groups)
      Reduce the group set to only those which match the given project based on the project's description.
      Parameters:
      project - the project
      groups - set of groups
      Returns:
      set of groups matching the project