fix up some issues with updating client details. needs to go onto upgrade server straightaway.

This commit is contained in:
Keith Woodlock
2012-11-26 00:33:32 +00:00
parent fbf54d3c64
commit a5096aad88
6 changed files with 1620 additions and 12 deletions
@@ -528,7 +528,9 @@ CREATE TABLE `m_loan` (
`product_id` bigint(20) DEFAULT NULL,
`fund_id` bigint(20) DEFAULT NULL,
`loan_officer_id` bigint(20) DEFAULT NULL,
`guarantor_id` bigint(20) DEFAULT NULL,
`loan_status_id` smallint(5) NOT NULL,
`loan_transaction_strategy_id` bigint(20) DEFAULT NULL,
`currency_code` varchar(3) NOT NULL,
`currency_digits` smallint(5) NOT NULL,
`principal_amount` decimal(19,6) NOT NULL,
@@ -562,7 +564,6 @@ CREATE TABLE `m_loan` (
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
`loan_transaction_strategy_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `org_id` (`external_id`),
KEY `FKB6F935D87179A0CB` (`client_id`),
@@ -571,10 +572,12 @@ CREATE TABLE `m_loan` (
KEY `FK_loan_ltp_strategy` (`loan_transaction_strategy_id`),
KEY `FK_m_loan_m_staff` (`loan_officer_id`),
KEY `group_id` (`group_id`),
KEY `FK_m_loan_guarantor` (`guarantor_id`),
CONSTRAINT `FK7C885877240145` FOREIGN KEY (`fund_id`) REFERENCES `m_fund` (`id`),
CONSTRAINT `FKB6F935D87179A0CB` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`),
CONSTRAINT `FKB6F935D8C8D4B434` FOREIGN KEY (`product_id`) REFERENCES `m_product_loan` (`id`),
CONSTRAINT `FK_loan_ltp_strategy` FOREIGN KEY (`loan_transaction_strategy_id`) REFERENCES `ref_loan_transaction_processing_strategy` (`id`),
CONSTRAINT `FK_m_loan_guarantor` FOREIGN KEY (`guarantor_id`) REFERENCES `m_client` (`id`),
CONSTRAINT `FK_m_loan_m_staff` FOREIGN KEY (`loan_officer_id`) REFERENCES `m_staff` (`id`),
CONSTRAINT `m_loan_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `m_group` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -31,7 +31,7 @@ VALUES
(4,'AMD',2,NULL,'Armenian Dram','currency.AMD'),
(5,'ANG',2,NULL,'Netherlands Antillian Guilder','currency.ANG'),(6,'AOA',2,NULL,'Angolan Kwanza','currency.AOA'),
(7,'ARS',2,NULL,'Argentine Peso','currency.ARS'),
(8,'AUD',2,NULL,'Australian Dollar','currency.AUD'),(9,'AWG',2,NULL,'Aruban Guilder','currency.AWG'),
(8,'AUD',2,'A$','Australian Dollar','currency.AUD'),(9,'AWG',2,NULL,'Aruban Guilder','currency.AWG'),
(10,'AZM',2,NULL,'Azerbaijanian Manat','currency.AZM'),
(11,'BAM',2,NULL,'Bosnia and Herzegovina Convertible Marks','currency.BAM'),
(12,'BBD',2,NULL,'Barbados Dollar','currency.BBD'),
@@ -56,7 +56,8 @@ VALUES
(42,'EEK',2,NULL,'Estonian Kroon','currency.EEK'),(43,'EGP',2,NULL,'Egyptian Pound','currency.EGP'),(44,'ERN',2,NULL,'Eritrea Nafka','currency.ERN'),
(45,'ETB',2,NULL,'Ethiopian Birr','currency.ETB'),(46,'EUR',2,NULL,'euro','currency.EUR'),(47,'FJD',2,NULL,'Fiji Dollar','currency.FJD'),(48,'FKP',2,NULL,'Falkland
(45,'ETB',2,NULL,'Ethiopian Birr','currency.ETB'),(46,'EUR',2,'€','Euro','currency.EUR'),
(47,'FJD',2,NULL,'Fiji Dollar','currency.FJD'),(48,'FKP',2,NULL,'Falkland
Islands Pound','currency.FKP'),(49,'GBP',2,NULL,'Pound Sterling','currency.GBP'),(50,'GEL',2,NULL,'Georgian Lari','currency.GEL'),
(51,'GHC',2,'GHc','Ghana Cedi','currency.GHC'),
@@ -68,7 +69,8 @@ Islands Pound','currency.FKP'),(49,'GBP',2,NULL,'Pound Sterling','currency.GBP')
(61,'HUF',2,NULL,'Hungarian Forint','currency.HUF'),(62,'IDR',2,NULL,'Indonesian Rupiah','currency.IDR'),(63,'ILS',2,NULL,'New Israeli Shekel','currency.ILS'),
(64,'INR',2,NULL,'Indian Rupee','currency.INR'),(65,'IQD',3,NULL,'Iraqi Dinar','currency.IQD'),(66,'IRR',2,NULL,'Iranian Rial','currency.IRR'),
(64,'INR',2,'?','Indian Rupee','currency.INR'),
(65,'IQD',3,NULL,'Iraqi Dinar','currency.IQD'),(66,'IRR',2,NULL,'Iranian Rial','currency.IRR'),
(67,'ISK',0,NULL,'Iceland Krona','currency.ISK'),(68,'JMD',2,NULL,'Jamaican Dollar','currency.JMD'),(69,'JOD',3,NULL,'Jordanian Dinar','currency.JOD'),
@@ -100,7 +102,7 @@ Islands Pound','currency.FKP'),(49,'GBP',2,NULL,'Pound Sterling','currency.GBP')
(108,'NZD',2,NULL,'New Zealand Dollar','currency.NZD'),(109,'OMR',3,NULL,'Rial Omani','currency.OMR'),(110,'PAB',2,NULL,'Panama Balboa','currency.PAB'),
(111,'PEN',2,NULL,'Peruvian Nuevo Sol','currency.PEN'),(112,'PGK',2,NULL,'Papua New Guinea Kina','currency.PGK'),(113,'PHP',2,NULL,'Philippine Peso','currency.PHP'),
(111,'PEN',2,'S/.','Peruvian Nuevo Sol','currency.PEN'),(112,'PGK',2,NULL,'Papua New Guinea Kina','currency.PGK'),(113,'PHP',2,NULL,'Philippine Peso','currency.PHP'),
(114,'PKR',2,NULL,'Pakistan Rupee','currency.PKR'),(115,'PLN',2,NULL,'Polish Zloty','currency.PLN'),(116,'PYG',0,NULL,'Paraguayan Guarani','currency.PYG'),
File diff suppressed because one or more lines are too long
@@ -0,0 +1 @@
ALTER TABLE `m_loan` CHANGE COLUMN `arrearstolerance_amount` `arrearstolerance_amount` DECIMAL(19,6) NULL;
@@ -54,7 +54,7 @@ final public class ClientData {
}
final String displayName = buildDisplayNameFrom(firstnameValue, lastnameValue);
return new ClientData(officeId, null, id, firstname, lastname, displayName, externalId, joiningDate, null, null, null, null);
return new ClientData(officeId, null, id, firstnameValue, lastnameValue, displayName, externalId, joiningDate, null, null, null, null);
}
public static ClientData integrateChanges(final ClientData clientData, ClientData currentChange, final Collection<ClientData> allChanges) {
@@ -388,8 +388,8 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
if (externalIdParamName.equalsIgnoreCase(parameter)) {
final String baseExternalId = helper.extractStringNamed(externalIdParamName, baseElement, ignoreParameters);
final String workingExternalId = helper.extractStringNamed(externalIdParamName, workingElement, ignoreParameters);
if (!baseExternalId.equals(workingExternalId)) {
externalId = workingExternalId;
if (differenceExists(baseExternalId, workingExternalId)) {
firstname = workingExternalId;
parametersPassedInRequest.add(externalIdParamName);
}
}
@@ -398,7 +398,7 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
if (firstnameParamName.equalsIgnoreCase(parameter)) {
final String baseValue = helper.extractStringNamed(firstnameParamName, baseElement, ignoreParameters);
final String workingCopyValue = helper.extractStringNamed(firstnameParamName, workingElement, ignoreParameters);
if (!baseValue.equals(workingCopyValue)) {
if (differenceExists(baseValue, workingCopyValue)) {
firstname = workingCopyValue;
parametersPassedInRequest.add(firstnameParamName);
}
@@ -408,7 +408,7 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
if (lastnameParamName.equalsIgnoreCase(parameter)) {
final String baseValue = helper.extractStringNamed(lastnameParamName, baseElement, ignoreParameters);
final String workingCopyValue = helper.extractStringNamed(lastnameParamName, workingElement, ignoreParameters);
if (!baseValue.equals(workingCopyValue)) {
if (differenceExists(baseValue, workingCopyValue)) {
lastname = workingCopyValue;
parametersPassedInRequest.add(lastnameParamName);
}
@@ -418,7 +418,7 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
if (clientOrBusinessNameParamName.equalsIgnoreCase(parameter)) {
final String baseValue = helper.extractStringNamed(clientOrBusinessNameParamName, baseElement, ignoreParameters);
final String workingCopyValue = helper.extractStringNamed(clientOrBusinessNameParamName, workingElement, ignoreParameters);
if (!baseValue.equals(workingCopyValue)) {
if (differenceExists(baseValue, workingCopyValue)) {
clientOrBusinessName = workingCopyValue;
parametersPassedInRequest.add(clientOrBusinessNameParamName);
}
@@ -429,7 +429,7 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
final LocalDate baseValue = helper.extractLocalDateAsArrayNamed(joinedDateParamName, baseElement, ignoreParameters);
final LocalDate workingCopyValue = helper.extractLocalDateAsArrayNamed(joinedDateParamName, workingElement,
ignoreParameters);
if (!baseValue.isEqual(workingCopyValue)) {
if (differenceExists(baseValue, workingCopyValue)) {
joiningDate = workingCopyValue;
parametersPassedInRequest.add(joinedDateParamName);
}
@@ -440,6 +440,30 @@ public class PortfolioApiDataConversionServiceImpl implements PortfolioApiDataCo
officeId, joiningDate, false);
}
private boolean differenceExists(LocalDate baseValue, LocalDate workingCopyValue) {
boolean differenceExists = false;
if (baseValue != null) {
differenceExists = !baseValue.equals(workingCopyValue);
} else {
differenceExists = workingCopyValue != null;
}
return differenceExists;
}
private boolean differenceExists(final String baseValue, final String workingCopyValue) {
boolean differenceExists = false;
if (StringUtils.isNotBlank(baseValue)) {
differenceExists = !baseValue.equals(workingCopyValue);
} else {
differenceExists = StringUtils.isNotBlank(workingCopyValue);
}
return differenceExists;
}
@Override
public ClientCommand convertApiRequestJsonToClientCommand(final Long resourceIdentifier, final String json) {
if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }