use of javax.portlet.PortletPreferences in project uPortal by Jasig.
the class JspInvokerPortletController method addSecurityRoleChecksToModel.
/**
* Run through the list of configured security roles and add an "is"+Rolename to the model. The
* security roles must also be defined with a <code><security-role-ref></code> element in
* the portlet.xml.
*
* @param req Portlet request
* @param model Model object to add security indicators to
*/
private void addSecurityRoleChecksToModel(PortletRequest req, Map<String, Object> model) {
PortletPreferences prefs = req.getPreferences();
String[] securityRoles = prefs.getValues(PREF_SECURITY_ROLE_NAMES, new String[] {});
for (int i = 0; i < securityRoles.length; i++) {
model.put("is" + securityRoles[i].replace(" ", "_"), req.isUserInRole(securityRoles[i]));
}
}
use of javax.portlet.PortletPreferences in project uPortal by Jasig.
the class JspInvokerPortletController method getPreferences.
private Map<String, List<String>> getPreferences(PortletRequest req) {
// default
Map<String, List<String>> rslt = new HashMap<String, List<String>>();
PortletPreferences prefs = req.getPreferences();
List<String> names = Collections.list(prefs.getNames());
for (String name : names) {
if (!name.startsWith(CONTROLLER_PREFERENCE_PREFIX)) {
// Pass it along in the model
List<String> values = Arrays.asList(prefs.getValues(name, new String[] {}));
rslt.put(name, values);
}
}
logger.debug("Invoking with preferences={}", rslt);
return rslt;
}
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);
}
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;
}
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);
}
Aggregations