use of org.springframework.cache.annotation.CacheEvict in project entando-core by entando.
the class ResourceDAO method deleteResource.
/**
* Cancella una risorsa dal db.
*
* @param id L'identificativo della risorsa da cancellare.
*/
@Override
@CacheEvict(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "'jacms_resource_'.concat(#id)", condition = "null != #id")
public void deleteResource(String id) {
Connection conn = null;
try {
conn = this.getConnection();
conn.setAutoCommit(false);
this.executeDeleteResource(id, conn);
conn.commit();
} catch (Throwable t) {
this.executeRollback(conn);
_logger.error("Error deleting resource {}", id, t);
throw new RuntimeException("Error deleting resource " + id, t);
} finally {
this.closeConnection(conn);
}
}
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 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 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);
}
}
Aggregations