Search in sources :

Example 11 with Cacheable

use of org.springframework.cache.annotation.Cacheable in project ORCID-Source by ORCID.

the class ActivityCacheManagerImpl method pubPeerReviewsMap.

@Cacheable(value = "pub-peer-reviews-maps", key = "#orcid.concat('-').concat(#lastModified)")
public LinkedHashMap<Long, PeerReview> pubPeerReviewsMap(String orcid, long lastModified) {
    List<PeerReview> peerReviews = peerReviewManager.findPeerReviews(orcid, lastModified);
    LinkedHashMap<Long, PeerReview> peerReviewMap = new LinkedHashMap<>();
    if (peerReviews != null) {
        if (!peerReviews.isEmpty()) {
            for (PeerReview peerReview : peerReviews) {
                if (peerReview.getVisibility().equals(Visibility.PUBLIC)) {
                    peerReviewMap.put(peerReview.getPutCode(), peerReview);
                }
            }
        }
    }
    return peerReviewMap;
}
Also used : PeerReview(org.orcid.jaxb.model.record_v2.PeerReview) LinkedHashMap(java.util.LinkedHashMap) Cacheable(org.springframework.cache.annotation.Cacheable)

Example 12 with Cacheable

use of org.springframework.cache.annotation.Cacheable in project ORCID-Source by ORCID.

the class AddressDaoImpl method getAddresses.

@SuppressWarnings("unchecked")
@Override
@Cacheable(value = "dao-address", key = "#orcid.concat('-').concat(#lastModified)")
public List<AddressEntity> getAddresses(String orcid, long lastModified) {
    Query query = entityManager.createQuery("FROM AddressEntity WHERE user.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 13 with Cacheable

use of org.springframework.cache.annotation.Cacheable in project ORCID-Source by ORCID.

the class WorkDaoImpl method findPublicWorks.

/**
     * @deprepcated Use {@link org.orcid.core.manager.WorkEntityCacheManager#retrievePublicMinimizedWorks(String, long)} instead
     * 
     * Find the public works for a specific user
     * 
     * @param orcid
     *            the Id of the user
     * @return the list of works associated to the specific user
     * */
@SuppressWarnings("unchecked")
@Cacheable(value = "dao-public-works", key = "#orcid.concat('-').concat(#lastModified)")
@Deprecated
public List<MinimizedWorkEntity> findPublicWorks(String orcid, long lastModified) {
    Query query = entityManager.createQuery("from MinimizedWorkEntity w " + "where w.visibility='PUBLIC' and w.orcid=:orcid " + "order by w.displayIndex desc, w.dateCreated asc");
    query.setParameter("orcid", orcid);
    return query.getResultList();
}
Also used : TypedQuery(javax.persistence.TypedQuery) Query(javax.persistence.Query) Cacheable(org.springframework.cache.annotation.Cacheable)

Example 14 with Cacheable

use of org.springframework.cache.annotation.Cacheable in project ORCID-Source by ORCID.

the class WorkDaoImpl method findWorks.

/**
     * @deprecated Use {@link org.orcid.core.manager.WorkEntityCacheManager#retrieveMinimizedWorks(String, long) } instead
     * 
     * Find works for a specific user
     * 
     * @param orcid
     *            the Id of the user
     * @return the list of works associated to the specific user
     * */
@SuppressWarnings("unchecked")
@Cacheable(value = "dao-works", key = "#orcid.concat('-').concat(#lastModified)")
@Deprecated
public List<MinimizedWorkEntity> findWorks(String orcid, long lastModified) {
    Query query = entityManager.createQuery("from MinimizedWorkEntity w " + "where w.orcid=:orcid " + "order by w.displayIndex desc, w.dateCreated asc");
    query.setParameter("orcid", orcid);
    return query.getResultList();
}
Also used : TypedQuery(javax.persistence.TypedQuery) Query(javax.persistence.Query) Cacheable(org.springframework.cache.annotation.Cacheable)

Example 15 with Cacheable

use of org.springframework.cache.annotation.Cacheable in project pinpoint by naver.

the class HbaseApiMetaDataDao method getApiMetaData.

@Override
@Cacheable(value = "apiMetaData", key = SPEL_KEY)
public List<ApiMetaDataBo> getApiMetaData(String agentId, long time, int apiId) {
    if (agentId == null) {
        throw new NullPointerException("agentId must not be null");
    }
    ApiMetaDataBo apiMetaDataBo = new ApiMetaDataBo(agentId, time, apiId);
    byte[] sqlId = getDistributedKey(apiMetaDataBo.toRowKey());
    Get get = new Get(sqlId);
    get.addFamily(HBaseTables.API_METADATA_CF_API);
    return hbaseOperations2.get(HBaseTables.API_METADATA, get, apiMetaDataMapper);
}
Also used : Get(org.apache.hadoop.hbase.client.Get) ApiMetaDataBo(com.navercorp.pinpoint.common.server.bo.ApiMetaDataBo) 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