Search in sources :

Example 26 with PortletPreferences

use of javax.portlet.PortletPreferences in project uPortal by Jasig.

the class ActivityController method summary.

@RenderMapping
public ModelAndView summary(PortletRequest request) throws TypeMismatchException {
    final Map<String, Object> model = new HashMap<String, Object>();
    final PortalActivity now = buildPortalActivity(request, NOW);
    final PortalActivity today = buildPortalActivity(request, TODAY);
    final PortalActivity yesterday = buildPortalActivity(request, YESTERDAY);
    model.put("usageNow", now);
    model.put("usageToday", today);
    model.put("usageYesterday", yesterday);
    // Searches
    // default
    List<SearchInfo> popularSearchTerms = Collections.emptyList();
    final PortletPreferences prefs = request.getPreferences();
    final Boolean showSearches = Boolean.valueOf(prefs.getValue(PREFERENCE_SHOW_SEACHES, DEFAULT_PREFERENCE_SHOW_SEARCHES));
    if (showSearches) {
        popularSearchTerms = getPopularSearchTerms();
    }
    model.put("showSearches", showSearches);
    model.put("popularSearchTerms", popularSearchTerms);
    return new ModelAndView("jsp/Activity/activity", model);
}
Also used : HashMap(java.util.HashMap) ModelAndView(org.springframework.web.servlet.ModelAndView) PortletPreferences(javax.portlet.PortletPreferences) RenderMapping(org.springframework.web.portlet.bind.annotation.RenderMapping)

Example 27 with PortletPreferences

use of javax.portlet.PortletPreferences in project uPortal by Jasig.

the class RoleBasedBackgroundSetSelectionStrategy method getBackgroundContainerSelector.

@Override
public String getBackgroundContainerSelector(PortletRequest req) {
    PreferenceNames names = PreferenceNames.getInstance(req);
    PortletPreferences prefs = req.getPreferences();
    return prefs.getValue(names.getBackgroundContainerSelectorPreferenceName(), null);
}
Also used : PortletPreferences(javax.portlet.PortletPreferences)

Example 28 with PortletPreferences

use of javax.portlet.PortletPreferences in project uPortal by Jasig.

the class RoleBasedBackgroundSetSelectionStrategy method getImageSet.

@Override
public String[] getImageSet(PortletRequest req) {
    final PreferenceNames names = PreferenceNames.getInstance(req);
    final PortletPreferences prefs = req.getPreferences();
    final String[] images = prefs.getValues(names.getImageSetPreferenceName(), EMPTY_STRING_ARRAY);
    for (int i = 0; i < images.length; i++) {
        images[i] = evaluateImagePath(images[i]);
    }
    return images;
}
Also used : PortletPreferences(javax.portlet.PortletPreferences)

Example 29 with PortletPreferences

use of javax.portlet.PortletPreferences in project uPortal by Jasig.

the class RoleBasedBackgroundSetSelectionStrategy method getImageCaptions.

@Override
public String[] getImageCaptions(PortletRequest req) {
    PreferenceNames names = PreferenceNames.getInstance(req);
    PortletPreferences prefs = req.getPreferences();
    return prefs.getValues(names.IMAGE_CAPTIONS_PREFERENCE_NAME, null);
}
Also used : PortletPreferences(javax.portlet.PortletPreferences)

Example 30 with PortletPreferences

use of javax.portlet.PortletPreferences in project uPortal by Jasig.

the class RoleBasedBackgroundSetSelectionStrategy method getSelectedImage.

@Override
public String getSelectedImage(PortletRequest req) {
    // No evaluation required (already processed)
    PreferenceNames names = PreferenceNames.getInstance(req);
    PortletPreferences prefs = req.getPreferences();
    return prefs.getValue(names.getSelectedBackgroundImagePreferenceName(), null);
}
Also used : PortletPreferences(javax.portlet.PortletPreferences)

Aggregations

PortletPreferences (javax.portlet.PortletPreferences)38 HashMap (java.util.HashMap)10 RenderMapping (org.springframework.web.portlet.bind.annotation.RenderMapping)9 ModelAndView (org.springframework.web.portlet.ModelAndView)6 List (java.util.List)5 HttpServletRequest (javax.servlet.http.HttpServletRequest)5 IPerson (org.apereo.portal.security.IPerson)5 PortletRequest (javax.portlet.PortletRequest)4 ResourceMapping (org.springframework.web.portlet.bind.annotation.ResourceMapping)4 JsonNode (com.fasterxml.jackson.databind.JsonNode)3 LinkedHashMap (java.util.LinkedHashMap)3 Map (java.util.Map)3 Principal (java.security.Principal)2 ArrayList (java.util.ArrayList)2 HashSet (java.util.HashSet)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 Header (org.apache.http.Header)2 PortletCategory (org.apereo.portal.portlet.om.PortletCategory)2 MarketplaceEntry (org.apereo.portal.rest.layout.MarketplaceEntry)2 IAuthorizationPrincipal (org.apereo.portal.security.IAuthorizationPrincipal)2