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);
}
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);
}
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);
}
}
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);
}
}
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);
}
}
Aggregations