Class FavoriteUserProperty

java.lang.Object
hudson.model.UserProperty
hudson.plugins.favorite.user.FavoriteUserProperty
All Implemented Interfaces:
ExtensionPoint, Action, Describable<UserProperty>, ModelObject, ReconfigurableDescribable<UserProperty>

@ExportedBean(defaultVisibility=999) public class FavoriteUserProperty extends UserProperty implements Action
Do not use directly. Instead @Inject Favorites.
  • Field Details

  • Constructor Details

    • FavoriteUserProperty

      @DataBoundConstructor public FavoriteUserProperty()
  • Method Details

    • getUser

      public User getUser()
    • getFavorites

      @Deprecated public List<String> getFavorites()
      Deprecated.
      Use {#getAllFavorites()}
      Returns:
      unmodifiable favorites job set
    • getFavoritesSortedByDisplayName

      @Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public List<Item> getFavoritesSortedByDisplayName()
    • getAllFavorites

      public Set<String> getAllFavorites()
      Get all favorite jobs.
      Returns:
      unmodifiable favorites job set
    • addFavorite

      public void addFavorite(@NonNull String job) throws IOException
      Add favorite job.
      Parameters:
      job - job full name
      Throws:
      IOException - if error saving status
    • removeFavorite

      public void removeFavorite(@NonNull String job) throws IOException
      Set un-favorite a job.
      Parameters:
      job - full job name
      Throws:
      IOException - if error saving status
    • toggleFavorite

      public boolean toggleFavorite(@NonNull String job) throws IOException
      If job is favorited, then un-favorite it, else favorite it.
      Parameters:
      job - full job name
      Returns:
      true if the new status is favorite, false if new status is not favorite.
      Throws:
      IOException - if error saving status
    • reconfigure

      public UserProperty reconfigure(org.kohsuke.stapler.StaplerRequest2 req, net.sf.json.JSONObject form) throws Descriptor.FormException
      Specified by:
      reconfigure in interface ReconfigurableDescribable<UserProperty>
      Overrides:
      reconfigure in class UserProperty
      Throws:
      Descriptor.FormException
    • isJobFavorite

      public boolean isJobFavorite(String job)
    • hasFavorite

      public boolean hasFavorite(String job)
      Checks if the user has a favorite entry for this job e.g. this is true when the user has favoriteted or unfavoriteted a job but not true for when a job has not been favorited by this user
      Parameters:
      job - path
      Returns:
      favorite
    • getDescriptor

      public UserPropertyDescriptor getDescriptor()
      Specified by:
      getDescriptor in interface Describable<UserProperty>
      Overrides:
      getDescriptor in class UserProperty
    • getIconFileName

      public String getIconFileName()
      Specified by:
      getIconFileName in interface Action
    • getDisplayName

      public String getDisplayName()
      Specified by:
      getDisplayName in interface Action
      Specified by:
      getDisplayName in interface ModelObject
    • getUrlName

      public String getUrlName()
      Specified by:
      getUrlName in interface Action