Search in sources :

Example 1 with FavoriteUserProperty

use of hudson.plugins.favorite.user.FavoriteUserProperty in project blueocean-plugin by jenkinsci.

the class FavoriteListStatePreloader method getStateJson.

@CheckForNull
@Override
public String getStateJson() {
    User jenkinsUser = User.current();
    if (jenkinsUser == null) {
        return null;
    }
    FavoriteUserProperty fup = jenkinsUser.getProperty(FavoriteUserProperty.class);
    if (fup == null) {
        return null;
    }
    Set<String> favorites = fup.getAllFavorites();
    if (favorites == null) {
        return null;
    }
    return JSONArray.fromObject(favorites).toString();
}
Also used : FavoriteUserProperty(hudson.plugins.favorite.user.FavoriteUserProperty) User(hudson.model.User) CheckForNull(javax.annotation.CheckForNull)

Aggregations

User (hudson.model.User)1 FavoriteUserProperty (hudson.plugins.favorite.user.FavoriteUserProperty)1 CheckForNull (javax.annotation.CheckForNull)1