Search in sources :

Example 16 with Cacheable

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();
}
Also used : Query(javax.persistence.Query) Cacheable(org.springframework.cache.annotation.Cacheable)

Example 17 with Cacheable

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();
}
Also used : Query(javax.persistence.Query) TypedQuery(javax.persistence.TypedQuery) Cacheable(org.springframework.cache.annotation.Cacheable)

Example 18 with Cacheable

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;
}
Also used : ResourceBundle(java.util.ResourceBundle) UTF8Control(org.orcid.utils.UTF8Control) Cacheable(org.springframework.cache.annotation.Cacheable)

Example 19 with Cacheable

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;
}
Also used : ResourceBundle(java.util.ResourceBundle) UTF8Control(org.orcid.utils.UTF8Control) LinkedHashMap(java.util.LinkedHashMap) Cacheable(org.springframework.cache.annotation.Cacheable)

Example 20 with Cacheable

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;
}
Also used : LinkedHashMap(java.util.LinkedHashMap) Affiliation(org.orcid.jaxb.model.record_v2.Affiliation) Cacheable(org.springframework.cache.annotation.Cacheable)

Aggregations

Cacheable (org.springframework.cache.annotation.Cacheable)27 Query (javax.persistence.Query)8 LinkedHashMap (java.util.LinkedHashMap)6 TypedQuery (javax.persistence.TypedQuery)4 HashMap (java.util.HashMap)3 IdentifierType (org.orcid.pojo.IdentifierType)3 ByteArrayOutputStream (java.io.ByteArrayOutputStream)2 ResourceBundle (java.util.ResourceBundle)2 Workbook (org.apache.poi.ss.usermodel.Workbook)2 RecordCorrection (org.orcid.model.record_correction.RecordCorrection)2 RecordCorrectionsPage (org.orcid.model.record_correction.RecordCorrectionsPage)2 IdentifierTypeEntity (org.orcid.persistence.jpa.entities.IdentifierTypeEntity)2 InvalidRecordDataChangeEntity (org.orcid.persistence.jpa.entities.InvalidRecordDataChangeEntity)2 SecurityQuestionEntity (org.orcid.persistence.jpa.entities.SecurityQuestionEntity)2 UTF8Control (org.orcid.utils.UTF8Control)2 RoleResource (com.baidu.disconf.web.service.roleres.bo.RoleResource)1 Builder (com.google.common.collect.ImmutableList.Builder)1 ApiMetaDataBo (com.navercorp.pinpoint.common.server.bo.ApiMetaDataBo)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1