formatting changes on file.

This commit is contained in:
Keith Woodlock
2013-02-05 20:40:09 +00:00
parent 27bb852e3a
commit f73dc7e742
@@ -53,19 +53,18 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf
try {
context.authenticatedUser();
this.roleCommandFromApiJsonDeserializer.validateForCreate(command
.json());
this.roleCommandFromApiJsonDeserializer.validateForCreate(command.json());
final Role entity = Role.fromJson(command);
this.roleRepository.save(entity);
return new CommandProcessingResultBuilder()
.withCommandId(command.commandId())
.withEntityId(entity.getId()).build();
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(entity.getId()).build();
} catch (DataIntegrityViolationException dve) {
handleDataIntegrityIssues(command, dve);
return CommandProcessingResult.empty();
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
.build();
}
}
@@ -79,8 +78,8 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf
if (realCause.getMessage().contains("unq_name")) {
final String name = command.stringValueOfParameterNamed("name");
throw new PlatformDataIntegrityException("error.msg.role.duplicate.name", "Role with name `" + name
+ "` already exists", "name", name);
throw new PlatformDataIntegrityException("error.msg.role.duplicate.name", "Role with name `" + name + "` already exists",
"name", name);
}
logAsErrorUnexpectedDataIntegrityException(dve);
@@ -98,13 +97,10 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf
try {
context.authenticatedUser();
this.roleCommandFromApiJsonDeserializer.validateForUpdate(command
.json());
this.roleCommandFromApiJsonDeserializer.validateForUpdate(command.json());
final Role role = this.roleRepository.findOne(roleId);
if (role == null) {
throw new RoleNotFoundException(roleId);
}
if (role == null) { throw new RoleNotFoundException(roleId); }
final Map<String, Object> changes = role.update(command);
if (!changes.isEmpty()) {
@@ -113,11 +109,14 @@ public class RoleWritePlatformServiceJpaRepositoryImpl implements RoleWritePlatf
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
.withEntityId(roleId).with(changes) //
.withEntityId(roleId) //
.with(changes) //
.build();
} catch (DataIntegrityViolationException dve) {
handleDataIntegrityIssues(command, dve);
return new CommandProcessingResult(Long.valueOf(-1));
return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
.build();
}
}