use of org.springframework.cache.annotation.CacheEvict in project entando-core by entando.
the class SocialActivityStreamManager method addActionCommentRecord.
@Override
@CacheEvict(value = ICacheInfoManager.DEFAULT_CACHE_NAME, key = "'ActivityStreamCommentRecords_id_'.concat(#streamId)")
public void addActionCommentRecord(String username, String commentText, int streamId) throws ApsSystemException {
try {
Integer key = null;
ActionLogRecord record = null;
do {
key = this.getKeyGeneratorManager().getUniqueKeyCurrentValue();
record = this.getActionLogManager().getActionRecord(key);
} while (null != record);
this.getSocialActivityStreamDAO().addActionCommentRecord(key, streamId, username, commentText);
this.getActionLogManager().updateRecordDate(streamId);
} catch (Throwable t) {
_logger.error("Error adding a comment record to stream with id:{}", streamId, t);
throw new ApsSystemException("Error adding a comment record", t);
}
}
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 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);
}
}
use of org.springframework.cache.annotation.CacheEvict in project openmrs-core by openmrs.
the class AdministrationServiceImpl method saveGlobalProperty.
/**
* @see org.openmrs.api.AdministrationService#saveGlobalProperty(org.openmrs.GlobalProperty)
*/
@Override
@CacheEvict(value = "userSearchLocales", allEntries = true)
public GlobalProperty saveGlobalProperty(GlobalProperty gp) throws APIException {
// only try to save it if the global property has a key
if (gp.getProperty() != null && gp.getProperty().length() > 0) {
if (gp.getProperty().equals(OpenmrsConstants.GLOBAL_PROPERTY_LOCALE_ALLOWED_LIST)) {
if (gp.getPropertyValue() != null) {
List<Locale> localeList = new ArrayList<>();
for (String localeString : gp.getPropertyValue().split(",")) {
localeList.add(LocaleUtility.fromSpecification(localeString.trim()));
}
if (!localeList.contains(LocaleUtility.getDefaultLocale())) {
gp.setPropertyValue(StringUtils.join(getAllowedLocales(), ", "));
throw new APIException(Context.getMessageSourceService().getMessage("general.locale.localeListNotIncludingDefaultLocale", new Object[] { LocaleUtility.getDefaultLocale() }, null));
}
}
} else if (gp.getProperty().equals(OpenmrsConstants.GLOBAL_PROPERTY_DEFAULT_LOCALE) && gp.getPropertyValue() != null) {
List<Locale> localeList = getAllowedLocales();
if (!localeList.contains(LocaleUtility.fromSpecification(gp.getPropertyValue().trim()))) {
String value = gp.getPropertyValue();
gp.setPropertyValue(LocaleUtility.getDefaultLocale().toString());
throw new APIException((Context.getMessageSourceService().getMessage("general.locale.defaultNotInAllowedLocalesList", new Object[] { value }, null)));
}
}
CustomDatatypeUtil.saveIfDirty(gp);
dao.saveGlobalProperty(gp);
notifyGlobalPropertyChange(gp);
return gp;
}
return gp;
}
use of org.springframework.cache.annotation.CacheEvict in project new-cloud by xie-summer.
the class UserController method removeToken.
/**
* 清除Redis中 accesstoken refreshtoken
*
* @param accesstoken accesstoken
* @param refreshToken refreshToken
* @return true/false
*/
@PostMapping("/removeToken")
@CacheEvict(value = SecurityConstants.TOKEN_USER_DETAIL, key = "#accesstoken")
public R<Boolean> removeToken(String accesstoken, String refreshToken) {
RedisTokenStore tokenStore = new RedisTokenStore(redisConnectionFactory);
tokenStore.removeRefreshToken(refreshToken);
tokenStore.removeAccessToken(accesstoken);
return new R<>(Boolean.TRUE);
}
Aggregations