fineract-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject incubator-fineract git commit: mysql data type changes and provisiong update validation changes
Date Wed, 10 Feb 2016 07:50:20 GMT
Repository: incubator-fineract
Updated Branches:
  refs/heads/develop 06fd26b89 -> bb4799f58


mysql data type changes and provisiong update validation changes


Project: http://git-wip-us.apache.org/repos/asf/incubator-fineract/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-fineract/commit/bb4799f5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-fineract/tree/bb4799f5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-fineract/diff/bb4799f5

Branch: refs/heads/develop
Commit: bb4799f583197d2ef21843b9389ba4061916aa0c
Parents: 06fd26b
Author: unknown <nazeer.shaik@confluxtechnologies.com>
Authored: Tue Feb 9 18:17:56 2016 +0530
Committer: unknown <nazeer.shaik@confluxtechnologies.com>
Committed: Tue Feb 9 18:17:56 2016 +0530

----------------------------------------------------------------------
 .../data/ResultsetColumnHeaderData.java         | 17 +++++++++-
 ...iaWritePlatformServiceJpaRepositoryImpl.java | 34 ++++++++++++--------
 2 files changed, 37 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/bb4799f5/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/ResultsetColumnHeaderData.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/ResultsetColumnHeaderData.java
b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/ResultsetColumnHeaderData.java
index 3e998b1..e84149c 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/ResultsetColumnHeaderData.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/dataqueries/data/ResultsetColumnHeaderData.java
@@ -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()) {

http://git-wip-us.apache.org/repos/asf/incubator-fineract/blob/bb4799f5/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCriteriaWritePlatformServiceJpaRepositoryImpl.java
----------------------------------------------------------------------
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCriteriaWritePlatformServiceJpaRepositoryImpl.java
b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCriteriaWritePlatformServiceJpaRepositoryImpl.java
index 48f5554..0c7f599 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCriteriaWritePlatformServiceJpaRepositoryImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/provisioning/service/ProvisioningCriteriaWritePlatformServiceJpaRepositoryImpl.java
@@ -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) ;
-        }
-        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) ;    
+    	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();
         }
-        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());


Mime
View raw message