Search in sources :

Example 1 with CacheInfoEvict

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

the class GuiFragmentManager method deleteGuiFragment.

@Override
@CacheEvict(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "'GuiFragment_'.concat(#code)")
// TODO improve group handling
@CacheInfoEvict(value = ICacheInfoManager.DEFAULT_CACHE_NAME, groups = "'GuiFragment_uniqueByWidgetTypeGroup,GuiFragment_codesByWidgetTypeGroup'")
public void deleteGuiFragment(String code) throws ApsSystemException {
    try {
        GuiFragment guiFragment = this.getGuiFragment(code);
        this.getGuiFragmentDAO().removeGuiFragment(code);
        this.notifyGuiFragmentChangedEvent(guiFragment, GuiFragmentChangedEvent.REMOVE_OPERATION_CODE);
    } catch (Throwable t) {
        logger.error("Error deleting GuiFragment with code {}", code, t);
        throw new ApsSystemException("Error deleting GuiFragment with code:" + code, t);
    }
}
Also used : ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) CacheEvict(org.springframework.cache.annotation.CacheEvict) CacheInfoEvict(org.entando.entando.aps.system.services.cache.CacheInfoEvict)

Example 2 with CacheInfoEvict

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

the class ContentManager method insertOnLineContent.

/**
 * Publish a content.
 *
 * @param content The ID associated to the content to be displayed in the
 * portal.
 * @throws ApsSystemException in case of error.
 */
@Override
@CacheEvict(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "T(com.agiletec.plugins.jacms.aps.system.JacmsSystemConstants).CONTENT_CACHE_PREFIX.concat(#content.id)", condition = "#content.id != null")
@CacheInfoEvict(value = ICacheInfoManager.DEFAULT_CACHE_NAME, groups = "T(com.agiletec.plugins.jacms.aps.system.services.cache.CmsCacheWrapperManager).getContentCacheGroupsToEvictCsv(#content.id, #content.typeCode)")
public void insertOnLineContent(Content content) throws ApsSystemException {
    try {
        content.setLastModified(new Date());
        if (null == content.getId()) {
            content.setCreated(new Date());
            this.saveContent(content);
        }
        content.incrementVersion(true);
        content.setStatus(Content.STATUS_PUBLIC);
        this.getContentDAO().insertOnLineContent(content);
        int operationEventCode = -1;
        if (content.isOnLine()) {
            operationEventCode = PublicContentChangedEvent.UPDATE_OPERATION_CODE;
        } else {
            operationEventCode = PublicContentChangedEvent.INSERT_OPERATION_CODE;
        }
        this.notifyPublicContentChanging(content, operationEventCode);
    } catch (Throwable t) {
        _logger.error("Error while inserting content on line", t);
        throw new ApsSystemException("Error while inserting content on line", t);
    }
}
Also used : ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) Date(java.util.Date) CacheEvict(org.springframework.cache.annotation.CacheEvict) CacheInfoEvict(org.entando.entando.aps.system.services.cache.CacheInfoEvict)

Example 3 with CacheInfoEvict

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

the class GuiFragmentManager method addGuiFragment.

@Override
@CacheEvict(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "'GuiFragment_'.concat(#guiFragment.code)")
// TODO improve group handling
@CacheInfoEvict(value = ICacheInfoManager.DEFAULT_CACHE_NAME, groups = "'GuiFragment_uniqueByWidgetTypeGroup,GuiFragment_codesByWidgetTypeGroup'")
public void addGuiFragment(GuiFragment guiFragment) throws ApsSystemException {
    try {
        this.getGuiFragmentDAO().insertGuiFragment(guiFragment);
        this.notifyGuiFragmentChangedEvent(guiFragment, GuiFragmentChangedEvent.INSERT_OPERATION_CODE);
    } catch (Throwable t) {
        logger.error("Error adding GuiFragment", t);
        throw new ApsSystemException("Error adding GuiFragment", t);
    }
}
Also used : ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) CacheEvict(org.springframework.cache.annotation.CacheEvict) CacheInfoEvict(org.entando.entando.aps.system.services.cache.CacheInfoEvict)

Example 4 with CacheInfoEvict

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

the class GuiFragmentManager method updateGuiFragment.

@Override
@CacheEvict(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "'GuiFragment_'.concat(#guiFragment.code)")
// TODO improve group handling
@CacheInfoEvict(value = ICacheInfoManager.DEFAULT_CACHE_NAME, groups = "'GuiFragment_uniqueByWidgetTypeGroup,GuiFragment_codesByWidgetTypeGroup'")
public void updateGuiFragment(GuiFragment guiFragment) throws ApsSystemException {
    try {
        this.getGuiFragmentDAO().updateGuiFragment(guiFragment);
        this.notifyGuiFragmentChangedEvent(guiFragment, GuiFragmentChangedEvent.UPDATE_OPERATION_CODE);
    } catch (Throwable t) {
        logger.error("Error updating GuiFragment", t);
        throw new ApsSystemException("Error updating GuiFragment " + guiFragment, t);
    }
}
Also used : ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) CacheEvict(org.springframework.cache.annotation.CacheEvict) CacheInfoEvict(org.entando.entando.aps.system.services.cache.CacheInfoEvict)

Example 5 with CacheInfoEvict

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

the class ContentManager method removeOnLineContent.

/**
 * Unpublish a content, preventing it from being displayed in the portal.
 * Obviously the content itself is not deleted.
 *
 * @param content the content to unpublish.
 * @throws ApsSystemException in case of error
 */
@Override
@CacheEvict(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "T(com.agiletec.plugins.jacms.aps.system.JacmsSystemConstants).CONTENT_CACHE_PREFIX.concat(#content.id)", condition = "#content.id != null")
@CacheInfoEvict(value = ICacheInfoManager.DEFAULT_CACHE_NAME, groups = "T(com.agiletec.plugins.jacms.aps.system.services.cache.CmsCacheWrapperManager).getContentCacheGroupsToEvictCsv(#content.id, #content.typeCode)")
public void removeOnLineContent(Content content) throws ApsSystemException {
    try {
        content.setLastModified(new Date());
        content.incrementVersion(false);
        if (null != content.getStatus() && content.getStatus().equals(Content.STATUS_PUBLIC)) {
            content.setStatus(Content.STATUS_READY);
        }
        this.getContentDAO().removeOnLineContent(content);
        this.notifyPublicContentChanging(content, PublicContentChangedEvent.REMOVE_OPERATION_CODE);
    } catch (Throwable t) {
        _logger.error("Error while removing onLine content", t);
        throw new ApsSystemException("Error while removing onLine content", t);
    }
}
Also used : ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) Date(java.util.Date) CacheEvict(org.springframework.cache.annotation.CacheEvict) CacheInfoEvict(org.entando.entando.aps.system.services.cache.CacheInfoEvict)

Aggregations

ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)5 CacheInfoEvict (org.entando.entando.aps.system.services.cache.CacheInfoEvict)5 CacheEvict (org.springframework.cache.annotation.CacheEvict)5 Date (java.util.Date)2