use of org.springframework.cache.annotation.Cacheable in project ORCID-Source by ORCID.
the class ProfileKeywordDaoImpl method getProfileKeywors.
/**
* Return the list of keywords associated to a specific profile
* @param orcid
* @return
* the list of keywords associated with the orcid profile
* */
@Override
@SuppressWarnings("unchecked")
@Cacheable(value = "dao-keywords", key = "#orcid.concat('-').concat(#lastModified)")
public List<ProfileKeywordEntity> getProfileKeywors(String orcid, long lastModified) {
Query query = entityManager.createQuery("FROM ProfileKeywordEntity WHERE profile.id = :orcid order by displayIndex desc, dateCreated asc");
query.setParameter("orcid", orcid);
return query.getResultList();
}
use of org.springframework.cache.annotation.Cacheable in project ORCID-Source by ORCID.
the class ResearcherUrlDaoImpl method getResearcherUrls.
/**
* Return the list of researcher urls associated to a specific profile
* @param orcid
* @return
* the list of researcher urls associated with the orcid profile
* */
@Override
@SuppressWarnings("unchecked")
@Cacheable(value = "dao-researcher-urls", key = "#orcid.concat('-').concat(#lastModified)")
public List<ResearcherUrlEntity> getResearcherUrls(String orcid, long lastModified) {
Query query = entityManager.createQuery("FROM ResearcherUrlEntity WHERE orcid = :orcid order by displayIndex desc, dateCreated asc");
query.setParameter("orcid", orcid);
return query.getResultList();
}
use of org.springframework.cache.annotation.Cacheable in project ORCID-Source by ORCID.
the class LocaleManagerImpl method getJavascriptMessages.
@Cacheable(value = "locale-messages", key = "#locale.toString().concat('-javascript')")
public org.orcid.pojo.Local getJavascriptMessages(Locale locale) {
org.orcid.pojo.Local lPojo = new org.orcid.pojo.Local();
lPojo.setLocale(locale.toString());
ResourceBundle resource = ResourceBundle.getBundle("i18n/javascript", locale, new UTF8Control());
lPojo.setMessages(OrcidStringUtils.resourceBundleToMap(resource));
return lPojo;
}
use of org.springframework.cache.annotation.Cacheable in project ORCID-Source by ORCID.
the class LocaleManagerImpl method getCountries.
/*
* Get country names from i18n files
*/
@Cacheable(value = "locale-messages", key = "#locale.toString().concat('-countries-map')")
public Map<String, String> getCountries(Locale locale) {
ResourceBundle resource = ResourceBundle.getBundle("i18n/messages", locale, new UTF8Control());
Map<String, String> dbCountries = countryManager.retrieveCountriesAndIsoCodes();
Map<String, String> countries = new LinkedHashMap<String, String>();
for (String key : dbCountries.keySet()) {
countries.put(key, resource.getString(buildInternationalizationKey(CountryIsoEntity.class, key)));
}
FunctionsOverCollections.sortMapsByValues(countries);
return countries;
}
use of org.springframework.cache.annotation.Cacheable in project ORCID-Source by ORCID.
the class ActivityCacheManagerImpl method affiliationMap.
@Cacheable(value = "pub-affiliation-maps", key = "#orcid.concat('-').concat(#lastModified)")
public LinkedHashMap<Long, Affiliation> affiliationMap(String orcid, long lastModified) {
LinkedHashMap<Long, Affiliation> affiliationMap = new LinkedHashMap<>();
List<Affiliation> affiliations = affiliationsManager.getAffiliations(orcid);
for (Affiliation affiliation : affiliations) {
if (Visibility.PUBLIC.equals(affiliation.getVisibility())) {
affiliationMap.put(affiliation.getPutCode(), affiliation);
}
}
return affiliationMap;
}
Aggregations