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;
}
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());
}
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");
}
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");
}
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;
}
Aggregations