Merge branch 'FINERACT-243' into develop
This commit is contained in:
+7
-1
@@ -40,7 +40,6 @@ import org.joda.time.format.DateTimeFormatter;
|
|||||||
|
|
||||||
import com.google.gson.JsonArray;
|
import com.google.gson.JsonArray;
|
||||||
import com.google.gson.JsonElement;
|
import com.google.gson.JsonElement;
|
||||||
import com.google.gson.JsonPrimitive;
|
|
||||||
import com.google.gson.reflect.TypeToken;
|
import com.google.gson.reflect.TypeToken;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -126,6 +125,13 @@ public final class JsonCommand {
|
|||||||
return this.parsedCommand;
|
return this.parsedCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public JsonElement jsonElement(final String paramName) {
|
||||||
|
if (this.parsedCommand.getAsJsonObject().has(paramName)) {
|
||||||
|
return this.parsedCommand.getAsJsonObject().get(paramName);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public String jsonFragment(final String paramName) {
|
public String jsonFragment(final String paramName) {
|
||||||
String jsonFragment = null;
|
String jsonFragment = null;
|
||||||
if (this.parsedCommand.getAsJsonObject().has(paramName)) {
|
if (this.parsedCommand.getAsJsonObject().has(paramName)) {
|
||||||
|
|||||||
+2
-2
@@ -250,7 +250,7 @@ public final class ClientDataValidator {
|
|||||||
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.constitutionIdParamName, element)) {
|
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.constitutionIdParamName, element)) {
|
||||||
final Integer constitution = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(ClientApiConstants.constitutionIdParamName,
|
final Integer constitution = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(ClientApiConstants.constitutionIdParamName,
|
||||||
element);
|
element);
|
||||||
baseDataValidator.reset().parameter(ClientApiConstants.constitutionIdParamName).value(constitution).notNull().integerGreaterThanZero();
|
baseDataValidator.reset().parameter(ClientApiConstants.constitutionIdParamName).value(constitution).ignoreIfNull().integerGreaterThanZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.mainBusinessLineIdParamName, element)) {
|
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.mainBusinessLineIdParamName, element)) {
|
||||||
@@ -532,7 +532,7 @@ public final class ClientDataValidator {
|
|||||||
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.constitutionIdParamName, element)) {
|
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.constitutionIdParamName, element)) {
|
||||||
atLeastOneParameterPassedForUpdate = true;
|
atLeastOneParameterPassedForUpdate = true;
|
||||||
final Integer constitutionId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(ClientApiConstants.constitutionIdParamName, element);
|
final Integer constitutionId = this.fromApiJsonHelper.extractIntegerSansLocaleNamed(ClientApiConstants.constitutionIdParamName, element);
|
||||||
baseDataValidator.reset().parameter(ClientApiConstants.constitutionIdParamName).value(constitutionId).notNull().integerGreaterThanZero();
|
baseDataValidator.reset().parameter(ClientApiConstants.constitutionIdParamName).value(constitutionId).ignoreIfNull().integerGreaterThanZero();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.mainBusinessLineIdParamName, element)) {
|
if (this.fromApiJsonHelper.parameterExists(ClientApiConstants.mainBusinessLineIdParamName, element)) {
|
||||||
|
|||||||
+13
-2
@@ -497,7 +497,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
|||||||
final ClientNonPerson clientNonPersonForUpdate = this.clientNonPersonRepository.findOneByClientId(clientId);
|
final ClientNonPerson clientNonPersonForUpdate = this.clientNonPersonRepository.findOneByClientId(clientId);
|
||||||
if(clientNonPersonForUpdate != null)
|
if(clientNonPersonForUpdate != null)
|
||||||
{
|
{
|
||||||
final JsonElement clientNonPersonElement = this.fromApiJsonHelper.parse(command.jsonFragment(ClientApiConstants.clientNonPersonDetailsParamName));
|
final JsonElement clientNonPersonElement = command.jsonElement(ClientApiConstants.clientNonPersonDetailsParamName);
|
||||||
final Map<String, Object> clientNonPersonChanges = clientNonPersonForUpdate.update(JsonCommand.fromExistingCommand(command, clientNonPersonElement));
|
final Map<String, Object> clientNonPersonChanges = clientNonPersonForUpdate.update(JsonCommand.fromExistingCommand(command, clientNonPersonElement));
|
||||||
|
|
||||||
if (clientNonPersonChanges.containsKey(ClientApiConstants.constitutionIdParamName)) {
|
if (clientNonPersonChanges.containsKey(ClientApiConstants.constitutionIdParamName)) {
|
||||||
@@ -525,8 +525,19 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP
|
|||||||
}
|
}
|
||||||
|
|
||||||
changes.putAll(clientNonPersonChanges);
|
changes.putAll(clientNonPersonChanges);
|
||||||
|
} else {
|
||||||
|
final Integer legalFormParamValue = command.integerValueOfParameterNamed(ClientApiConstants.legalFormIdParamName);
|
||||||
|
boolean isEntity = false;
|
||||||
|
if (legalFormParamValue != null) {
|
||||||
|
final LegalForm legalForm = LegalForm.fromInt(legalFormParamValue);
|
||||||
|
if (legalForm != null) {
|
||||||
|
isEntity = legalForm.isEntity();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (isEntity) {
|
||||||
|
extractAndCreateClientNonPerson(clientForUpdate, command);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return new CommandProcessingResultBuilder() //
|
return new CommandProcessingResultBuilder() //
|
||||||
.withCommandId(command.commandId()) //
|
.withCommandId(command.commandId()) //
|
||||||
.withOfficeId(clientForUpdate.officeId()) //
|
.withOfficeId(clientForUpdate.officeId()) //
|
||||||
|
|||||||
Reference in New Issue
Block a user