Class OwnershipDescription

java.lang.Object
com.synopsys.arc.jenkins.plugins.ownership.OwnershipDescription
All Implemented Interfaces:
Serializable

public class OwnershipDescription extends Object implements Serializable
Contains description of item's ownership. This class is a main information entry for all ownership features.
Since:
0.0.3
Author:
Oleg Nenashev
See Also:
  • Field Details

    • DISABLED_DESCR

      public static final OwnershipDescription DISABLED_DESCR
      Disabled description, which means that ownership is disabled
  • Constructor Details

    • OwnershipDescription

      @Deprecated public OwnershipDescription(boolean ownershipEnabled, @Nonnull String primaryOwnerId)
      Deprecated.
      Use constructor with secondary owners specification
      Constructor.
      Parameters:
      ownershipEnabled - indicates that the ownership is enabled
      primaryOwnerId - userId of primary owner
    • OwnershipDescription

      public OwnershipDescription(boolean ownershipEnabled, @Nullable String primaryOwnerId, @Nullable Collection<String> secondaryOwnerIds)
      Constructor. Class is being used as DataBound in OwnerNodeProperty.
      Parameters:
      ownershipEnabled - Indicates that the ownership is enabled.
      primaryOwnerId - userId of primary owner. Use null if there is no owner
      secondaryOwnerIds - userIds of secondary owners. Use null if there is no secondary owners.
  • Method Details

    • assign

      public void assign(@Nonnull OwnershipDescription descr)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isOwnershipEnabled

      public boolean isOwnershipEnabled()
      Check if ownership is enabled.
      Returns:
      true if ownership is enabled
    • getPrimaryOwnerId

      @Nonnull public String getPrimaryOwnerId()
      Gets id of primary owner.
      Returns:
      userId of the primary owner. The result will be "unknown" if the user is not specified.
    • getPrimaryOwner

      @CheckForNull public User getPrimaryOwner()
      Get primary owner.
      Returns:
      Primary owner's user. The result may be null if someone deletes a user.
    • getCoownersIds

      @Nonnull @Deprecated public Set<String> getCoownersIds()
      Deprecated.
      Gets list of secondary owners (fka co-owners).
      Returns:
      Collection of secondary owners
    • getSecondaryOwnerIds

      @Nonnull public Set<String> getSecondaryOwnerIds()
      Gets list of secondary owners.
      Returns:
      Collection of secondary owners
      Since:
      0.9
    • Parse

      @Nonnull @Deprecated public static OwnershipDescription Parse(net.sf.json.JSONObject formData) throws Descriptor.FormException
      Deprecated.
      Throws:
      Descriptor.FormException
    • parseJSON

      @Nonnull public static OwnershipDescription parseJSON(net.sf.json.JSONObject formData) throws Descriptor.FormException
      Parse a JSON input to construct the ownership description.
      Parameters:
      formData - Object with a data
      Returns:
      Ownership Description
      Throws:
      Descriptor.FormException - Parsing error
    • isOwner

      public boolean isOwner(User user, boolean includeSecondaryOwners)
      Check if User is an owner.
      Parameters:
      user - User to be checked
      includeSecondaryOwners - Check if user belongs to secondary owners
      Returns:
      true if the user belongs to primary owners (and/or secondary owners)
    • hasPrimaryOwner

      public boolean hasPrimaryOwner()
    • isPrimaryOwner

      public boolean isPrimaryOwner(@CheckForNull User user)
      Checks if the specified user is a primary owner.
      Parameters:
      user - User to be checked
      Returns:
      true if the user is a primary owner
    • getOwnerId

      @Deprecated @Nonnull public String getOwnerId()
      Deprecated.
      Gets ID of the primary owner.
      Returns:
      userId of the primary owner. The result will be "unknown" if the user is not specified.
      Since:
      0.9
    • getOwnerEmail

      @Nonnull @Deprecated public String getOwnerEmail()
      Deprecated.
      Gets primary owner's e-mail. This method utilizes OwnershipPlugin global configuration to resolve emails.
      Returns:
      Primary owner's e-mail or empty string if it is not available
      Since:
      0.9
    • getPrimaryOwnerEmail

      @Nonnull public String getPrimaryOwnerEmail()
      Gets primary owner's e-mail. This method utilizes OwnershipPlugin global configuration to resolve emails.
      Returns:
      Primary owner's e-mail or empty string if it is not available
      Since:
      0.9
    • getCoOwnerIds

      @Deprecated @Nonnull public Set<String> getCoOwnerIds()
      Deprecated.
      Gets a comma-separated list of co-owners.
      Returns:
      List of co-owner user IDs
    • getCoOwnerEmails

      @Deprecated @Nonnull public Set<String> getCoOwnerEmails()
      Deprecated.
      Gets e-mails of secondary owners. This method utilizes OwnershipPlugin global configuration to resolve emails.
      Returns:
      List of secondary owner e-mails (may be empty)
    • getSecondaryOwnerEmails

      @Nonnull public Set<String> getSecondaryOwnerEmails()
      Gets e-mails of secondary owners. This method utilizes OwnershipPlugin global configuration to resolve emails.
      Returns:
      List of secondary owner e-mails (may be empty)
      Since:
      0.9
    • hashCode

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

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

      protected Object readResolve() throws ObjectStreamException
      Throws:
      ObjectStreamException
    • isEnabled

      public static boolean isEnabled(OwnershipDescription descr)
      Check if ownership is enabled.
      Parameters:
      descr - Ownership description (can be null)
      Returns:
      True if the ownership is enabled
      Since:
      0.1