use of org.obiba.mica.micaConfig.event.MicaConfigUpdatedEvent 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));
}
Aggregations