Search in sources :

Example 6 with CacheableInfo

use of org.entando.entando.aps.system.services.cache.CacheableInfo in project entando-core by entando.

the class GuiFragmentManager method getGuiFragmentCodesByWidgetType.

@Override
@CachePut(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "'GuiFragment_codesByWidgetType_'.concat(#widgetTypeCode)")
// TODO improve group handling
@CacheableInfo(groups = "'GuiFragment_codesByWidgetTypeGroup'")
public List<String> getGuiFragmentCodesByWidgetType(String widgetTypeCode) throws ApsSystemException {
    List<String> codes = null;
    try {
        FieldSearchFilter filter = new FieldSearchFilter("widgettypecode", widgetTypeCode, false);
        filter.setOrder(FieldSearchFilter.Order.ASC);
        FieldSearchFilter[] filters = { filter };
        codes = this.searchGuiFragments(filters);
    } catch (Throwable t) {
        logger.error("Error loading fragments code by widget '{}'", widgetTypeCode, t);
        throw new ApsSystemException("Error loading fragment codes by widget " + widgetTypeCode, t);
    }
    return codes;
}
Also used : ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) FieldSearchFilter(com.agiletec.aps.system.common.FieldSearchFilter) CacheableInfo(org.entando.entando.aps.system.services.cache.CacheableInfo) CachePut(org.springframework.cache.annotation.CachePut)

Example 7 with CacheableInfo

use of org.entando.entando.aps.system.services.cache.CacheableInfo in project entando-core by entando.

the class BaseContentListHelper method getContentsId.

@Override
@CachePut(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "T(com.agiletec.plugins.jacms.aps.system.services.content.helper.BaseContentListHelper).buildCacheKey(#bean, #user)", condition = "#bean.cacheable")
@CacheableInfo(groups = "T(com.agiletec.plugins.jacms.aps.system.JacmsSystemConstants).CONTENTS_ID_CACHE_GROUP_PREFIX.concat(#bean.contentType)", expiresInMinute = 30)
public List<String> getContentsId(IContentListBean bean, UserDetails user) throws Throwable {
    this.releaseCache(bean, user);
    List<String> contentsId = null;
    try {
        if (null == bean.getContentType()) {
            throw new ApsSystemException("Content type not defined");
        }
        // this.getAllowedGroups(user);
        Collection<String> userGroupCodes = getAllowedGroupCodes(user);
        contentsId = this.getContentManager().loadPublicContentsId(bean.getContentType(), bean.getCategories(), bean.getFilters(), userGroupCodes);
    } catch (Throwable t) {
        _logger.error("Error extracting contents id", t);
        throw new ApsSystemException("Error extracting contents id", t);
    }
    return contentsId;
}
Also used : ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) CacheableInfo(org.entando.entando.aps.system.services.cache.CacheableInfo) CachePut(org.springframework.cache.annotation.CachePut)

Example 8 with CacheableInfo

use of org.entando.entando.aps.system.services.cache.CacheableInfo in project entando-core by entando.

the class ContentAuthorizationHelper method getAuthorizationInfo.

@Override
@CachePut(value = ICacheInfoManager.DEFAULT_CACHE_NAME, condition = "#cacheable", 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, boolean cacheable) {
    PublicContentAuthorizationInfo authInfo = null;
    try {
        Content content = this.getContentManager().loadContent(contentId, true, cacheable);
        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;
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) CacheableInfo(org.entando.entando.aps.system.services.cache.CacheableInfo) CachePut(org.springframework.cache.annotation.CachePut)

Aggregations

CacheableInfo (org.entando.entando.aps.system.services.cache.CacheableInfo)8 CachePut (org.springframework.cache.annotation.CachePut)8 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)6 IUserProfile (org.entando.entando.aps.system.services.userprofile.model.IUserProfile)3 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)2 FieldSearchFilter (com.agiletec.aps.system.common.FieldSearchFilter)1 UserProfileRecord (org.entando.entando.aps.system.services.userprofile.model.UserProfileRecord)1 ActivityStreamComment (org.entando.entando.apsadmin.system.services.activitystream.model.ActivityStreamComment)1 ActivityStreamLikeInfo (org.entando.entando.apsadmin.system.services.activitystream.model.ActivityStreamLikeInfo)1