Search in sources :

Example 11 with Preferences

use of org.apereo.portal.soffit.model.v1_0.Preferences in project ORCID-Source by ORCID.

the class ValidateV2RC4SamplesTest method testMarshallPreferences.

@Test
public void testMarshallPreferences() throws JAXBException, SAXException, URISyntaxException {
    Preferences object = (Preferences) unmarshallFromPath("/record_2.0_rc4/samples/preferences-2.0_rc4.xml", Preferences.class);
    marshall(object, "/record_2.0_rc4/preferences-2.0_rc4.xsd");
}
Also used : Preferences(org.orcid.jaxb.model.record_rc4.Preferences) Test(org.junit.Test)

Example 12 with Preferences

use of org.apereo.portal.soffit.model.v1_0.Preferences in project ORCID-Source by ORCID.

the class ValidateV2_1SamplesTest method testMarshallPreferences.

@Test
public void testMarshallPreferences() throws JAXBException, SAXException, URISyntaxException {
    Preferences object = (Preferences) unmarshallFromPath("/record_2.1/samples/read_samples/preferences-2.1.xml", Preferences.class);
    marshall(object, "/record_2.1/preferences-2.1.xsd");
}
Also used : Preferences(org.orcid.jaxb.model.record_v2.Preferences) Test(org.junit.Test)

Example 13 with Preferences

use of org.apereo.portal.soffit.model.v1_0.Preferences in project uPortal by Jasig.

the class PreferencesHeaderProvider method createHeader.

@Override
public Header createHeader(RenderRequest renderRequest, RenderResponse renderResponse) {
    // Username
    final String username = getUsername(renderRequest);
    // PreferencesMap
    final Map<String, List<String>> preferencesMap = new HashMap<>();
    final PortletPreferences prefs = renderRequest.getPreferences();
    for (Map.Entry<String, String[]> y : prefs.getMap().entrySet()) {
        final String name = y.getKey();
        /*
             * We ignore (skip) preferences that exist for the benefit of the
             * SoffitConnectorController.
             */
        if (name.startsWith(SoffitConnectorController.CONNECTOR_PREFERENCE_PREFIX)) {
            continue;
        }
        List<String> values = Arrays.asList(prefs.getValues(name, new String[0]));
        if (!values.isEmpty()) {
            preferencesMap.put(name, values);
        }
    }
    // Preferences header
    final Preferences preferences = preferencesService.createPreferences(preferencesMap, username, getExpiration(renderRequest));
    final Header rslt = new BasicHeader(Headers.PREFERECES.getName(), preferences.getEncryptedToken());
    logger.debug("Produced the following Preferences header for username='{}':  {}", username, rslt);
    return rslt;
}
Also used : Header(org.apache.http.Header) BasicHeader(org.apache.http.message.BasicHeader) HashMap(java.util.HashMap) List(java.util.List) PortletPreferences(javax.portlet.PortletPreferences) PortletPreferences(javax.portlet.PortletPreferences) Preferences(org.apereo.portal.soffit.model.v1_0.Preferences) HashMap(java.util.HashMap) Map(java.util.Map) BasicHeader(org.apache.http.message.BasicHeader)

Example 14 with Preferences

use of org.apereo.portal.soffit.model.v1_0.Preferences in project uPortal by Jasig.

the class PortalRequestHeaderProvider method createHeader.

@Override
public Header createHeader(RenderRequest renderRequest, RenderResponse renderResponse) {
    // Username
    final String username = getUsername(renderRequest);
    // Properties
    final Map<String, String> properties = new HashMap<>();
    final Enumeration<String> names = renderRequest.getPropertyNames();
    for (String propertyName = names.nextElement(); names.hasMoreElements(); propertyName = names.nextElement()) {
        properties.put(propertyName, renderRequest.getProperty(propertyName));
    }
    // Attributes
    final Map<String, List<String>> attributes = new HashMap<>();
    attributes.put(Attributes.NAMESPACE.getName(), Collections.singletonList(NAMESPACE_PREFIX + renderRequest.getWindowID()));
    attributes.put(Attributes.MODE.getName(), Collections.singletonList(renderRequest.getPortletMode().toString()));
    attributes.put(Attributes.WINDOW_STATE.getName(), Collections.singletonList(renderRequest.getWindowState().toString()));
    attributes.put(Attributes.PORTAL_INFO.getName(), Collections.singletonList(renderRequest.getPortalContext().getPortalInfo()));
    attributes.put(Attributes.SCHEME.getName(), Collections.singletonList(renderRequest.getScheme()));
    attributes.put(Attributes.SERVER_NAME.getName(), Collections.singletonList(renderRequest.getServerName()));
    attributes.put(Attributes.SERVER_PORT.getName(), Collections.singletonList(Integer.valueOf(renderRequest.getServerPort()).toString()));
    attributes.put(Attributes.SECURE.getName(), Collections.singletonList(Boolean.valueOf(renderRequest.isSecure()).toString()));
    // Parameters
    final Map<String, List<String>> parameters = new HashMap<>();
    for (Map.Entry<String, String[]> y : renderRequest.getParameterMap().entrySet()) {
        parameters.put(y.getKey(), Arrays.asList(y.getValue()));
    }
    // Preferences header
    final PortalRequest portalRequest = portalRequestService.createPortalRequest(properties, attributes, parameters, username, getExpiration(renderRequest));
    final Header rslt = new BasicHeader(Headers.PORTAL_REQUEST.getName(), portalRequest.getEncryptedToken());
    logger.debug("Produced the following PortalRequest header for username='{}':  {}", username, rslt);
    return rslt;
}
Also used : BasicHeader(org.apache.http.message.BasicHeader) Header(org.apache.http.Header) BasicHeader(org.apache.http.message.BasicHeader) PortalRequest(org.apereo.portal.soffit.model.v1_0.PortalRequest)

Example 15 with Preferences

use of org.apereo.portal.soffit.model.v1_0.Preferences in project uPortal by Jasig.

the class SoffitRendererController method render.

@RequestMapping(value = "/{module}", method = RequestMethod.GET)
public ModelAndView render(final HttpServletRequest req, final HttpServletResponse res, @PathVariable final String module) {
    logger.debug("Rendering for request URI '{}'", req.getRequestURI());
    // Soffit Object Model
    final PortalRequest portalRequest = getPortalRequest(req);
    final Bearer bearer = getBearer(req);
    final Preferences preferences = getPreferences(req);
    final Definition definition = getDefinition(req);
    // Select a view
    final String viewName = selectView(req, module, portalRequest);
    final Map<String, Object> model = modelAttributeService.gatherModelAttributes(viewName, req, res, portalRequest, bearer, preferences, definition);
    model.put(PORTAL_REQUEST_MODEL_NAME, portalRequest);
    model.put(BEARER_MODEL_NAME, bearer);
    model.put(PREFERENCES_MODEL_NAME, preferences);
    model.put(DEFINITION_MODEL_NAME, definition);
    // Set up cache headers appropriately
    configureCacheHeaders(res, module);
    return new ModelAndView(viewName, model);
}
Also used : Definition(org.apereo.portal.soffit.model.v1_0.Definition) ModelAndView(org.springframework.web.servlet.ModelAndView) Preferences(org.apereo.portal.soffit.model.v1_0.Preferences) Bearer(org.apereo.portal.soffit.model.v1_0.Bearer) PortalRequest(org.apereo.portal.soffit.model.v1_0.PortalRequest) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

Preferences (com.fsck.k9.Preferences)17 Account (com.fsck.k9.Account)13 Test (org.junit.Test)12 Preferences (org.apereo.portal.soffit.model.v1_0.Preferences)5 Preferences (org.orcid.jaxb.model.record_v2.Preferences)5 StorageEditor (com.fsck.k9.preferences.StorageEditor)4 SearchAccount (com.fsck.k9.search.SearchAccount)4 HashMap (java.util.HashMap)4 PortalRequest (org.apereo.portal.soffit.model.v1_0.PortalRequest)4 InvalidSettingValueException (com.fsck.k9.preferences.Settings.InvalidSettingValueException)3 Storage (com.fsck.k9.preferences.Storage)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 Map (java.util.Map)3 Bearer (org.apereo.portal.soffit.model.v1_0.Bearer)3 Definition (org.apereo.portal.soffit.model.v1_0.Definition)3 Intent (android.content.Intent)2 SharedPreferences (android.content.SharedPreferences)2 Uri (android.net.Uri)2 UnavailableStorageException (com.fsck.k9.mailstore.UnavailableStorageException)2