Search in sources :

Example 1 with CacheEvict

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

the class IdentifierTypeManagerImpl method updateIdentifierType.

@Override
@CacheEvict(value = { "identifier-types", "identifier-types-map" }, allEntries = true)
public IdentifierType updateIdentifierType(IdentifierType id) {
    IdentifierTypeEntity entity = idTypeDao.getEntityByName(externalIdentifierTypeConverter.convertTo(id.getName(), null));
    SourceEntity sourceEntity = new SourceEntity();
    sourceEntity.setSourceClient(entity.getSourceClient());
    securityManager.checkSource(entity);
    entity.setIsDeprecated(id.getDeprecated());
    entity.setResolutionPrefix(id.getResolutionPrefix());
    entity.setValidationRegex(id.getValidationRegex());
    entity.setLastModified(new Date());
    entity.setIsCaseSensitive(id.getCaseSensitive());
    entity.setPrimaryUse(id.getPrimaryUse());
    entity = idTypeDao.updateIdentifierType(entity);
    return adapter.fromEntity(entity);
}
Also used : SourceEntity(org.orcid.persistence.jpa.entities.SourceEntity) IdentifierTypeEntity(org.orcid.persistence.jpa.entities.IdentifierTypeEntity) Date(java.util.Date) CacheEvict(org.springframework.cache.annotation.CacheEvict)

Example 2 with CacheEvict

use of org.springframework.cache.annotation.CacheEvict in project topjava10 by JavaWebinar.

the class UserServiceImpl method enable.

@CacheEvict(value = "users", allEntries = true)
@Override
@Transactional
public void enable(int id, boolean enabled) {
    User user = get(id);
    user.setEnabled(enabled);
    repository.save(user);
}
Also used : AuthorizedUser(ru.javawebinar.topjava.AuthorizedUser) User(ru.javawebinar.topjava.model.User) CacheEvict(org.springframework.cache.annotation.CacheEvict) Transactional(org.springframework.transaction.annotation.Transactional)

Example 3 with CacheEvict

use of org.springframework.cache.annotation.CacheEvict in project entando-core by entando.

the class SocialActivityStreamManager method deleteActionCommentRecord.

@Override
@CacheEvict(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "'ActivityStreamCommentRecords_id_'.concat(#streamId)")
public void deleteActionCommentRecord(int id, int streamId) throws ApsSystemException {
    try {
        this.getSocialActivityStreamDAO().deleteActionCommentRecord(id);
        this.getActionLogManager().updateRecordDate(streamId);
    } catch (Throwable t) {
        _logger.error("Error deleting comment with id {} from stream with id {}", id, streamId, t);
        throw new ApsSystemException("Error deleting comment", t);
    }
}
Also used : ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) CacheEvict(org.springframework.cache.annotation.CacheEvict)

Example 4 with CacheEvict

use of org.springframework.cache.annotation.CacheEvict in project entando-core by entando.

the class SocialActivityStreamManager method editActionLikeRecord.

@Override
@CacheEvict(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "'ActivityStreamLikeRecords_id_'.concat(#id)")
public void editActionLikeRecord(int id, String username, boolean add) throws ApsSystemException {
    try {
        this.getSocialActivityStreamDAO().editActionLikeRecord(id, username, add);
        this.getActionLogManager().updateRecordDate(id);
    } catch (Throwable t) {
        _logger.error("Error editing activity stream like records", t);
        throw new ApsSystemException("Error editing activity stream like records", t);
    }
}
Also used : ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) CacheEvict(org.springframework.cache.annotation.CacheEvict)

Example 5 with CacheEvict

use of org.springframework.cache.annotation.CacheEvict 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)

Aggregations

CacheEvict (org.springframework.cache.annotation.CacheEvict)37 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)14 Date (java.util.Date)6 CacheInfoEvict (org.entando.entando.aps.system.services.cache.CacheInfoEvict)5 Transactional (org.springframework.transaction.annotation.Transactional)4 MetacatRequestContext (com.netflix.metacat.common.MetacatRequestContext)3 ConnectorRequestContext (com.netflix.metacat.common.server.connectors.ConnectorRequestContext)3 ConnectorTableService (com.netflix.metacat.common.server.connectors.ConnectorTableService)3 ArrayList (java.util.ArrayList)3 RoleMenuDO (io.github.tesla.ops.system.domain.RoleMenuDO)2 Connection (java.sql.Connection)2 ActionLogRecord (org.entando.entando.aps.system.services.actionlog.model.ActionLogRecord)2 IdentifierTypeEntity (org.orcid.persistence.jpa.entities.IdentifierTypeEntity)2 SourceEntity (org.orcid.persistence.jpa.entities.SourceEntity)2 AuthorizedUser (ru.javawebinar.topjava.AuthorizedUser)2 User (ru.javawebinar.topjava.model.User)2 Options (cc.ryanc.halo.model.domain.Options)1 Post (cc.ryanc.halo.model.domain.Post)1 UserDetails (com.agiletec.aps.system.services.user.UserDetails)1 R (com.auth.common.util.R)1