Class Project

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

public class Project extends Object implements Comparable<Project>, Nameable, Serializable
Placeholder for the information that builds up a project.
See Also:
  • Constructor Details

    • Project

      public Project()
    • Project

      public Project(String name)
      Create a project with given name.
      Parameters:
      name - the name of the project
    • Project

      public Project(String name, String path)
      Create a project with given name and path and default configuration values.
      Parameters:
      name - the name of the project
      path - the path of the project relative to the source root
  • Method Details

    • getName

      public String getName()
      Get a textual name of this project.
      Specified by:
      getName in interface Nameable
      Returns:
      a textual name of the project
    • getPath

      public String getPath()
      Get the path (relative from source root) where this project is located.
      Returns:
      the relative path
    • isIndexed

      public boolean isIndexed()
    • getId

      public String getId()
      Get the project id.
      Returns:
      the id of the project
    • getTabSize

      public int getTabSize()
      Get the tab size for this project, if tab size has been set.
      Returns:
      tab size if set, 0 otherwise
      See Also:
    • setName

      public void setName(String name)
      Set a textual name of this project, preferably don't use " , " in the name, since it's used as delimiter for more projects XXX we should not allow setting project name after it has been constructed because it is probably part of HashMap.
      Specified by:
      setName in interface Nameable
      Parameters:
      name - a textual name of the project
    • setPath

      public void setPath(String path)
      Set the path (relative from source root) this project is located.
      Parameters:
      path - the relative path from source root where this project is located, starting with path separator.
    • setIndexed

      public void setIndexed(boolean flag)
    • setTabSize

      public final void setTabSize(int tabSize)
      Set tab size for this project. Used for expanding tabs to spaces in xrefs.
      Parameters:
      tabSize - the size of tabs in this project
    • hasTabSizeSetting

      public boolean hasTabSizeSetting()
      Has this project an explicit tab size setting?
      Returns:
      true if the tab size has been set for this project, or false if it hasn't and the default should be used
    • isNavigateWindowEnabled

      public boolean isNavigateWindowEnabled()
      Indicate whether the navigate window should be opened by default when browsing a source code from this project.
      Returns:
      true if yes; false otherwise
    • setNavigateWindowEnabled

      public final void setNavigateWindowEnabled(boolean navigateWindowEnabled)
      Set the value of navigateWindowEnabled.
      Parameters:
      navigateWindowEnabled - new value of navigateWindowEnabled
    • isHandleRenamedFiles

      public boolean isHandleRenamedFiles()
      Returns:
      true if this project handles renamed files.
    • isMergeCommitsEnabled

      public boolean isMergeCommitsEnabled()
      Returns:
      true if merge commits are enabled.
    • isTagsEnabled

      public boolean isTagsEnabled()
      Returns:
      whether tagging of history entries is on
    • setHandleRenamedFiles

      public final void setHandleRenamedFiles(boolean flag)
      Parameters:
      flag - true if project should handle renamed files, false otherwise.
    • isHistoryEnabled

      public boolean isHistoryEnabled()
      Returns:
      true if this project should have history cache.
    • setHistoryEnabled

      public final void setHistoryEnabled(boolean flag)
      Parameters:
      flag - true if project should have history cache, false otherwise.
    • isHistoryCacheEnabled

      public boolean isHistoryCacheEnabled()
      Returns:
      true if this project should have history cache.
    • setHistoryCacheEnabled

      public final void setHistoryCacheEnabled(boolean flag)
      Parameters:
      flag - true if project should have history cache, false otherwise.
    • isAnnotationCacheEnabled

      public boolean isAnnotationCacheEnabled()
      Returns:
      true if this project should have annotation cache.
    • setAnnotationCacheEnabled

      public final void setAnnotationCacheEnabled(boolean flag)
      Parameters:
      flag - true if project should have annotation cache, false otherwise.
    • setMergeCommitsEnabled

      public final void setMergeCommitsEnabled(boolean flag)
      Parameters:
      flag - true if project's repositories should deal with merge commits.
    • setTagsEnabled

      public final void setTagsEnabled(boolean flag)
      Parameters:
      flag - whether to tag history entries
    • isHistoryBasedReindex

      public boolean isHistoryBasedReindex()
      Returns:
      true if this project handles renamed files.
    • setHistoryBasedReindex

      public final void setHistoryBasedReindex(boolean flag)
      Parameters:
      flag - true if project should handle renamed files, false otherwise.
    • setUsername

      public void setUsername(String username)
      Set username to be used for repository authentication.
      Parameters:
      username - username
    • getUsername

      public String getUsername()
      Returns:
      username used for repository authentication
    • setPassword

      public void setPassword(String password)
      Set password to be used for repository authentication.
      Parameters:
      password - password
    • getPassword

      public String getPassword()
      Returns:
      password used for repository authentication
    • clearProperties

      @VisibleForTesting public void clearProperties()
    • getGroups

      public Set<Group> getGroups()
      Return groups where this project belongs.
      Returns:
      set of groups|empty if none
    • setGroups

      public void setGroups(Set<Group> groups)
    • addGroup

      public void addGroup(Group group)
      Adds a group where this project belongs.
      Parameters:
      group - group to add
    • setBugPage

      public final void setBugPage(String bugPage)
    • getBugPage

      public String getBugPage()
    • setBugPattern

      public final void setBugPattern(String bugPattern) throws PatternSyntaxException
      Set the bug pattern to a new value.
      Parameters:
      bugPattern - the new pattern
      Throws:
      PatternSyntaxException - when the pattern is not a valid regexp or does not contain at least one capture group and the group does not contain a single character
    • getBugPattern

      public String getBugPattern()
    • getReviewPage

      public String getReviewPage()
    • setReviewPage

      public final void setReviewPage(String reviewPage)
    • getReviewPattern

      public String getReviewPattern()
    • setReviewPattern

      public final void setReviewPattern(String reviewPattern) throws PatternSyntaxException
      Set the review pattern to a new value.
      Parameters:
      reviewPattern - the new pattern
      Throws:
      PatternSyntaxException - when the pattern is not a valid regexp or does not contain at least one capture group and the group does not contain a single character
    • completeWithDefaults

      public final void completeWithDefaults()
      Fill the project with the current configuration where the applicable project property has a default value.
    • getProject

      public static Project getProject(String path)
      Get the project for a specific file.
      Parameters:
      path - the file to lookup (relative to source root)
      Returns:
      the project that this file belongs to (or null if the file doesn't belong to a project)
    • getProject

      @Nullable public static @Nullable Project getProject(File file)
      Get the project for a specific file.
      Parameters:
      file - file under source root
      Returns:
      the project that this file belongs to (or null if the file doesn't belong to a project, or it is a symbolic link that is not allowed)
    • getByName

      public static Project getByName(String name)
      Returns project object by its name, used in webapp to figure out which project is to be searched.
      Parameters:
      name - name of the project
      Returns:
      project that fits the name
    • compareTo

      public int compareTo(Project p2)
      Specified by:
      compareTo in interface Comparable<Project>
    • 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