use of org.springframework.cache.annotation.CacheEvict in project mica2 by obiba.
the class MicaConfigService method save.
@CacheEvict(value = "micaConfig", allEntries = true)
public void save(@NotNull @Valid MicaConfig micaConfig) {
MicaConfig savedConfig = getOrCreateMicaConfig();
ArrayList<String> removedRoles = Lists.newArrayList(Sets.difference(Sets.newHashSet(savedConfig.getRoles()), Sets.newHashSet(micaConfig.getRoles())));
BeanUtils.copyProperties(micaConfig, savedConfig, "id", "version", "createdBy", "createdDate", "lastModifiedBy", "lastModifiedDate", "secretKey", "micaVersion");
if (micaConfig.getMicaVersion() != null)
savedConfig.setMicaVersion(micaConfig.getMicaVersion());
micaConfigRepository.save(savedConfig);
eventBus.post(new MicaConfigUpdatedEvent(getConfig(), removedRoles));
}
use of org.springframework.cache.annotation.CacheEvict in project metacat by Netflix.
the class ConnectorTableServiceProxy method rename.
/**
* Calls the connector table service rename method.
* @param oldName old table name
* @param newName new table name
* @param isMView true, if the object is a view
*/
@CacheEvict(key = "'table.' + #oldName")
public void rename(final QualifiedName oldName, final QualifiedName newName, final boolean isMView) {
final MetacatRequestContext metacatRequestContext = MetacatContextManager.getContext();
final ConnectorTableService service = connectorManager.getTableService(oldName);
try {
log.info("Renaming {} {} to {}", isMView ? "view" : "table", oldName, newName);
final ConnectorRequestContext connectorRequestContext = converterUtil.toConnectorContext(metacatRequestContext);
service.rename(connectorRequestContext, oldName, newName);
} catch (UnsupportedOperationException ignored) {
}
}
use of org.springframework.cache.annotation.CacheEvict in project metacat by Netflix.
the class ConnectorTableServiceProxy method delete.
/**
* Calls the connector table service delete method.
* @param name table name
*/
@CacheEvict(key = "'table.' + #name")
public void delete(final QualifiedName name) {
final MetacatRequestContext metacatRequestContext = MetacatContextManager.getContext();
final ConnectorTableService service = connectorManager.getTableService(name);
log.info("Drop table {}", name);
final ConnectorRequestContext connectorRequestContext = converterUtil.toConnectorContext(metacatRequestContext);
service.delete(connectorRequestContext, name);
}
use of org.springframework.cache.annotation.CacheEvict in project ArachneCentralAPI by OHDSI.
the class CommentServiceImpl method addComment.
@CacheEvict(cacheNames = "comments", allEntries = true)
@Override
@PreAuthorize("hasPermission(#topicId, 'CommentTopic', " + "T(com.odysseusinc.arachne.portal.security.ArachnePermission).EDIT_INSIGHT)")
public Comment addComment(Long topicId, Long parentId, Comment comment) {
comment.setId(null);
comment.setDate(new Date());
final CommentTopic topic = commentTopicRepository.getOne(topicId);
comment.setTopic(topic);
if (parentId != null) {
final Comment parent = commentRepository.findById(parentId).orElse(null);
comment.setParent(parent);
}
return commentRepository.save(comment);
}
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);
}
}
Aggregations