private void confirmUniqueFieldsAkka( MvccEntity mvccEntity, UUID version, ApplicationScope scope, String region ) { final Entity entity = mvccEntity.getEntity().get(); try { akkaUvService.confirmUniqueValues( scope, entity, version, region ); } catch (UniqueValueException e) { Map<String, Field> violations = new HashMap<>(); violations.put( e.getField().getName(), e.getField() ); throw new WriteUniqueVerifyException( mvccEntity, scope, violations ); } } }
private void verifyUniqueFieldsAkka(CollectionIoEvent<MvccEntity> ioevent) { MvccValidationUtils.verifyMvccEntityWithEntity( ioevent.getEvent() ); final MvccEntity mvccEntity = ioevent.getEvent(); final Entity entity = mvccEntity.getEntity().get(); final ApplicationScope applicationScope = ioevent.getEntityCollection(); String authoritativeRegion = ioevent.getAuthoritativeRegion(); if ( StringUtils.isEmpty(authoritativeRegion) ) { authoritativeRegion = uniqueValuesFig.getAuthoritativeRegion(); } if ( StringUtils.isEmpty(authoritativeRegion) ) { authoritativeRegion = actorSystemFig.getRegionLocal(); } try { akkaUvService.reserveUniqueValues( applicationScope, entity, mvccEntity.getVersion(), authoritativeRegion ); } catch (UniqueValueException e) { Map<String, Field> violations = new HashMap<>(); violations.put( e.getField().getName(), e.getField() ); throw new WriteUniqueVerifyException( mvccEntity, applicationScope, violations ); } }
throw new WriteUniqueVerifyException(mvccEntity, scope, preWriteUniquenessViolations ); throw new WriteUniqueVerifyException( mvccEntity, ioevent.getEntityCollection(), uniquenessViolations );