Package hudson.plugins.favorite.user
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 @InjectFavorites
.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
-
Field Summary
Fields Modifier and Type Field Description static UserPropertyDescriptor
DESCRIPTOR
-
Fields inherited from class hudson.model.UserProperty
user
-
-
Constructor Summary
Constructors Constructor Description FavoriteUserProperty()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
addFavorite(String job)
Add favorite job.Set<String>
getAllFavorites()
Get all favorite jobs.UserPropertyDescriptor
getDescriptor()
String
getDisplayName()
List<String>
getFavorites()
Deprecated.String
getIconFileName()
String
getUrlName()
User
getUser()
boolean
hasFavorite(String job)
Checks if the user has a favorite entry for this job e.g.boolean
isJobFavorite(String job)
UserProperty
reconfigure(org.kohsuke.stapler.StaplerRequest req, net.sf.json.JSONObject form)
void
removeFavorite(String job)
Set un-favorite a job.boolean
toggleFavorite(String job)
If job is favorited, then un-favorite it, else favorite it.-
Methods inherited from class hudson.model.UserProperty
all, setUser
-
-
-
-
Field Detail
-
DESCRIPTOR
@Extension public static final UserPropertyDescriptor DESCRIPTOR
-
-
Method Detail
-
getUser
public User getUser()
-
getFavorites
@Deprecated public List<String> getFavorites()
Deprecated.Use {#getAllFavorites()}- Returns:
- unmodifiable favorites job set
-
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.StaplerRequest req, net.sf.json.JSONObject form) throws Descriptor.FormException
- Specified by:
reconfigure
in interfaceReconfigurableDescribable<UserProperty>
- Overrides:
reconfigure
in classUserProperty
- 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 interfaceDescribable<UserProperty>
- Overrides:
getDescriptor
in classUserProperty
-
getIconFileName
public String getIconFileName()
- Specified by:
getIconFileName
in interfaceAction
-
getDisplayName
public String getDisplayName()
- Specified by:
getDisplayName
in interfaceAction
- Specified by:
getDisplayName
in interfaceModelObject
-
getUrlName
public String getUrlName()
- Specified by:
getUrlName
in interfaceAction
-
-