Search in sources :

Example 16 with Preferences

use of com.fsck.k9.Preferences in project ORCID-Source by ORCID.

the class RecordManagerReadOnlyImpl method getPreferences.

private Preferences getPreferences(String orcid) {
    Preferences preferences = new Preferences();
    ProfileEntity profile = profileEntityCacheManager.retrieve(orcid);
    org.orcid.jaxb.model.common_v2.Locale profileEntityLocale = profile.getLocale();
    if (profileEntityLocale != null) {
        preferences.setLocale(profileEntityLocale);
    }
    return preferences;
}
Also used : Preferences(org.orcid.jaxb.model.record_v2.Preferences) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity)

Example 17 with Preferences

use of com.fsck.k9.Preferences in project ORCID-Source by ORCID.

the class ValidateV2SamplesTest method testUnmarshallPreferences.

@Test
public void testUnmarshallPreferences() throws SAXException, URISyntaxException {
    Preferences preferences = (Preferences) unmarshallFromPath("/record_2.0/samples/read_samples/preferences-2.0.xml", Preferences.class, "/record_2.0/preferences-2.0.xsd");
    assertNotNull(preferences);
    assertNotNull(preferences.getLocale());
    assertEquals(Locale.EN, preferences.getLocale());
}
Also used : Preferences(org.orcid.jaxb.model.record_v2.Preferences) Test(org.junit.Test)

Example 18 with Preferences

use of com.fsck.k9.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 19 with Preferences

use of com.fsck.k9.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 20 with Preferences

use of com.fsck.k9.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)

Aggregations

Preferences (com.fsck.k9.Preferences)17 Account (com.fsck.k9.Account)15 Test (org.junit.Test)12 StorageEditor (com.fsck.k9.preferences.StorageEditor)9 Storage (com.fsck.k9.preferences.Storage)6 Preferences (org.apereo.portal.soffit.model.v1_0.Preferences)5 Preferences (org.orcid.jaxb.model.record_v2.Preferences)5 SharedPreferences (android.content.SharedPreferences)4 Intent (android.content.Intent)3 Uri (android.net.Uri)3 MessagingException (com.fsck.k9.mail.MessagingException)3 NetworkType (com.fsck.k9.mail.NetworkType)3 SearchAccount (com.fsck.k9.search.SearchAccount)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 Map (java.util.Map)3 CheckBoxPreference (android.preference.CheckBoxPreference)2 ListPreference (android.preference.ListPreference)2 Preference (android.preference.Preference)2