mysql data type changes and provisiong update validation changes
This commit is contained in:
+16
-1
@@ -29,7 +29,7 @@ import org.apache.fineract.infrastructure.core.exception.PlatformDataIntegrityEx
|
||||
public final class ResultsetColumnHeaderData {
|
||||
|
||||
private final String columnName;
|
||||
private final String columnType;
|
||||
private String columnType;
|
||||
private final Long columnLength;
|
||||
private final String columnDisplayType;
|
||||
private final boolean isColumnNullable;
|
||||
@@ -68,6 +68,21 @@ public final class ResultsetColumnHeaderData {
|
||||
this.columnValues = columnValues;
|
||||
this.columnCode = columnCode;
|
||||
|
||||
if("NEWDECIMAL".equalsIgnoreCase(this.columnType)) {
|
||||
this.columnType = "DECIMAL" ;
|
||||
//Refer org.drizzle.jdbc.internal.mysql.MySQLType.java
|
||||
}
|
||||
|
||||
if("CLOB".equalsIgnoreCase(this.columnType)) {
|
||||
this.columnType = "varchar" ;
|
||||
//Drizzle is returning some of the String data a CLOB
|
||||
}
|
||||
|
||||
if("LONGLONG".equalsIgnoreCase(this.columnType) || "LONG".equalsIgnoreCase(this.columnType)) {
|
||||
this.columnType = "bigint" ;
|
||||
//Refer org.drizzle.jdbc.internal.mysql.MySQLType.java
|
||||
}
|
||||
|
||||
String displayType = null;
|
||||
if (this.columnCode == null) {
|
||||
if (isString()) {
|
||||
|
||||
+21
-13
@@ -104,19 +104,23 @@ public class ProvisioningCriteriaWritePlatformServiceJpaRepositoryImpl implement
|
||||
|
||||
@Override
|
||||
public CommandProcessingResult updateProvisioningCriteria(final Long criteriaId, JsonCommand command) {
|
||||
this.fromApiJsonDeserializer.validateForUpdate(command.json());
|
||||
ProvisioningCriteria provisioningCriteria = provisioningCriteriaRepository.findOne(criteriaId) ;
|
||||
if(provisioningCriteria == null) {
|
||||
throw new ProvisioningCategoryNotFoundException(criteriaId) ;
|
||||
try {
|
||||
this.fromApiJsonDeserializer.validateForUpdate(command.json());
|
||||
ProvisioningCriteria provisioningCriteria = provisioningCriteriaRepository.findOne(criteriaId) ;
|
||||
if(provisioningCriteria == null) {
|
||||
throw new ProvisioningCategoryNotFoundException(criteriaId) ;
|
||||
}
|
||||
List<LoanProduct> products = this.provisioningCriteriaAssembler.parseLoanProducts(command.parsedJson()) ;
|
||||
final Map<String, Object> changes = provisioningCriteria.update(command, products) ;
|
||||
if(!changes.isEmpty()) {
|
||||
updateProvisioningCriteriaDefinitions(provisioningCriteria, command) ;
|
||||
provisioningCriteriaRepository.save(provisioningCriteria) ;
|
||||
}
|
||||
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(provisioningCriteria.getId()).build();
|
||||
} catch (final DataIntegrityViolationException dve) {
|
||||
handleDataIntegrityIssues(command, dve);
|
||||
return CommandProcessingResult.empty();
|
||||
}
|
||||
List<LoanProduct> products = this.provisioningCriteriaAssembler.parseLoanProducts(command.parsedJson()) ;
|
||||
|
||||
final Map<String, Object> changes = provisioningCriteria.update(command, products) ;
|
||||
if(!changes.isEmpty()) {
|
||||
updateProvisioningCriteriaDefinitions(provisioningCriteria, command) ;
|
||||
provisioningCriteriaRepository.save(provisioningCriteria) ;
|
||||
}
|
||||
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).withEntityId(provisioningCriteria.getId()).build();
|
||||
}
|
||||
|
||||
private void updateProvisioningCriteriaDefinitions(ProvisioningCriteria provisioningCriteria, JsonCommand command) {
|
||||
@@ -156,7 +160,11 @@ public class ProvisioningCriteriaWritePlatformServiceJpaRepositoryImpl implement
|
||||
final String name = command.stringValueOfParameterNamed("criteria_name");
|
||||
throw new PlatformDataIntegrityException("error.msg.provisioning.duplicate.criterianame", "Provisioning Criteria with name `"
|
||||
+ name + "` already exists", "category name", name);
|
||||
}
|
||||
}else if (realCause.getMessage().contains("product_id")) {
|
||||
throw new PlatformDataIntegrityException(
|
||||
"error.msg.provisioning.product.id(s).already.associated.existing.criteria",
|
||||
"The selected products already associated with another Provisioning Criteria");
|
||||
}
|
||||
logger.error(dve.getMessage(), dve);
|
||||
throw new PlatformDataIntegrityException("error.msg.provisioning.unknown.data.integrity.issue",
|
||||
"Unknown data integrity issue with resource: " + realCause.getMessage());
|
||||
|
||||
Reference in New Issue
Block a user