@Override public CommandProcessingResult createEventValidation(JsonCommand command) { try { this.context.authenticatedUser(); /* this.apiJsonDeserializer.validateForCreate(command.json()); */ final EventValidation eventValidation = EventValidation.fromJson(command); this.eventValidationRepository.save(eventValidation); return new CommandProcessingResult(eventValidation.getId()); } catch (DataIntegrityViolationException dve) { handleCodeDataIntegrityIssues(command, dve); return null; } }
@Override public CommandProcessingResult deleteEventValidation(Long id) { try { this.context.authenticatedUser(); final EventValidation event = this.eventValidationRepository.findOne(id); if (event == null) { throw new EventValidationNotFoundException(id.toString()); } event.delete(); this.eventValidationRepository.save(event); return new CommandProcessingResult(id); } catch (Exception exception) { return null; } }