Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package hudson.plugins.favorite.filter;
 
 
public class FavoriteFilter extends ViewJobFilter {
    public FavoriteFilter() {
    }
    @Override
    public List<TopLevelItemfilter(List<TopLevelItemaddedList<TopLevelItemallView filteringView) {
        List<TopLevelItemfiltered = new ArrayList<TopLevelItem>(added);
        Authentication authentication = Hudson.getAuthentication();
        String name = authentication.getName();
        if (authentication.isAuthenticated()) {
            User user = Hudson.getInstance().getUser(name);
            FavoriteUserProperty fup = user.getProperty(FavoriteUserProperty.class);
            for (TopLevelItem item : all) {
               if (fup == null || !fup.isJobFavorite(item.getName())) {
                   filtered.remove(item);
               }
           }
        }
        return filtered;
    }
New to GrepCode? Check out our FAQ X