use of org.springframework.cache.annotation.CachePut in project entando-core by entando.
the class UserProfileManager method getProfile.
@Override
@CachePut(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "'UserProfile_'.concat(#username)")
@CacheableInfo(groups = "'UserProfileTypes_cacheGroup'")
public IUserProfile getProfile(String username) throws ApsSystemException {
IUserProfile profile = null;
try {
UserProfileRecord profileVO = (UserProfileRecord) this.getProfileDAO().loadEntityRecord(username);
if (profileVO != null) {
profile = (IUserProfile) this.createEntityFromXml(profileVO.getTypeCode(), profileVO.getXml());
profile.setPublicProfile(profileVO.isPublicProfile());
}
} catch (Throwable t) {
logger.error("Error loading profile. user: {} ", username, t);
throw new ApsSystemException("Error loading profile", t);
}
return profile;
}
use of org.springframework.cache.annotation.CachePut in project entando-core by entando.
the class SocialActivityStreamManager method getActionLikeRecords.
@Override
@CachePut(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "'ActivityStreamLikeRecords_id_'.concat(#id)")
@CacheableInfo(groups = "'ActivityStreamLikeRecords_cacheGroup'")
public List<ActivityStreamLikeInfo> getActionLikeRecords(int id) throws ApsSystemException {
List<ActivityStreamLikeInfo> infos = null;
try {
infos = this.getSocialActivityStreamDAO().getActionLikeRecords(id);
if (null != infos) {
for (int i = 0; i < infos.size(); i++) {
ActivityStreamLikeInfo asli = infos.get(i);
String username = asli.getUsername();
IUserProfile profile = this.getUserProfileManager().getProfile(username);
String displayName = (null != profile) ? profile.getDisplayName() : username;
asli.setDisplayName(displayName);
}
}
} catch (Throwable t) {
_logger.error("Error extracting activity stream like records", t);
throw new ApsSystemException("Error extracting activity stream like records", t);
}
return infos;
}
use of org.springframework.cache.annotation.CachePut in project entando-core by entando.
the class SocialActivityStreamManager method getActionCommentRecords.
@Override
@CachePut(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "'ActivityStreamCommentRecords_id_'.concat(#id)")
@CacheableInfo(groups = "'ActivityStreamCommentRecords_cacheGroup'")
public List<ActivityStreamComment> getActionCommentRecords(int id) throws ApsSystemException {
List<ActivityStreamComment> infos = null;
try {
infos = this.getSocialActivityStreamDAO().getActionCommentRecords(id);
if (null != infos) {
for (int i = 0; i < infos.size(); i++) {
ActivityStreamComment comment = infos.get(i);
String username = comment.getUsername();
IUserProfile profile = this.getUserProfileManager().getProfile(username);
String displayName = (null != profile) ? profile.getDisplayName() : username;
comment.setDisplayName(displayName);
}
}
} catch (Throwable t) {
_logger.error("Error extracting activity stream like records for stream with id {}", id, t);
throw new ApsSystemException("Error extracting activity stream like records", t);
}
return infos;
}
use of org.springframework.cache.annotation.CachePut in project entando-core by entando.
the class ContentAuthorizationHelper method getAuthorizationInfo.
@Override
@CachePut(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "T(com.agiletec.plugins.jacms.aps.system.JacmsSystemConstants).CONTENT_AUTH_INFO_CACHE_PREFIX.concat(#contentId)")
@CacheableInfo(groups = "T(com.agiletec.plugins.jacms.aps.system.services.cache.CmsCacheWrapperManager).getContentCacheGroupsCsv(#contentId)")
public PublicContentAuthorizationInfo getAuthorizationInfo(String contentId) {
PublicContentAuthorizationInfo authInfo = null;
try {
Content content = this.getContentManager().loadContent(contentId, true);
if (null == content) {
_logger.debug("public content {} doesn't exist", contentId);
return null;
}
authInfo = new PublicContentAuthorizationInfo(content, this.getLangManager().getLangs());
} catch (Throwable t) {
_logger.error("error in getAuthorizationInfo for content {}", contentId, t);
}
return authInfo;
}
use of org.springframework.cache.annotation.CachePut in project entando-core by entando.
the class ContentListHelper method getContentsId.
@Override
@CachePut(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "T(com.agiletec.plugins.jacms.aps.system.services.content.widget.ContentListHelper).buildCacheKey(#bean, #reqCtx)", condition = "#bean.cacheable && !T(com.agiletec.plugins.jacms.aps.system.services.content.widget.ContentListHelper).isUserFilterExecuted(#bean)")
@CacheableInfo(groups = "T(com.agiletec.plugins.jacms.aps.system.services.cache.CmsCacheWrapperManager).getContentListCacheGroupsCsv(#bean, #reqCtx)", expiresInMinute = 30)
public List<String> getContentsId(IContentListTagBean bean, RequestContext reqCtx) throws Throwable {
this.releaseCache(bean, reqCtx);
List<String> contentsId = null;
try {
contentsId = this.extractContentsId(bean, reqCtx);
contentsId = this.executeFullTextSearch(bean, contentsId, reqCtx);
} catch (Throwable t) {
_logger.error("Error extracting contents id", t);
throw new ApsSystemException("Error extracting contents id", t);
}
return contentsId;
}
Aggregations