drop audit columns on organisation currency, update api docs on configuration api.

This commit is contained in:
Keith Woodlock
2013-01-27 00:04:01 +00:00
parent 1ff1e53fb5
commit d5c09659ff
24 changed files with 602 additions and 208 deletions
+192 -64
View File
@@ -135,8 +135,87 @@ function getBaseURL(docURL)
<div id="toc-menu1" class="flybar-menu"> <div id="toc-menu1" class="flybar-menu">
<div class="tocMatrix"> <div class="tocMatrix">
<table class=matrixHeading> <table class=matrixHeading>
<tr class="matrixHeadingBG"><td colspan=2 valign="top"><div class="matrixHeadingVerbs"><table><tr><td>RESOURCES</td></tr></table></div></td><td><table><tr><td><div class="matrixHeadingVerbs">POST</div></td></tr><tr><td><div class=matrixHeadingCommands>create/complex update</div></td></tr></table></td><td><table><tr><td><div class="matrixHeadingVerbs">GET</div></td></tr><tr><td><div class=matrixHeadingCommands>read</div></td></tr></table></td><td><table><tr><td><div class="matrixHeadingVerbs">PUT</div></td></tr><tr><td><div class=matrixHeadingCommands>update</div></td></tr></table></td><td><table><tr><td><div class="matrixHeadingVerbs">DELETE</div></td></tr><tr><td><div class=matrixHeadingCommands>delete</div></td></tr></table></td></tr> <tr class="matrixHeadingBG">
<tr class="alt"><td><a href="#configs">CONFIGURATION</a></td><td>configurations/currency</td><td></td><td><a href="#configs_currencyretrieve">Retrieve Currency Configuration</a></td><td><a href="#configs_currencyupdate">Update Currency Configuration</a></td><td></td></tr> <td colspan=2 valign="top">
<div class="matrixHeadingVerbs">
<table>
<tr>
<td>RESOURCES</td>
</tr>
</table>
</div>
</td>
<td>
<table>
<tr>
<td>
<div class="matrixHeadingVerbs">POST</div>
</td>
</tr>
<tr>
<td>
<div class=matrixHeadingCommands>create/complex update</div>
</td>
</tr>
</table>
</td>
<td>
<table>
<tr>
<td>
<div class="matrixHeadingVerbs">GET</div>
</td>
</tr>
<tr>
<td>
<div class=matrixHeadingCommands>read</div>
</td>
</tr>
</table>
</td>
<td>
<table>
<tr>
<td>
<div class="matrixHeadingVerbs">PUT</div>
</td>
</tr>
<tr>
<td>
<div class=matrixHeadingCommands>update</div>
</td>
</tr>
</table>
</td>
<td>
<table>
<tr>
<td>
<div class="matrixHeadingVerbs">DELETE</div>
</td>
</tr>
<tr>
<td>
<div class=matrixHeadingCommands>delete</div>
</td>
</tr>
</table>
</td>
</tr>
<tr class="alt">
<td><a href="#configs">CURRENCY</a></td><td>currencies</td>
<td></td>
<td><a href="#configs_currencyretrieve">Retrieve Currency Configuration</a></td>
<td><a href="#configs_currencyupdate">Update Currency Configuration</a></td>
<td></td>
</tr>
<tr class="alt">
<td><a href="#configs_global">GLOBAL CONFIGURATION</a></td><td>configurations</td>
<td></td>
<td><a href="#configs_globalconfig_retrieve">Retrieve Global Configuration</a></td>
<td><a href="#configs_globalconfig_currencyupdate">Update Global Configuration</a></td>
<td></td>
</tr>
</table> </table>
</div> </div>
</div> </div>
@@ -2144,8 +2223,8 @@ Request Body:
<a id="configs" name="configs" class="old-syle-anchor">&nbsp;</a> <a id="configs" name="configs" class="old-syle-anchor">&nbsp;</a>
<div class="method-section"> <div class="method-section">
<div class="method-description"> <div class="method-description">
<h3>Configuration</h3> <h3>Currency</h3>
<p>Application related configuration. For example, selecting the currencies permitted for use within the MFI.</p> <p>Application related configuration around viewing/updating the currencies permitted for use within the MFI.</p>
</div> </div>
</div> </div>
@@ -2155,61 +2234,42 @@ Request Body:
<h4>Retrieve Currency Configuration</h4> <h4>Retrieve Currency Configuration</h4>
<p>Returns the list of currencies permitted for use AND the list of currencies not selected (but available for selection).</p> <p>Returns the list of currencies permitted for use AND the list of currencies not selected (but available for selection).</p>
<p>Example Requests: </p> <p>Example Requests: </p>
<div class=apiClick>configurations/currency</div> <div class=apiClick>currencies</div>
<br><br> <br><br>
<div class=apiClick>configurations/currency?fields=selectedCurrencyOptions</div> <div class=apiClick>currencies?fields=selectedCurrencyOptions</div>
</div> </div>
<div class="method-example"> <div class="method-example">
<code class="method-declaration">GET https://Domain Name/api/v1/configurations/currency</code> <code class="method-declaration">GET https://Domain Name/api/v1/currencies</code>
<code class="method-response">{ <code class="method-response">{
"selectedCurrencyOptions" : [ { "selectedCurrencyOptions" : [ {
"code" : "XOF", "code": "USD",
"name" : "CFA Franc BCEAO", "name": "US Dollar",
"decimalPlaces" : 0, "decimalPlaces": 2,
"displaySymbol" : "CFA", "displaySymbol": "$",
"nameCode" : "currency.XOF", "nameCode": "currency.USD",
"displayLabel" : "CFA Franc BCEAO (CFA)" "displayLabel": "US Dollar ($)"
}, { }]
"code" : "ETB",
"name" : "Ethiopian Birr",
"decimalPlaces" : 2,
"nameCode" : "currency.ETB",
"displayLabel" : "Ethiopian Birr [ETB]"
} ],
"currencyOptions" : [ {
"code" : "AED",
"name" : "UAE Dirham",
"decimalPlaces" : 2,
"nameCode" : "currency.AED",
"displayLabel" : "UAE Dirham [AED]"
}, {
"code" : "AFN",
"name" : "Afghanistan Afghani",
"decimalPlaces" : 2,
"nameCode" : "currency.AFN",
"displayLabel" : "Afghanistan Afghani [AFN]"
}, ...
]
} }
</code> </code>
</div> </div>
</div> </div>
<a id="configs_currencyupdate" name="configs_currencyupdate" class="old-syle-anchor">&nbsp;</a> <a id="configs_currencyupdate" name="configs_currencyupdate" class="old-syle-anchor">&nbsp;</a>
<div class="method-section"> <div class="method-section">
<div class="method-description"> <div class="method-description">
<h4>Update Currency Configuration</h4> <h4>Update Currency Configuration</h4>
<p>Updates the list of currencies permitted for use.</p> <p>Updates the list of currencies permitted for use.</p>
</div> </div>
<div class="method-example"> <div class="method-example">
<code class="method-declaration">PUT https://Domain Name/api/v1/configurations/currency</code> <code class="method-declaration">PUT https://Domain Name/api/v1/currencies</code>
<code class="method-request">PUT configurations/currency <code class="method-request">PUT currencies
Content-Type: application/json Content-Type: application/json
Request Body:{ Request Body:
{
"currencies": ["KES", "BND", "LBP", "GHC", "USD", "XOF", "AED", "AMD"] "currencies": ["KES", "BND", "LBP", "GHC", "USD", "XOF", "AED", "AMD"]
} }
</code> </code>
<code class="method-response">{ <code class="method-response">{
"currencies": [ "currencies": [
"KES", "KES",
"BND", "BND",
@@ -2221,10 +2281,61 @@ Request Body:{
"AMD" "AMD"
] ]
} }
</code> </code>
</div>
</div> </div>
</div>
<a id="configs_global" name="configs_global" class="old-syle-anchor">&nbsp;</a>
<div class="method-section">
<div class="method-description">
<h3>Global Configuration</h3>
<p>Global configuration related to set of supported enable/disable configurations e.g. maker-checker.</p>
</div>
</div>
<a id="configs_globalconfig_retrieve" name="configs_globalconfig_retrieve" class="old-syle-anchor">&nbsp;</a>
<div class="method-section">
<div class="method-description">
<h4>Retrieve Global Configuration</h4>
<p>Returns the list global enable/disable configurations.</p>
<p>Example Requests: </p>
<div class=apiClick>configurations</div>
</div>
<div class="method-example">
<code class="method-declaration">GET https://Domain Name/api/v1/configurations</code>
<code class="method-response">{
"globalConfiguration": [
{
"name": "maker-checker",
"enabled": false
}
]
}
</code>
</div>
</div>
<a id="configs_globalconfig_currencyupdate" name="configs_globalconfig_currencyupdate" class="old-syle-anchor">&nbsp;</a>
<div class="method-section">
<div class="method-description">
<h4>Update Global Configuration</h4>
<p>Updates an enable/disable global configuration item.</p>
</div>
<div class="method-example">
<code class="method-declaration">PUT https://Domain Name/api/v1/configurations?maker-checker=false</code>
<code class="method-request">PUT configurations
Content-Type: application/json
Request Body:
{
}
</code>
<code class="method-response">{
"changes": {}
}
</code>
</div>
</div>
<!-- start of datatables api docs --> <!-- start of datatables api docs -->
<a id="datatables" name="datatables" class="old-syle-anchor">&nbsp;</a> <a id="datatables" name="datatables" class="old-syle-anchor">&nbsp;</a>
<div class="method-section"> <div class="method-section">
@@ -3154,11 +3265,14 @@ Request body:
Content-Type: application/json Content-Type: application/json
Request body: Request body:
{ {
"name": "Updated Role Name" "description": "some description(changed)"
} }
</code> </code>
<code class="method-response">{ <code class="method-response">{
"resourceId": 8 "resourceId": 8,
"changes": {
"description": "some description(changed)"
}
} }
</code> </code>
</div> </div>
@@ -3183,8 +3297,7 @@ Request body:
"code": "READ_PERMISSION", "code": "READ_PERMISSION",
"entityName": "PERMISSION", "entityName": "PERMISSION",
"actionName": "READ", "actionName": "READ",
"selected": false, "selected": false
"isMakerChecker": false
}, },
{ {
"grouping": "authorisation", "grouping": "authorisation",
@@ -3192,15 +3305,13 @@ Request body:
"entityName": "ROLE", "entityName": "ROLE",
"actionName": "CREATE", "actionName": "CREATE",
"selected": false, "selected": false,
"isMakerChecker": false
}, },
{ {
"grouping": "authorisation", "grouping": "authorisation",
"code": "DELETE_ROLE", "code": "DELETE_ROLE",
"entityName": "ROLE", "entityName": "ROLE",
"actionName": "DELETE", "actionName": "DELETE",
"selected": false, "selected": false
"isMakerChecker": false
},...] },...]
} }
</code> </code>
@@ -3218,13 +3329,16 @@ Request body:
Content-Type: application/json Content-Type: application/json
Request body: Request body:
{ {
ADJUST_LOAN: "true", "permissions": {"ALL_FUNCTIONS_READ": "true"}
ALL_FUNCTIONS: "true",
ALL_FUNCTIONS_READ: "true"
} }
</code> </code>
<code class="method-response">{ <code class="method-response">{
"resourceId": 8 "resourceId": 8,
"changes": {
"permissions": {
"ALL_FUNCTIONS_READ": true
}
}
} }
</code> </code>
</div> </div>
@@ -3298,7 +3412,21 @@ ALL_FUNCTIONS_READ: "true"
<tr><td></td><td>offices/{officeId}</td><td></td><td><a href="#offices_retrieve">Retrieve an Office</a></td><td><a href="#offices_update">Update an Office</a></td><td></td></tr> <tr><td></td><td>offices/{officeId}</td><td></td><td><a href="#offices_retrieve">Retrieve an Office</a></td><td><a href="#offices_update">Update an Office</a></td><td></td></tr>
<tr class="alt"><td><a href="#loanproducts">LOAN PRODUCT</a></td><td>loanproducts</td><td><a href="#loanproducts_create">Create a Loan Product</a></td><td><a href="#loanproducts_list">List Loan Products</a></td><td></td><td></td></tr> <tr class="alt"><td><a href="#loanproducts">LOAN PRODUCT</a></td><td>loanproducts</td><td><a href="#loanproducts_create">Create a Loan Product</a></td><td><a href="#loanproducts_list">List Loan Products</a></td><td></td><td></td></tr>
<tr><td></td><td>loanproducts/{productId}</td><td></td><td><a href="#loanproducts_retrieve">Retrieve a Loan Product</a></td><td><a href="#loanproducts_update">Update a Loan Product</a></td><td></td></tr> <tr><td></td><td>loanproducts/{productId}</td><td></td><td><a href="#loanproducts_retrieve">Retrieve a Loan Product</a></td><td><a href="#loanproducts_update">Update a Loan Product</a></td><td></td></tr>
<tr class="alt"><td><a href="#configs">CONFIGURATION</a></td><td>configurations/currency</td><td></td><td><a href="#configs_currencyretrieve">Retrieve Currency Configuration</a></td><td><a href="#configs_currencyupdate">Update Currency Configuration</a></td><td></td></tr> <tr class="alt">
<td><a href="#configs">CURRENCY</a></td>
<td>currencies</td>
<td></td>
<td><a href="#configs_currencyretrieve">Retrieve Currency Configuration</a></td>
<td><a href="#configs_currencyupdate">Update Currency Configuration</a></td>
<td></td>
</tr>
<tr class="alt">
<td><a href="#configs_global">GLOBAL CONFIGURATION</a></td><td>configurations</td>
<td></td>
<td><a href="#configs_globalconfig_retrieve">Retrieve Global Configuration</a></td>
<td><a href="#configs_globalconfig_currencyupdate">Update Global Configuration</a></td>
<td></td>
</tr>
<tr><td><a href="#datatables">DATA TABLE</a></td><td>datatables</td><td></td><td><a href="#datatables_list">List Data Tables</a></td><td></td><td></td></tr> <tr><td><a href="#datatables">DATA TABLE</a></td><td>datatables</td><td></td><td><a href="#datatables_list">List Data Tables</a></td><td></td><td></td></tr>
<tr class="alt"><td></td><td>datatables/register/{datatable}/{apptable}</td><td><a href="#datatables_register">Register Data Table</a></td><td></td><td></td><td></td></tr> <tr class="alt"><td></td><td>datatables/register/{datatable}/{apptable}</td><td><a href="#datatables_register">Register Data Table</a></td><td></td><td></td><td></td></tr>
<tr><td></td><td>datatables/deregister/{datatable}</td><td><a href="#datatables_deregister">Deregister Data Table</a></td><td></td><td></td><td></td></tr> <tr><td></td><td>datatables/deregister/{datatable}</td><td><a href="#datatables_deregister">Deregister Data Table</a></td><td></td><td></td><td></td></tr>
@@ -75,10 +75,6 @@ CREATE TABLE `m_organisation_currency` (
`name` varchar(50) NOT NULL, `name` varchar(50) NOT NULL,
`display_symbol` varchar(10) DEFAULT NULL, `display_symbol` varchar(10) DEFAULT NULL,
`internationalized_name_code` varchar(50) NOT NULL, `internationalized_name_code` varchar(50) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8; ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -1,4 +1,4 @@
-- currency symbols may not apply through command line on windows so use a different client like mysql workbench -- currency symbols may not apply through command line on windows so use a different client like mysql workbench
INSERT INTO `ref_loan_transaction_processing_strategy` INSERT INTO `ref_loan_transaction_processing_strategy`
(`id`,`code`,`name`) (`id`,`code`,`name`)
@@ -66,7 +66,7 @@ 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'), (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,'€','Euro','currency.EUR'), (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 (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'), Islands Pound','currency.FKP'),(49,'GBP',2,NULL,'Pound Sterling','currency.GBP'),(50,'GEL',2,NULL,'Georgian Lari','currency.GEL'),
@@ -79,7 +79,7 @@ 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'), (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,'?','Indian Rupee','currency.INR'), (64,'INR',2,'₹','Indian Rupee','currency.INR'),
(65,'IQD',3,NULL,'Iraqi Dinar','currency.IQD'),(66,'IRR',2,NULL,'Iranian Rial','currency.IRR'), (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'), (67,'ISK',0,NULL,'Iceland Krona','currency.ISK'),(68,'JMD',2,NULL,'Jamaican Dollar','currency.JMD'),(69,'JOD',3,NULL,'Jordanian Dinar','currency.JOD'),
@@ -92,7 +92,7 @@ Islands Pound','currency.FKP'),(49,'GBP',2,NULL,'Pound Sterling','currency.GBP')
(78,'KYD',2,NULL,'Cayman Islands Dollar','currency.KYD'),(79,'KZT',2,NULL,'Kazakhstan Tenge','currency.KZT'), (78,'KYD',2,NULL,'Cayman Islands Dollar','currency.KYD'),(79,'KZT',2,NULL,'Kazakhstan Tenge','currency.KZT'),
(80,'LAK',2,NULL,'Lao Kip','currency.LAK'), (80,'LAK',2,NULL,'Lao Kip','currency.LAK'),
(81,'LBP',2,'L£','Lebanese Pound','currency.LBP'), (81,'LBP',2,'L£','Lebanese Pound','currency.LBP'),
(82,'LKR',2,NULL,'Sri Lanka Rupee','currency.LKR'),(83,'LRD',2,NULL,'Liberian Dollar','currency.LRD'),(84,'LSL',2,NULL,'Lesotho Loti','currency.LSL'), (82,'LKR',2,NULL,'Sri Lanka Rupee','currency.LKR'),(83,'LRD',2,NULL,'Liberian Dollar','currency.LRD'),(84,'LSL',2,NULL,'Lesotho Loti','currency.LSL'),
(85,'LTL',2,NULL,'Lithuanian Litas','currency.LTL'),(86,'LVL',2,NULL,'Latvian Lats','currency.LVL'),(87,'LYD',3,NULL,'Libyan Dinar','currency.LYD'), (85,'LTL',2,NULL,'Lithuanian Litas','currency.LTL'),(86,'LVL',2,NULL,'Latvian Lats','currency.LVL'),(87,'LYD',3,NULL,'Libyan Dinar','currency.LYD'),
@@ -151,9 +151,8 @@ Pound','currency.SYP'),(136,'SZL',2,NULL,'Swaziland Lilangeni','currency.SZL'),(
(162,'ZMK',2,NULL,'Zambian Kwacha','currency.ZMK'), (162,'ZMK',2,NULL,'Zambian Kwacha','currency.ZMK'),
(163,'ZWD',2,NULL,'Zimbabwe Dollar','currency.ZWD'); (163,'ZWD',2,NULL,'Zimbabwe Dollar','currency.ZWD');
INSERT INTO `m_organisation_currency` (`id`, `code`, `decimal_places`, `name`, `display_symbol`, `internationalized_name_code`, `createdby_id`, `created_date`, INSERT INTO `m_organisation_currency` (`id`, `code`, `decimal_places`, `name`, `display_symbol`, `internationalized_name_code`)
`lastmodified_date`, `lastmodifiedby_id`) VALUES (21,'USD',2,'US Dollar','$','currency.USD');
VALUES (21,'USD',2,'US Dollar','$','currency.USD',1,'2012-05-01 22:43:02','2012-05-01 22:43:02',1);
-- create single code and code value for client identifiers -- create single code and code value for client identifiers
INSERT INTO `m_code` INSERT INTO `m_code`
@@ -159,6 +159,68 @@ LOCK TABLES `acc_product_mapping` WRITE;
/*!40000 ALTER TABLE `acc_product_mapping` ENABLE KEYS */; /*!40000 ALTER TABLE `acc_product_mapping` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `additional client fields data`
--
DROP TABLE IF EXISTS `additional client fields data`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `additional client fields data` (
`client_id` bigint(20) NOT NULL,
`Business Description` varchar(100) DEFAULT NULL,
`Years in Business` int(11) DEFAULT NULL,
`Gender_cd` int(11) DEFAULT NULL,
`Education_cv` varchar(60) DEFAULT NULL,
`Next Visit` date DEFAULT NULL,
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
`Comment` text,
PRIMARY KEY (`client_id`),
CONSTRAINT `FK_Additional Client Fields Data_1` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `additional client fields data`
--
LOCK TABLES `additional client fields data` WRITE;
/*!40000 ALTER TABLE `additional client fields data` DISABLE KEYS */;
INSERT INTO `additional client fields data` VALUES (15,'first business',45,21,'Trade','2012-10-10','4.400000','some comments\ni \nmade up'),(16,NULL,88,21,'Trade','2012-10-03',NULL,'lk\nk\nk'),(17,'farmer',10,21,'Primary','2012-11-17','12.000000','efewd'),(36,NULL,NULL,21,'Primary','2012-11-15',NULL,NULL);
/*!40000 ALTER TABLE `additional client fields data` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `additional loan fields data`
--
DROP TABLE IF EXISTS `additional loan fields data`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `additional loan fields data` (
`loan_id` bigint(20) NOT NULL,
`Business Description` varchar(100) DEFAULT NULL,
`Years in Business` int(11) DEFAULT NULL,
`Gender_cd` int(11) DEFAULT NULL,
`Education_cv` varchar(60) DEFAULT NULL,
`Next Visit` date DEFAULT NULL,
`Highest Rate Paid` decimal(19,6) DEFAULT NULL,
`Comment` text,
PRIMARY KEY (`loan_id`),
CONSTRAINT `FK_Additional Loan Fields Data_1` FOREIGN KEY (`loan_id`) REFERENCES `m_loan` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `additional loan fields data`
--
LOCK TABLES `additional loan fields data` WRITE;
/*!40000 ALTER TABLE `additional loan fields data` DISABLE KEYS */;
INSERT INTO `additional loan fields data` VALUES (44,NULL,NULL,21,'Tertiary',NULL,NULL,'some comment'),(52,'IT Consultant',2004,21,'Primary','2012-12-12',NULL,'no further comment');
/*!40000 ALTER TABLE `additional loan fields data` ENABLE KEYS */;
UNLOCK TABLES;
-- --
-- Table structure for table `c_configuration` -- Table structure for table `c_configuration`
-- --
@@ -184,6 +246,72 @@ INSERT INTO `c_configuration` VALUES (1,'maker-checker',0);
/*!40000 ALTER TABLE `c_configuration` ENABLE KEYS */; /*!40000 ALTER TABLE `c_configuration` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `extra family details data`
--
DROP TABLE IF EXISTS `extra family details data`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `extra family details data` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`client_id` bigint(20) NOT NULL,
`Name` varchar(40) DEFAULT NULL,
`Date of Birth` date DEFAULT NULL,
`Points Score` int(11) DEFAULT NULL,
`Education_cdHighest` int(11) DEFAULT NULL,
`Other Notes` text,
PRIMARY KEY (`id`),
KEY `FK_Extra Family Details Data_1` (`client_id`),
CONSTRAINT `FK_Extra Family Details Data_1` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `extra family details data`
--
LOCK TABLES `extra family details data` WRITE;
/*!40000 ALTER TABLE `extra family details data` DISABLE KEYS */;
INSERT INTO `extra family details data` VALUES (1,16,'fasdf','2012-10-02',NULL,5,NULL),(2,35,'Jo','2004-02-04',NULL,4,NULL),(3,17,'father','1961-11-09',1,4,'kkn'),(4,15,'sfdgd',NULL,NULL,NULL,NULL),(5,15,'tretw',NULL,NULL,NULL,NULL),(6,17,'asdfasd','2013-01-22',12,4,'asdfa');
/*!40000 ALTER TABLE `extra family details data` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `extra_client_details`
--
DROP TABLE IF EXISTS `extra_client_details`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `extra_client_details` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`client_id` bigint(20) NOT NULL,
`client_dob` date DEFAULT NULL,
`client_address` varchar(60) DEFAULT NULL,
`father_name` varchar(40) DEFAULT NULL,
`nominee` varchar(40) DEFAULT NULL,
`nominee_relationship` varchar(40) DEFAULT NULL,
`nominee_address` varchar(60) DEFAULT NULL,
`crime_no` varchar(40) DEFAULT NULL,
`police_station` varchar(40) DEFAULT NULL,
`other_notes` text,
PRIMARY KEY (`id`),
UNIQUE KEY `client_id` (`client_id`),
KEY `FK_extra_client_details_1` (`client_id`),
CONSTRAINT `FK_extra_client_details` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `extra_client_details`
--
LOCK TABLES `extra_client_details` WRITE;
/*!40000 ALTER TABLE `extra_client_details` DISABLE KEYS */;
/*!40000 ALTER TABLE `extra_client_details` ENABLE KEYS */;
UNLOCK TABLES;
-- --
-- Table structure for table `m_appuser` -- Table structure for table `m_appuser`
-- --
@@ -367,6 +495,73 @@ LOCK TABLES `m_client_identifier` WRITE;
/*!40000 ALTER TABLE `m_client_identifier` ENABLE KEYS */; /*!40000 ALTER TABLE `m_client_identifier` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `m_client_xadditional information`
--
DROP TABLE IF EXISTS `m_client_xadditional information`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `m_client_xadditional information` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`Ethnic Group` varchar(50) DEFAULT NULL,
`Ethnic Group Other` varchar(50) DEFAULT NULL,
`Household Location` varchar(50) DEFAULT NULL,
`Household Location Other` varchar(50) DEFAULT NULL,
`Religion` varchar(50) DEFAULT NULL,
`Religion Other` varchar(50) DEFAULT NULL,
`Knowledge of Person` varchar(50) DEFAULT NULL,
`Gender` varchar(10) DEFAULT NULL,
`Whois` mediumtext,
PRIMARY KEY (`id`),
CONSTRAINT `portfolio_client_extra_Additional Information_fk1` FOREIGN KEY (`id`) REFERENCES `m_client` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=35 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `m_client_xadditional information`
--
LOCK TABLES `m_client_xadditional information` WRITE;
/*!40000 ALTER TABLE `m_client_xadditional information` DISABLE KEYS */;
INSERT INTO `m_client_xadditional information` VALUES (1,'Italian',NULL,'North Sikkim',NULL,'Unknown',NULL,'Friend of staff member','Male','More info about this and other things\n\nuntil the end'),(4,'Bedouin',NULL,'North Sikkim',NULL,'Atheist',NULL,'Staff member',NULL,NULL),(13,'Other','Chin','Other','Zatual','Protestant',NULL,'Other','Male',NULL),(15,'Berber',NULL,'South Sikkim',NULL,'Animist',NULL,NULL,'Male',NULL),(16,'Italian',NULL,'North Sikkim',NULL,NULL,NULL,'Friend of staff member',NULL,NULL),(17,'Berber',NULL,'North Sikkim',NULL,'Muslim',NULL,'Spouse of staff member','Male',NULL),(24,'Unknown',NULL,'East Sikkim',NULL,'Animist',NULL,'Staff member','Male',NULL),(25,'Other','Kryptonian','Other','Metropolis','Other','Humanist','Other','Male','Farm boy turned reporter.'),(27,'Other','Asian','Other','Xian','Other',NULL,'Other','Female','uh?'),(34,'Italian',NULL,'East Sikkim',NULL,'Muslim',NULL,'Not known by any staff member','Male',NULL);
/*!40000 ALTER TABLE `m_client_xadditional information` ENABLE KEYS */;
UNLOCK TABLES;
--
-- Table structure for table `m_client_xhighly improbable info`
--
DROP TABLE IF EXISTS `m_client_xhighly improbable info`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `m_client_xhighly improbable info` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`Fathers Favourite Team` varchar(50) DEFAULT NULL,
`Mothers Favourite Team` varchar(50) DEFAULT NULL,
`Fathers DOB` date DEFAULT NULL,
`Mothers DOB` date DEFAULT NULL,
`Fathers Education` varchar(50) DEFAULT NULL,
`Mothers Education` varchar(50) DEFAULT NULL,
`Number of Children` int(11) DEFAULT NULL,
`Favourite Town` varchar(30) DEFAULT NULL,
`Closing Comments` mediumtext,
`Annual Family Income` decimal(19,6) DEFAULT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `portfolio_client_extra_Highly Improbable Info_fk1` FOREIGN KEY (`id`) REFERENCES `m_client` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `m_client_xhighly improbable info`
--
LOCK TABLES `m_client_xhighly improbable info` WRITE;
/*!40000 ALTER TABLE `m_client_xhighly improbable info` DISABLE KEYS */;
INSERT INTO `m_client_xhighly improbable info` VALUES (1,'AC Milan','Manchester Utd',NULL,NULL,'Secondary','Secondary',NULL,NULL,NULL,NULL),(2,'Sao Paulo',NULL,'2012-07-12',NULL,NULL,NULL,NULL,NULL,'bally\r\n\r\ncl',NULL),(3,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(16,'Sao Paulo',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(17,'Juventus',NULL,'2012-08-15',NULL,NULL,NULL,NULL,NULL,NULL,NULL),(25,'None, hates soccer','Sao Paulo','1984-04-19','1978-11-16','Trade','Tertiary',3,'Copenhagen','We find him not guilty.','30000.432000');
/*!40000 ALTER TABLE `m_client_xhighly improbable info` ENABLE KEYS */;
UNLOCK TABLES;
-- --
-- Table structure for table `m_code` -- Table structure for table `m_code`
-- --
@@ -958,6 +1153,35 @@ LOCK TABLES `m_loan_transaction` WRITE;
/*!40000 ALTER TABLE `m_loan_transaction` ENABLE KEYS */; /*!40000 ALTER TABLE `m_loan_transaction` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `m_loan_xadditional information`
--
DROP TABLE IF EXISTS `m_loan_xadditional information`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `m_loan_xadditional information` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`Business Location` varchar(50) DEFAULT NULL,
`Business Location Other` varchar(50) DEFAULT NULL,
`Business` varchar(10) DEFAULT NULL,
`Business Description` mediumtext,
`Business Title` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id`),
CONSTRAINT `portfolio_loan_extra_Additional Information_fk1` FOREIGN KEY (`id`) REFERENCES `m_loan` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=32 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `m_loan_xadditional information`
--
LOCK TABLES `m_loan_xadditional information` WRITE;
/*!40000 ALTER TABLE `m_loan_xadditional information` DISABLE KEYS */;
INSERT INTO `m_loan_xadditional information` VALUES (1,'East Sikkim',NULL,'New',NULL,NULL),(30,'Other','Metropolis','Existing','Reporting on those wacky superheroes.','Daily Planet'),(31,'Other','EVERYWHERE','New',NULL,'Batman Justice Inc.');
/*!40000 ALTER TABLE `m_loan_xadditional information` ENABLE KEYS */;
UNLOCK TABLES;
-- --
-- Table structure for table `m_note` -- Table structure for table `m_note`
-- --
@@ -1084,10 +1308,6 @@ CREATE TABLE `m_organisation_currency` (
`name` varchar(50) NOT NULL, `name` varchar(50) NOT NULL,
`display_symbol` varchar(10) DEFAULT NULL, `display_symbol` varchar(10) DEFAULT NULL,
`internationalized_name_code` varchar(50) NOT NULL, `internationalized_name_code` varchar(50) NOT NULL,
`createdby_id` bigint(20) DEFAULT NULL,
`created_date` datetime DEFAULT NULL,
`lastmodified_date` datetime DEFAULT NULL,
`lastmodifiedby_id` bigint(20) DEFAULT NULL,
PRIMARY KEY (`id`) PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8; ) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */; /*!40101 SET character_set_client = @saved_cs_client */;
@@ -1098,7 +1318,7 @@ CREATE TABLE `m_organisation_currency` (
LOCK TABLES `m_organisation_currency` WRITE; LOCK TABLES `m_organisation_currency` WRITE;
/*!40000 ALTER TABLE `m_organisation_currency` DISABLE KEYS */; /*!40000 ALTER TABLE `m_organisation_currency` DISABLE KEYS */;
INSERT INTO `m_organisation_currency` VALUES (21,'USD',2,'US Dollar','$','currency.USD',1,'2012-05-01 22:43:02','2012-05-01 22:43:02',1); INSERT INTO `m_organisation_currency` VALUES (21,'USD',2,'US Dollar','$','currency.USD');
/*!40000 ALTER TABLE `m_organisation_currency` ENABLE KEYS */; /*!40000 ALTER TABLE `m_organisation_currency` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
@@ -1648,6 +1868,63 @@ INSERT INTO `ref_loan_transaction_processing_strategy` VALUES (1,'mifos-standard
/*!40000 ALTER TABLE `ref_loan_transaction_processing_strategy` ENABLE KEYS */; /*!40000 ALTER TABLE `ref_loan_transaction_processing_strategy` ENABLE KEYS */;
UNLOCK TABLES; UNLOCK TABLES;
--
-- Table structure for table `risk_analysis`
--
DROP TABLE IF EXISTS `risk_analysis`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `risk_analysis` (
`client_id` bigint(20) NOT NULL,
`proposed_loan_amount` decimal(19,6) DEFAULT NULL,
`assets_cash` decimal(19,6) DEFAULT NULL,
`assets_bank_accounts` decimal(19,6) DEFAULT NULL,
`assets_accounts_receivable` decimal(19,6) DEFAULT NULL,
`assets_inventory` decimal(19,6) DEFAULT NULL,
`assets_total_fixed_business` decimal(19,6) DEFAULT NULL,
`assets_total_business` decimal(19,6) DEFAULT NULL,
`assets_total_household` decimal(19,6) DEFAULT NULL,
`liabilities_accounts_payable` decimal(19,6) DEFAULT NULL,
`liabilities_business_debts` decimal(19,6) DEFAULT NULL,
`liabilities_total_business` decimal(19,6) DEFAULT NULL,
`liabilities_equity_working_capital` decimal(19,6) DEFAULT NULL,
`liabilities_total_household` decimal(19,6) DEFAULT NULL,
`liabilities_household_equity` decimal(19,6) DEFAULT NULL,
`cashflow_cash_sales` decimal(19,6) DEFAULT NULL,
`cashflow_cash_sales2` decimal(19,6) DEFAULT NULL,
`cashflow_cost_goods_sold` decimal(19,6) DEFAULT NULL,
`cashflow_cost_goods_sold2` decimal(19,6) DEFAULT NULL,
`cashflow_gross_profit` decimal(19,6) DEFAULT NULL,
`cashflow_other_income1` decimal(19,6) DEFAULT NULL,
`cashflow_total_income2` decimal(19,6) DEFAULT NULL,
`cashflow_household_expense` decimal(19,6) DEFAULT NULL,
`cashflow_payments_to_savings` decimal(19,6) DEFAULT NULL,
`cashflow_operational_expenses` decimal(19,6) DEFAULT NULL,
`cashflow_disposable_income` decimal(19,6) DEFAULT NULL,
`cashflow_amount_loan_installment` decimal(19,6) DEFAULT NULL,
`cashflow_available_surplus` decimal(19,6) DEFAULT NULL,
`fi_inventory_turnover` decimal(19,6) DEFAULT NULL,
`fi_gross_margin` decimal(19,6) DEFAULT NULL,
`fi_indebtedness` decimal(19,6) DEFAULT NULL,
`fi_loan_recommendation` decimal(19,6) DEFAULT NULL,
`fi_roe` decimal(19,6) DEFAULT NULL,
`fi_repayment_capacity` decimal(19,6) DEFAULT NULL,
PRIMARY KEY (`client_id`),
CONSTRAINT `FK_risk_analysis_1` FOREIGN KEY (`client_id`) REFERENCES `m_client` (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Dumping data for table `risk_analysis`
--
LOCK TABLES `risk_analysis` WRITE;
/*!40000 ALTER TABLE `risk_analysis` DISABLE KEYS */;
INSERT INTO `risk_analysis` VALUES (3,'33.000000','1.000000',NULL,'3.000000',NULL,NULL,'4.000000',NULL,NULL,NULL,'55.000000','-51.000000',NULL,'0.000000',NULL,NULL,NULL,NULL,'0.000000',NULL,NULL,NULL,NULL,NULL,'0.000000',NULL,'0.000000',NULL,NULL,'-1.080000','-1.730000','0.000000',NULL),(15,'0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000','0.000000'),(16,'444.000000','51.000000',NULL,'33.330000',NULL,NULL,'84.330000',NULL,NULL,NULL,NULL,'84.330000',NULL,'0.000000','444.000000','3.000000','343.000000','42.000000','62.000000',NULL,NULL,NULL,NULL,NULL,'62.000000',NULL,'62.000000',NULL,'0.230000','0.000000','5.270000','0.740000','0.000000'),(22,NULL,'50000.000000',NULL,NULL,NULL,NULL,'50000.000000',NULL,NULL,NULL,NULL,'50000.000000',NULL,'0.000000','20000.000000',NULL,NULL,NULL,'20000.000000',NULL,NULL,'8300.000000',NULL,'2000.000000','9700.000000',NULL,'9700.000000',NULL,'1.000000','0.000000','0.000000','0.400000','0.000000'),(25,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),(58,NULL,'500000.000000',NULL,NULL,NULL,NULL,'500000.000000',NULL,NULL,NULL,NULL,'500000.000000',NULL,'0.000000',NULL,NULL,NULL,NULL,'0.000000','30000.000000',NULL,'0.000000',NULL,'3000.000000','27000.000000',NULL,'27000.000000',NULL,NULL,'0.000000','0.000000','0.000000','0.000000');
/*!40000 ALTER TABLE `risk_analysis` ENABLE KEYS */;
UNLOCK TABLES;
-- --
-- Table structure for table `rpt_sequence` -- Table structure for table `rpt_sequence`
-- --
@@ -1793,4 +2070,4 @@ UNLOCK TABLES;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2013-01-26 20:21:03 -- Dump completed on 2013-01-27 0:02:57
@@ -0,0 +1,5 @@
ALTER TABLE `m_organisation_currency`
DROP COLUMN `lastmodifiedby_id` ,
DROP COLUMN `lastmodified_date` ,
DROP COLUMN `created_date`,
DROP COLUMN `createdby_id`;
@@ -72,7 +72,10 @@ public class CurrenciesApiResource {
@Produces({ MediaType.APPLICATION_JSON }) @Produces({ MediaType.APPLICATION_JSON })
public String updateCurrencies(final String apiRequestBodyAsJson) { public String updateCurrencies(final String apiRequestBodyAsJson) {
final CommandWrapper commandRequest = new CommandWrapperBuilder().updateCurrencies().withJson(apiRequestBodyAsJson).build(); final CommandWrapper commandRequest = new CommandWrapperBuilder() //
.updateCurrencies() //
.withJson(apiRequestBodyAsJson) //
.build();
final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest); final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
@@ -1,12 +1,12 @@
package org.mifosplatform.organisation.monetary.service; package org.mifosplatform.organisation.monetary.service;
import java.util.List; import java.util.Collection;
import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.organisation.monetary.data.CurrencyData;
public interface CurrencyReadPlatformService { public interface CurrencyReadPlatformService {
List<CurrencyData> retrieveAllowedCurrencies(); Collection<CurrencyData> retrieveAllowedCurrencies();
List<CurrencyData> retrieveAllPlatformCurrencies(); Collection<CurrencyData> retrieveAllPlatformCurrencies();
} }
@@ -2,7 +2,7 @@ package org.mifosplatform.organisation.monetary.service;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.List; import java.util.Collection;
import org.mifosplatform.infrastructure.core.domain.JdbcSupport; import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource; import org.mifosplatform.infrastructure.core.service.TenantAwareRoutingDataSource;
@@ -18,33 +18,31 @@ public class CurrencyReadPlatformServiceImpl implements CurrencyReadPlatformServ
private final JdbcTemplate jdbcTemplate; private final JdbcTemplate jdbcTemplate;
private final PlatformSecurityContext context; private final PlatformSecurityContext context;
private final CurrencyMapper currencyRowMapper;
@Autowired @Autowired
public CurrencyReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource) { public CurrencyReadPlatformServiceImpl(final PlatformSecurityContext context, final TenantAwareRoutingDataSource dataSource) {
this.context = context; this.context = context;
this.jdbcTemplate = new JdbcTemplate(dataSource); this.jdbcTemplate = new JdbcTemplate(dataSource);
this.currencyRowMapper = new CurrencyMapper();
} }
@Override @Override
public List<CurrencyData> retrieveAllowedCurrencies() { public Collection<CurrencyData> retrieveAllowedCurrencies() {
context.authenticatedUser(); context.authenticatedUser();
String sql = "select c.code as code, c.name as name, c.decimal_places as decimalPlaces, c.display_symbol as displaySymbol, c.internationalized_name_code as nameCode from m_organisation_currency c order by c.name"; final String sql = "select " + currencyRowMapper.schema() + " from m_organisation_currency c order by c.name";
RowMapper<CurrencyData> rm = new CurrencyMapper(); return this.jdbcTemplate.query(sql, currencyRowMapper, new Object[] {});
return this.jdbcTemplate.query(sql, rm, new Object[] {});
} }
@Override @Override
public List<CurrencyData> retrieveAllPlatformCurrencies() { public Collection<CurrencyData> retrieveAllPlatformCurrencies() {
String sql = "select c.code as code, c.name as name, c.decimal_places as decimalPlaces, c.display_symbol as displaySymbol, c.internationalized_name_code as nameCode from m_currency c order by c.name"; final String sql = "select " + currencyRowMapper.schema() + " from m_currency c order by c.name";
RowMapper<CurrencyData> rm = new CurrencyMapper(); return this.jdbcTemplate.query(sql, currencyRowMapper, new Object[] {});
return this.jdbcTemplate.query(sql, rm, new Object[] {});
} }
private static final class CurrencyMapper implements RowMapper<CurrencyData> { private static final class CurrencyMapper implements RowMapper<CurrencyData> {
@@ -52,13 +50,17 @@ public class CurrencyReadPlatformServiceImpl implements CurrencyReadPlatformServ
@Override @Override
public CurrencyData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException { public CurrencyData mapRow(final ResultSet rs, @SuppressWarnings("unused") final int rowNum) throws SQLException {
String code = rs.getString("code"); final String code = rs.getString("code");
String name = rs.getString("name"); final String name = rs.getString("name");
int decimalPlaces = JdbcSupport.getInteger(rs, "decimalPlaces"); final int decimalPlaces = JdbcSupport.getInteger(rs, "decimalPlaces");
String displaySymbol = rs.getString("displaySymbol"); final String displaySymbol = rs.getString("displaySymbol");
String nameCode = rs.getString("nameCode"); final String nameCode = rs.getString("nameCode");
return new CurrencyData(code, name, decimalPlaces, displaySymbol, nameCode); return new CurrencyData(code, name, decimalPlaces, displaySymbol, nameCode);
} }
public String schema() {
return " c.code as code, c.name as name, c.decimal_places as decimalPlaces, c.display_symbol as displaySymbol, c.internationalized_name_code as nameCode ";
}
} }
} }
@@ -70,6 +70,9 @@ public class CurrencyWritePlatformServiceJpaRepositoryImpl implements CurrencyWr
this.organisationCurrencyRepository.deleteAll(); this.organisationCurrencyRepository.deleteAll();
this.organisationCurrencyRepository.save(allowedCurrencies); this.organisationCurrencyRepository.save(allowedCurrencies);
return new CommandProcessingResultBuilder().withCommandId(command.commandId()).with(changes).build(); return new CommandProcessingResultBuilder() //
.withCommandId(command.commandId()) //
.with(changes) //
.build();
} }
} }
@@ -1,6 +1,6 @@
package org.mifosplatform.organisation.monetary.service; package org.mifosplatform.organisation.monetary.service;
import java.util.List; import java.util.Collection;
import org.mifosplatform.organisation.monetary.data.ApplicationCurrencyConfigurationData; import org.mifosplatform.organisation.monetary.data.ApplicationCurrencyConfigurationData;
import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.organisation.monetary.data.CurrencyData;
@@ -20,8 +20,8 @@ public class OrganisationCurrencyReadPlatformServiceImpl implements Organisation
@Override @Override
public ApplicationCurrencyConfigurationData retrieveCurrencyConfiguration() { public ApplicationCurrencyConfigurationData retrieveCurrencyConfiguration() {
final List<CurrencyData> selectedCurrencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies(); final Collection<CurrencyData> selectedCurrencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies();
final List<CurrencyData> currencyOptions = this.currencyReadPlatformService.retrieveAllPlatformCurrencies(); final Collection<CurrencyData> currencyOptions = this.currencyReadPlatformService.retrieveAllPlatformCurrencies();
// remove selected currency options // remove selected currency options
currencyOptions.removeAll(selectedCurrencyOptions); currencyOptions.removeAll(selectedCurrencyOptions);
@@ -1,7 +1,7 @@
package org.mifosplatform.organisation.office.data; package org.mifosplatform.organisation.office.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.List; import java.util.Collection;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.mifosplatform.organisation.monetary.data.CurrencyData; import org.mifosplatform.organisation.monetary.data.CurrencyData;
@@ -30,12 +30,12 @@ public class OfficeTransactionData {
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final String description; private final String description;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final List<CurrencyData> currencyOptions; private final Collection<CurrencyData> currencyOptions;
@SuppressWarnings("unused") @SuppressWarnings("unused")
private final List<OfficeLookup> allowedOffices; private final Collection<OfficeData> allowedOffices;
public OfficeTransactionData(final LocalDate transactionDate, final List<OfficeLookup> allowedOffices, public OfficeTransactionData(final LocalDate transactionDate, final Collection<OfficeData> allowedOffices,
final List<CurrencyData> currencyOptions) { final Collection<CurrencyData> currencyOptions) {
this.transactionDate = transactionDate; this.transactionDate = transactionDate;
this.allowedOffices = allowedOffices; this.allowedOffices = allowedOffices;
this.currencyOptions = currencyOptions; this.currencyOptions = currencyOptions;
@@ -63,6 +63,5 @@ public class OfficeTransactionData {
this.transactionDate = transactionDate; this.transactionDate = transactionDate;
this.currencyOptions = null; this.currencyOptions = null;
this.allowedOffices = null; this.allowedOffices = null;
} }
} }
@@ -4,32 +4,34 @@ import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.Table; import javax.persistence.Table;
import org.mifosplatform.infrastructure.core.domain.AbstractAuditableCustom; import org.springframework.data.jpa.domain.AbstractPersistable;
import org.mifosplatform.useradministration.domain.AppUser;
/**
* Represents currencies allowed for this MFI/organisation.
*/
@Entity @Entity
@Table(name = "m_organisation_currency") @Table(name = "m_organisation_currency")
public class OrganisationCurrency extends AbstractAuditableCustom<AppUser, Long> { public class OrganisationCurrency extends AbstractPersistable<Long> {
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Column(name = "code", nullable = false, length=3) @Column(name = "code", nullable = false, length = 3)
private final String code; private final String code;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Column(name = "decimal_places", nullable = false) @Column(name = "decimal_places", nullable = false)
private final Integer decimalPlaces; private final Integer decimalPlaces;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Column(name = "name", nullable = false, length=50) @Column(name = "name", nullable = false, length = 50)
private final String name; private final String name;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Column(name = "internationalized_name_code", nullable = false, length=50) @Column(name = "internationalized_name_code", nullable = false, length = 50)
private final String nameCode; private final String nameCode;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@Column(name = "display_symbol", nullable = true, length=10) @Column(name = "display_symbol", nullable = true, length = 10)
private final String displaySymbol; private final String displaySymbol;
protected OrganisationCurrency() { protected OrganisationCurrency() {
this.code = null; this.code = null;
@@ -39,11 +41,12 @@ public class OrganisationCurrency extends AbstractAuditableCustom<AppUser, Long>
this.displaySymbol = null; this.displaySymbol = null;
} }
public OrganisationCurrency(final String code, final String name, final int decimalPlaces, final String nameCode, final String displaySymbol) { public OrganisationCurrency(final String code, final String name, final int decimalPlaces, final String nameCode,
final String displaySymbol) {
this.code = code; this.code = code;
this.name = name; this.name = name;
this.decimalPlaces = decimalPlaces; this.decimalPlaces = decimalPlaces;
this.nameCode = nameCode; this.nameCode = nameCode;
this.displaySymbol = displaySymbol; this.displaySymbol = displaySymbol;
} }
} }
@@ -5,7 +5,6 @@ import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import org.joda.time.LocalDate; import org.joda.time.LocalDate;
import org.mifosplatform.infrastructure.core.domain.JdbcSupport; import org.mifosplatform.infrastructure.core.domain.JdbcSupport;
@@ -246,8 +245,8 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService
public OfficeTransactionData retrieveNewOfficeTransactionDetails() { public OfficeTransactionData retrieveNewOfficeTransactionDetails() {
context.authenticatedUser(); context.authenticatedUser();
List<OfficeLookup> parentLookups = new ArrayList<OfficeLookup>(retrieveAllOfficesForLookup()); final Collection<OfficeData> parentLookups = retrieveAllOfficesForDropdown();
List<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies(); final Collection<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
return new OfficeTransactionData(new LocalDate(), parentLookups, currencyOptions); return new OfficeTransactionData(new LocalDate(), parentLookups, currencyOptions);
} }
@@ -1,6 +1,7 @@
package org.mifosplatform.portfolio.charge.data; package org.mifosplatform.portfolio.charge.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Collection;
import java.util.List; import java.util.List;
import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.infrastructure.core.data.EnumOptionData;
@@ -21,12 +22,12 @@ public class ChargeData {
private final EnumOptionData chargeAppliesTo; private final EnumOptionData chargeAppliesTo;
private final EnumOptionData chargeCalculationType; private final EnumOptionData chargeCalculationType;
private final List<CurrencyData> currencyOptions; private final Collection<CurrencyData> currencyOptions;
private final List<EnumOptionData> chargeCalculationTypeOptions; private final List<EnumOptionData> chargeCalculationTypeOptions;
private final List<EnumOptionData> chargeAppliesToOptions; private final List<EnumOptionData> chargeAppliesToOptions;
private final List<EnumOptionData> chargeTimeTypeOptions; private final List<EnumOptionData> chargeTimeTypeOptions;
public static ChargeData template(final List<CurrencyData> currencyOptions, final List<EnumOptionData> chargeCalculationTypeOptions, public static ChargeData template(final Collection<CurrencyData> currencyOptions, final List<EnumOptionData> chargeCalculationTypeOptions,
final List<EnumOptionData> chargeAppliesToOptions, final List<EnumOptionData> chargeTimeTypeOptions) { final List<EnumOptionData> chargeAppliesToOptions, final List<EnumOptionData> chargeTimeTypeOptions) {
return new ChargeData(null, null, null, null, null, null, null, false, false, currencyOptions, chargeCalculationTypeOptions, return new ChargeData(null, null, null, null, null, null, null, false, false, currencyOptions, chargeCalculationTypeOptions,
@@ -59,7 +60,7 @@ public class ChargeData {
public ChargeData(final Long id, final String name, final BigDecimal amount, final CurrencyData currency, public ChargeData(final Long id, final String name, final BigDecimal amount, final CurrencyData currency,
final EnumOptionData chargeTimeType, final EnumOptionData chargeAppliesTo, final EnumOptionData chargeCalculationType, final EnumOptionData chargeTimeType, final EnumOptionData chargeAppliesTo, final EnumOptionData chargeCalculationType,
final boolean penalty, final boolean active, final List<CurrencyData> currencyOptions, final boolean penalty, final boolean active, final Collection<CurrencyData> currencyOptions,
final List<EnumOptionData> chargeCalculationTypeOptions, final List<EnumOptionData> chargeAppliesToOptions, final List<EnumOptionData> chargeCalculationTypeOptions, final List<EnumOptionData> chargeAppliesToOptions,
final List<EnumOptionData> chargeTimeTypeOptions) { final List<EnumOptionData> chargeTimeTypeOptions) {
this.id = id; this.id = id;
@@ -72,7 +72,7 @@ public class ChargeReadPlatformServiceImpl implements ChargeReadPlatformService
this.context.authenticatedUser(); this.context.authenticatedUser();
final List<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies(); final Collection<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
final List<EnumOptionData> allowedChargeCalculationTypeOptions = this.chargeDropdownReadPlatformService.retrieveCalculationTypes(); final List<EnumOptionData> allowedChargeCalculationTypeOptions = this.chargeDropdownReadPlatformService.retrieveCalculationTypes();
final List<EnumOptionData> allowedChargeAppliesToOptions = this.chargeDropdownReadPlatformService.retrieveApplicableToTypes(); final List<EnumOptionData> allowedChargeAppliesToOptions = this.chargeDropdownReadPlatformService.retrieveApplicableToTypes();
final List<EnumOptionData> allowedChargeTimeOptions = this.chargeDropdownReadPlatformService.retrieveCollectionTimeTypes(); final List<EnumOptionData> allowedChargeTimeOptions = this.chargeDropdownReadPlatformService.retrieveCollectionTimeTypes();
@@ -177,7 +177,7 @@ public class LoanProductsApiResource {
Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveLoanApplicableCharges(feeChargesOnly); Collection<ChargeData> chargeOptions = this.chargeReadPlatformService.retrieveLoanApplicableCharges(feeChargesOnly);
chargeOptions.removeAll(productData.charges()); chargeOptions.removeAll(productData.charges());
final List<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies(); final Collection<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
final List<EnumOptionData> amortizationTypeOptions = dropdownReadPlatformService.retrieveLoanAmortizationTypeOptions(); final List<EnumOptionData> amortizationTypeOptions = dropdownReadPlatformService.retrieveLoanAmortizationTypeOptions();
final List<EnumOptionData> interestTypeOptions = dropdownReadPlatformService.retrieveLoanInterestTypeOptions(); final List<EnumOptionData> interestTypeOptions = dropdownReadPlatformService.retrieveLoanInterestTypeOptions();
final List<EnumOptionData> interestCalculationPeriodTypeOptions = dropdownReadPlatformService final List<EnumOptionData> interestCalculationPeriodTypeOptions = dropdownReadPlatformService
@@ -55,7 +55,7 @@ public class LoanProductData {
private final DateTime createdOn; private final DateTime createdOn;
private final DateTime lastModifedOn; private final DateTime lastModifedOn;
private final List<CurrencyData> currencyOptions; private final Collection<CurrencyData> currencyOptions;
private final Collection<FundData> fundOptions; private final Collection<FundData> fundOptions;
private final Collection<TransactionProcessingStrategyData> transactionProcessingStrategyOptions; private final Collection<TransactionProcessingStrategyData> transactionProcessingStrategyOptions;
private final List<EnumOptionData> amortizationTypeOptions; private final List<EnumOptionData> amortizationTypeOptions;
@@ -70,8 +70,8 @@ public class LoanProductData {
private final List<GLAccountData> assetAccountOptions; private final List<GLAccountData> assetAccountOptions;
private final List<GLAccountData> incomeAccountOptions; private final List<GLAccountData> incomeAccountOptions;
private final List<GLAccountData> expenseAccountOptions; private final List<GLAccountData> expenseAccountOptions;
//accounting related mapping feilds // accounting related mapping feilds
private Long loanPortfolioAccountId; private Long loanPortfolioAccountId;
private Long fundSourceAccountId; private Long fundSourceAccountId;
private Long interestOnLoanAccountId; private Long interestOnLoanAccountId;
@@ -196,14 +196,14 @@ public class LoanProductData {
this.loanTermFrequencyTypeOptions = null; this.loanTermFrequencyTypeOptions = null;
this.repaymentFrequencyTypeOptions = null; this.repaymentFrequencyTypeOptions = null;
this.interestRateFrequencyTypeOptions = null; this.interestRateFrequencyTypeOptions = null;
this.assetAccountOptions = null; this.assetAccountOptions = null;
this.incomeAccountOptions = null; this.incomeAccountOptions = null;
this.expenseAccountOptions = null; this.expenseAccountOptions = null;
} }
public LoanProductData(final LoanProductData productData, final Collection<ChargeData> chargeOptions, public LoanProductData(final LoanProductData productData, final Collection<ChargeData> chargeOptions,
final List<CurrencyData> currencyOptions, final List<EnumOptionData> amortizationTypeOptions, final Collection<CurrencyData> currencyOptions, final List<EnumOptionData> amortizationTypeOptions,
final List<EnumOptionData> interestTypeOptions, final List<EnumOptionData> interestCalculationPeriodTypeOptions, final List<EnumOptionData> interestTypeOptions, final List<EnumOptionData> interestCalculationPeriodTypeOptions,
final List<EnumOptionData> loanTermFrequencyTypeOptions, final List<EnumOptionData> repaymentFrequencyTypeOptions, final List<EnumOptionData> loanTermFrequencyTypeOptions, final List<EnumOptionData> repaymentFrequencyTypeOptions,
final List<EnumOptionData> interestRateFrequencyTypeOptions, final Collection<FundData> fundOptions, final List<EnumOptionData> interestRateFrequencyTypeOptions, final Collection<FundData> fundOptions,
@@ -238,7 +238,7 @@ public class LoanProductData {
this.chargeOptions = chargeOptions; this.chargeOptions = chargeOptions;
this.currencyOptions = currencyOptions; this.currencyOptions = currencyOptions;
if (this.currencyOptions.size() == 1) { if (this.currencyOptions.size() == 1) {
this.currency = this.currencyOptions.get(0); this.currency = new ArrayList<CurrencyData>(this.currencyOptions).get(0);
} else { } else {
this.currency = productData.currency; this.currency = productData.currency;
} }
@@ -250,7 +250,7 @@ public class LoanProductData {
this.loanTermFrequencyTypeOptions = loanTermFrequencyTypeOptions; this.loanTermFrequencyTypeOptions = loanTermFrequencyTypeOptions;
this.repaymentFrequencyTypeOptions = repaymentFrequencyTypeOptions; this.repaymentFrequencyTypeOptions = repaymentFrequencyTypeOptions;
this.interestRateFrequencyTypeOptions = interestRateFrequencyTypeOptions; this.interestRateFrequencyTypeOptions = interestRateFrequencyTypeOptions;
this.assetAccountOptions = assetAccountOptions; this.assetAccountOptions = assetAccountOptions;
this.incomeAccountOptions = incomeAccountOptions; this.incomeAccountOptions = incomeAccountOptions;
this.expenseAccountOptions = expenseAccountOptions; this.expenseAccountOptions = expenseAccountOptions;
@@ -356,10 +356,6 @@ public class LoanProductData {
return lastModifedOn; return lastModifedOn;
} }
public List<CurrencyData> getCurrencyOptions() {
return currencyOptions;
}
public Collection<FundData> getFundOptions() { public Collection<FundData> getFundOptions() {
return fundOptions; return fundOptions;
} }
@@ -408,22 +404,18 @@ public class LoanProductData {
return this.expenseAccountOptions; return this.expenseAccountOptions;
} }
public Long getLoanPortfolioAccountId() { public Long getLoanPortfolioAccountId() {
return this.loanPortfolioAccountId; return this.loanPortfolioAccountId;
} }
public void setLoanPortfolioAccountId(Long loanPortfolioAccountId) { public void setLoanPortfolioAccountId(Long loanPortfolioAccountId) {
this.loanPortfolioAccountId = loanPortfolioAccountId; this.loanPortfolioAccountId = loanPortfolioAccountId;
} }
public Long getFundSourceAccountId() { public Long getFundSourceAccountId() {
return this.fundSourceAccountId; return this.fundSourceAccountId;
} }
public void setFundSourceAccountId(Long fundSourceAccountId) { public void setFundSourceAccountId(Long fundSourceAccountId) {
this.fundSourceAccountId = fundSourceAccountId; this.fundSourceAccountId = fundSourceAccountId;
} }
@@ -432,27 +424,22 @@ public class LoanProductData {
return this.interestOnLoanAccountId; return this.interestOnLoanAccountId;
} }
public void setInterestOnLoanAccountId(Long interestOnLoanAccountId) { public void setInterestOnLoanAccountId(Long interestOnLoanAccountId) {
this.interestOnLoanAccountId = interestOnLoanAccountId; this.interestOnLoanAccountId = interestOnLoanAccountId;
} }
public Long getIncomeFromFeeAccountId() { public Long getIncomeFromFeeAccountId() {
return this.incomeFromFeeAccountId; return this.incomeFromFeeAccountId;
} }
public void setIncomeFromFeeAccountId(Long incomeFromFeeAccountId) { public void setIncomeFromFeeAccountId(Long incomeFromFeeAccountId) {
this.incomeFromFeeAccountId = incomeFromFeeAccountId; this.incomeFromFeeAccountId = incomeFromFeeAccountId;
} }
public Long getIncomeFromPenaltyAccountId() { public Long getIncomeFromPenaltyAccountId() {
return this.incomeFromPenaltyAccountId; return this.incomeFromPenaltyAccountId;
} }
public void setIncomeFromPenaltyAccountId(Long incomeFromPenaltyAccountId) { public void setIncomeFromPenaltyAccountId(Long incomeFromPenaltyAccountId) {
this.incomeFromPenaltyAccountId = incomeFromPenaltyAccountId; this.incomeFromPenaltyAccountId = incomeFromPenaltyAccountId;
} }
@@ -461,45 +448,36 @@ public class LoanProductData {
return this.writeOffAccountId; return this.writeOffAccountId;
} }
public void setWriteOffAccountId(Long writeOffAccountId) { public void setWriteOffAccountId(Long writeOffAccountId) {
this.writeOffAccountId = writeOffAccountId; this.writeOffAccountId = writeOffAccountId;
} }
public Long getReceivableInterestAccountId() { public Long getReceivableInterestAccountId() {
return this.receivableInterestAccountId; return this.receivableInterestAccountId;
} }
public void setReceivableInterestAccountId(Long receivableInterestAccountId) { public void setReceivableInterestAccountId(Long receivableInterestAccountId) {
this.receivableInterestAccountId = receivableInterestAccountId; this.receivableInterestAccountId = receivableInterestAccountId;
} }
public Long getReceivableFeeAccountId() { public Long getReceivableFeeAccountId() {
return this.receivableFeeAccountId; return this.receivableFeeAccountId;
} }
public void setReceivableFeeAccountId(Long receivableFeeAccountId) { public void setReceivableFeeAccountId(Long receivableFeeAccountId) {
this.receivableFeeAccountId = receivableFeeAccountId; this.receivableFeeAccountId = receivableFeeAccountId;
} }
public Long getReceivablePenaltyAccountId() { public Long getReceivablePenaltyAccountId() {
return this.receivablePenaltyAccountId; return this.receivablePenaltyAccountId;
} }
public void setReceivablePenaltyAccountId(Long receivablePenaltyAccountId) { public void setReceivablePenaltyAccountId(Long receivablePenaltyAccountId) {
this.receivablePenaltyAccountId = receivablePenaltyAccountId; this.receivablePenaltyAccountId = receivablePenaltyAccountId;
} }
public Integer getAccountingType() { public Integer getAccountingType() {
return this.accountingType; return this.accountingType;
} }
} }
@@ -239,7 +239,7 @@ public class SavingsAccountApiResource {
"dueAmount")); "dueAmount"));
Collection<SavingProductLookup> productOptions = savingProductReadPlatformService.retrieveAllSavingProductsForLookup(); Collection<SavingProductLookup> productOptions = savingProductReadPlatformService.retrieveAllSavingProductsForLookup();
List<CurrencyData> currencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies(); Collection<CurrencyData> currencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies();
EnumOptionData recurring = SavingProductEnumerations.savingProductType(SavingProductType.RECURRING); EnumOptionData recurring = SavingProductEnumerations.savingProductType(SavingProductType.RECURRING);
EnumOptionData regular = SavingProductEnumerations.savingProductType(SavingProductType.REGULAR); EnumOptionData regular = SavingProductEnumerations.savingProductType(SavingProductType.REGULAR);
@@ -51,7 +51,7 @@ public class SavingAccountData {
private final Integer depositEvery; private final Integer depositEvery;
private final List<SavingProductLookup> productOptions; private final List<SavingProductLookup> productOptions;
private final List<CurrencyData> currencyOptions; private final Collection<CurrencyData> currencyOptions;
private final List<EnumOptionData> savingsProductTypeOptions; private final List<EnumOptionData> savingsProductTypeOptions;
private final List<EnumOptionData> tenureTypeOptions; private final List<EnumOptionData> tenureTypeOptions;
private final List<EnumOptionData> savingFrequencyOptions; private final List<EnumOptionData> savingFrequencyOptions;
@@ -188,10 +188,11 @@ public class SavingAccountData {
this.interestPostFrequency = null; this.interestPostFrequency = null;
} }
public SavingAccountData(SavingAccountData account, Collection<SavingProductLookup> productOptions, List<CurrencyData> currencyOptions, public SavingAccountData(SavingAccountData account, Collection<SavingProductLookup> productOptions,
List<EnumOptionData> savingsProductTypeOptions, List<EnumOptionData> tenureTypeOptions, Collection<CurrencyData> currencyOptions, List<EnumOptionData> savingsProductTypeOptions,
List<EnumOptionData> savingFrequencyOptions, List<EnumOptionData> savingsInterestTypeOptions, List<EnumOptionData> tenureTypeOptions, List<EnumOptionData> savingFrequencyOptions,
List<EnumOptionData> lockinPeriodTypeOptions, List<EnumOptionData> interestCalculationOptions, BigDecimal dueAmount) { List<EnumOptionData> savingsInterestTypeOptions, List<EnumOptionData> lockinPeriodTypeOptions,
List<EnumOptionData> interestCalculationOptions, BigDecimal dueAmount) {
this.id = account.id; this.id = account.id;
this.status = account.status; this.status = account.status;
this.externalId = account.externalId; this.externalId = account.externalId;
@@ -100,7 +100,7 @@ public class SavingProductsApiResource {
"description", "currencyCode", "digitsAfterDecimal", "interstRate", "minInterestRate", "maxInterestRate", "description", "currencyCode", "digitsAfterDecimal", "interstRate", "minInterestRate", "maxInterestRate",
"savingsDepositAmount", "savingProductType", "tenureType", "tenure", "frequency", "interestType", "savingsDepositAmount", "savingProductType", "tenureType", "tenure", "frequency", "interestType",
"interestCalculationMethod", "minimumBalanceForWithdrawal", "isPartialDepositAllowed", "isLockinPeriodAllowed", "interestCalculationMethod", "minimumBalanceForWithdrawal", "isPartialDepositAllowed", "isLockinPeriodAllowed",
"lockinPeriod", "lockinPeriodType","depositEvery")); "lockinPeriod", "lockinPeriodType", "depositEvery"));
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) { if (responseParameters.isEmpty()) {
@@ -125,15 +125,15 @@ public class SavingProductsApiResource {
"description", "currencyCode", "digitsAfterDecimal", "interstRate", "minInterestRate", "maxInterestRate", "description", "currencyCode", "digitsAfterDecimal", "interstRate", "minInterestRate", "maxInterestRate",
"savingsDepositAmount", "savingProductType", "tenureType", "tenure", "frequency", "interestType", "savingsDepositAmount", "savingProductType", "tenureType", "tenure", "frequency", "interestType",
"interestCalculationMethod", "minimumBalanceForWithdrawal", "isPartialDepositAllowed", "isLockinPeriodAllowed", "interestCalculationMethod", "minimumBalanceForWithdrawal", "isPartialDepositAllowed", "isLockinPeriodAllowed",
"lockinPeriod", "lockinPeriodType","depositEvery")); "lockinPeriod", "lockinPeriodType", "depositEvery"));
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) { if (responseParameters.isEmpty()) {
responseParameters.addAll(typicalResponseParameters); responseParameters.addAll(typicalResponseParameters);
} }
SavingProductData savingProduct = this.savingProductReadPlatformService.retrieveSavingProduct(productId); SavingProductData savingProduct = this.savingProductReadPlatformService.retrieveSavingProduct(productId);
boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters()); boolean prettyPrint = ApiParameterHelper.prettyPrint(uriInfo.getQueryParameters());
boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters()); boolean template = ApiParameterHelper.template(uriInfo.getQueryParameters());
if (template) { if (template) {
@@ -154,7 +154,7 @@ public class SavingProductsApiResource {
Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("id", "createdOn", "lastModifedOn", "locale", "name", Set<String> typicalResponseParameters = new HashSet<String>(Arrays.asList("id", "createdOn", "lastModifedOn", "locale", "name",
"description", "currencyCode", "digitsAfterDecimal", "interstRate", "savingsDepositAmount", "savingProductType", "description", "currencyCode", "digitsAfterDecimal", "interstRate", "savingsDepositAmount", "savingProductType",
"tenureType", "tenure", "frequency", "interestType", "interestCalculationMethod", "minimumBalanceForWithdrawal", "tenureType", "tenure", "frequency", "interestType", "interestCalculationMethod", "minimumBalanceForWithdrawal",
"isPartialDepositAllowed", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType", "currencyOptions","depositEvery")); "isPartialDepositAllowed", "isLockinPeriodAllowed", "lockinPeriod", "lockinPeriodType", "currencyOptions", "depositEvery"));
Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters()); Set<String> responseParameters = ApiParameterHelper.extractFieldsForResponseIfProvided(uriInfo.getQueryParameters());
if (responseParameters.isEmpty()) { if (responseParameters.isEmpty()) {
@@ -171,7 +171,7 @@ public class SavingProductsApiResource {
responseParameters.addAll(Arrays.asList("currencyOptions", "savingsProductTypeOptions", "tenureTypeOptions", responseParameters.addAll(Arrays.asList("currencyOptions", "savingsProductTypeOptions", "tenureTypeOptions",
"savingFrequencyOptions", "savingsInterestTypeOptions", "lockinPeriodTypeOptions", "interestCalculationOptions")); "savingFrequencyOptions", "savingsInterestTypeOptions", "lockinPeriodTypeOptions", "interestCalculationOptions"));
List<CurrencyData> currencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies(); Collection<CurrencyData> currencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies();
EnumOptionData reccuring = SavingProductEnumerations.savingProductType(SavingProductType.RECURRING); EnumOptionData reccuring = SavingProductEnumerations.savingProductType(SavingProductType.RECURRING);
EnumOptionData regular = SavingProductEnumerations.savingProductType(SavingProductType.REGULAR); EnumOptionData regular = SavingProductEnumerations.savingProductType(SavingProductType.REGULAR);
@@ -3,6 +3,7 @@ package org.mifosplatform.portfolio.savingsaccountproduct.data;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.List; import java.util.List;
import org.joda.time.DateTime; import org.joda.time.DateTime;
@@ -44,16 +45,17 @@ public class SavingProductData implements Serializable {
private DateTime lastModifedOn; private DateTime lastModifedOn;
private final Integer depositEvery; private final Integer depositEvery;
private List<CurrencyData> currencyOptions = new ArrayList<CurrencyData>(); @SuppressWarnings("unused")
List<EnumOptionData> savingsProductTypeOptions = new ArrayList<EnumOptionData>(); private Collection<CurrencyData> currencyOptions = new ArrayList<CurrencyData>();
List<EnumOptionData> tenureTypeOptions = new ArrayList<EnumOptionData>(); private List<EnumOptionData> savingsProductTypeOptions = new ArrayList<EnumOptionData>();
List<EnumOptionData> savingFrequencyOptions = new ArrayList<EnumOptionData>(); private List<EnumOptionData> tenureTypeOptions = new ArrayList<EnumOptionData>();
List<EnumOptionData> savingsInterestTypeOptions = new ArrayList<EnumOptionData>(); private List<EnumOptionData> savingFrequencyOptions = new ArrayList<EnumOptionData>();
List<EnumOptionData> lockinPeriodTypeOptions = new ArrayList<EnumOptionData>(); private List<EnumOptionData> savingsInterestTypeOptions = new ArrayList<EnumOptionData>();
List<EnumOptionData> interestCalculationOptions = new ArrayList<EnumOptionData>(); private List<EnumOptionData> lockinPeriodTypeOptions = new ArrayList<EnumOptionData>();
private List<EnumOptionData> interestCalculationOptions = new ArrayList<EnumOptionData>();
public SavingProductData() { public SavingProductData() {
this.createdOn = new DateTime(); this.createdOn = new DateTime();
this.lastModifedOn = new DateTime(); this.lastModifedOn = new DateTime();
this.id = null; this.id = null;
this.name = null; this.name = null;
@@ -69,13 +71,14 @@ public class SavingProductData implements Serializable {
this.tenure = Integer.valueOf(12); this.tenure = Integer.valueOf(12);
this.savingFrequencyType = SavingProductEnumerations.interestFrequencyType(SavingFrequencyType.MONTHLY); this.savingFrequencyType = SavingProductEnumerations.interestFrequencyType(SavingFrequencyType.MONTHLY);
this.interestType = SavingProductEnumerations.savingInterestType(SavingsInterestType.COMPOUNDING); this.interestType = SavingProductEnumerations.savingInterestType(SavingsInterestType.COMPOUNDING);
this.interestCalculationMethod = SavingProductEnumerations.savingInterestCalculationMethod(SavingInterestCalculationMethod.AVERAGEBAL); this.interestCalculationMethod = SavingProductEnumerations
.savingInterestCalculationMethod(SavingInterestCalculationMethod.AVERAGEBAL);
this.minimumBalanceForWithdrawal = BigDecimal.valueOf(100); this.minimumBalanceForWithdrawal = BigDecimal.valueOf(100);
this.isPartialDepositAllowed = false; this.isPartialDepositAllowed = false;
this.isLockinPeriodAllowed = false; this.isLockinPeriodAllowed = false;
this.lockinPeriod = Integer.valueOf(0); this.lockinPeriod = Integer.valueOf(0);
this.lockinPeriodType = SavingProductEnumerations.savingsLockinPeriod(SavingsLockinPeriodEnum.MONTHS); this.lockinPeriodType = SavingProductEnumerations.savingsLockinPeriod(SavingsLockinPeriodEnum.MONTHS);
this.depositEvery=Integer.valueOf(3); this.depositEvery = Integer.valueOf(3);
} }
public SavingProductData(DateTime createdOn, DateTime lastModifedOn, Long id, String name, String description, BigDecimal interestRate, public SavingProductData(DateTime createdOn, DateTime lastModifedOn, Long id, String name, String description, BigDecimal interestRate,
@@ -109,10 +112,10 @@ public class SavingProductData implements Serializable {
this.depositEvery = depositEvery; this.depositEvery = depositEvery;
} }
public SavingProductData(SavingProductData product, List<CurrencyData> currencyOptions, List<EnumOptionData> savingsProductTypeOptions, public SavingProductData(SavingProductData product, Collection<CurrencyData> currencyOptions,
List<EnumOptionData> tenureTypeOptions, List<EnumOptionData> savingFrequencyOptions, List<EnumOptionData> savingsProductTypeOptions, List<EnumOptionData> tenureTypeOptions,
List<EnumOptionData> savingsInterestTypeOptions, List<EnumOptionData> lockinPeriodTypeOptions, List<EnumOptionData> savingFrequencyOptions, List<EnumOptionData> savingsInterestTypeOptions,
List<EnumOptionData> interestCalculationOptions) { List<EnumOptionData> lockinPeriodTypeOptions, List<EnumOptionData> interestCalculationOptions) {
this.createdOn = product.getCreatedOn(); this.createdOn = product.getCreatedOn();
this.lastModifedOn = product.getLastModifedOn(); this.lastModifedOn = product.getLastModifedOn();
@@ -232,11 +235,7 @@ public class SavingProductData implements Serializable {
return lastModifedOn; return lastModifedOn;
} }
public List<CurrencyData> getCurrencyOptions() { public void setCurrencyOptions(Collection<CurrencyData> currencyOptions) {
return currencyOptions;
}
public void setCurrencyOptions(List<CurrencyData> currencyOptions) {
this.currencyOptions = currencyOptions; this.currencyOptions = currencyOptions;
} }
@@ -268,8 +267,8 @@ public class SavingProductData implements Serializable {
return interestCalculationOptions; return interestCalculationOptions;
} }
public Integer getDepositEvery() { public Integer getDepositEvery() {
return this.depositEvery; return this.depositEvery;
} }
} }
@@ -4,7 +4,6 @@ import java.math.BigDecimal;
import java.sql.ResultSet; import java.sql.ResultSet;
import java.sql.SQLException; import java.sql.SQLException;
import java.util.Collection; import java.util.Collection;
import java.util.List;
import org.joda.time.DateTime; import org.joda.time.DateTime;
import org.mifosplatform.infrastructure.core.data.EnumOptionData; import org.mifosplatform.infrastructure.core.data.EnumOptionData;
@@ -60,7 +59,7 @@ public class SavingProductReadPlatformServiceImpl implements SavingProductReadPl
SavingProductLookupMapper savingProductLookupMapper = new SavingProductLookupMapper(); SavingProductLookupMapper savingProductLookupMapper = new SavingProductLookupMapper();
String sql = "select " + savingProductLookupMapper.savingProductLookupSchema() + " where sp.is_deleted=0"; String sql = "select " + savingProductLookupMapper.savingProductLookupSchema() + " where sp.is_deleted=0";
return this.jdbcTemplate.query(sql, savingProductLookupMapper, new Object[] {}); return this.jdbcTemplate.query(sql, savingProductLookupMapper, new Object[] {});
} }
@@ -146,7 +145,7 @@ public class SavingProductReadPlatformServiceImpl implements SavingProductReadPl
return new SavingProductData(createdOn, lastModifedOn, id, name, description, interestRate, minInterestRate, maxInterestRate, return new SavingProductData(createdOn, lastModifedOn, id, name, description, interestRate, minInterestRate, maxInterestRate,
currencyData, currencyDigits, savingsDepositAmount, savingProductTypeEnum, tenureTypeEnum, tenure, savingFrequencyType, currencyData, currencyDigits, savingsDepositAmount, savingProductTypeEnum, tenureTypeEnum, tenure, savingFrequencyType,
savingInterestType, interestCalculationMethodEnum, minimumBalanceForWithdrawal, isPartialDepositAllowed, savingInterestType, interestCalculationMethodEnum, minimumBalanceForWithdrawal, isPartialDepositAllowed,
isLockinPeriodAllowed, lockinPeriod, lockinPeriodType,depositEvery); isLockinPeriodAllowed, lockinPeriod, lockinPeriodType, depositEvery);
} }
} }
@@ -169,7 +168,7 @@ public class SavingProductReadPlatformServiceImpl implements SavingProductReadPl
private void populateProductDataWithDropdownOptions(final SavingProductData productData) { private void populateProductDataWithDropdownOptions(final SavingProductData productData) {
List<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies(); Collection<CurrencyData> currencyOptions = currencyReadPlatformService.retrieveAllowedCurrencies();
productData.setCurrencyOptions(currencyOptions); productData.setCurrencyOptions(currencyOptions);
} }
@@ -180,7 +180,7 @@ public class DepositProductsApiResource {
private DepositProductData handleTemplateRelatedData(final Set<String> responseParameters, final DepositProductData productData) { private DepositProductData handleTemplateRelatedData(final Set<String> responseParameters, final DepositProductData productData) {
responseParameters.addAll(Arrays.asList("currencyOptions", "interestCompoundedEveryPeriodTypeOptions")); responseParameters.addAll(Arrays.asList("currencyOptions", "interestCompoundedEveryPeriodTypeOptions"));
List<CurrencyData> allowedCurrencies = this.currencyReadPlatformService.retrieveAllowedCurrencies(); Collection<CurrencyData> allowedCurrencies = this.currencyReadPlatformService.retrieveAllowedCurrencies();
EnumOptionData monthly = SavingsDepositEnumerations.interestCompoundingPeriodType(PeriodFrequencyType.MONTHS); EnumOptionData monthly = SavingsDepositEnumerations.interestCompoundingPeriodType(PeriodFrequencyType.MONTHS);
List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions = Arrays.asList(monthly); List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions = Arrays.asList(monthly);
@@ -2,6 +2,7 @@ package org.mifosplatform.portfolio.savingsdepositproduct.data;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection;
import java.util.List; import java.util.List;
import org.joda.time.DateTime; import org.joda.time.DateTime;
@@ -40,7 +41,7 @@ public class DepositProductData {
private final DateTime createdOn; private final DateTime createdOn;
private final DateTime lastModifedOn; private final DateTime lastModifedOn;
private final List<CurrencyData> currencyOptions; private final Collection<CurrencyData> currencyOptions;
private final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions; private final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions;
public DepositProductData(final DateTime createdOn, final DateTime lastModifedOn, final Long id, final String externalId, public DepositProductData(final DateTime createdOn, final DateTime lastModifedOn, final Long id, final String externalId,
@@ -82,7 +83,8 @@ public class DepositProductData {
this.interestCompoundedEveryPeriodTypeOptions = new ArrayList<EnumOptionData>(); this.interestCompoundedEveryPeriodTypeOptions = new ArrayList<EnumOptionData>();
} }
public DepositProductData(final List<CurrencyData> currencyOptions, final EnumOptionData defaultInterestCompoundedEveryPeriodType, public DepositProductData(final Collection<CurrencyData> currencyOptions,
final EnumOptionData defaultInterestCompoundedEveryPeriodType,
final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions) { final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions) {
this.createdOn = null; this.createdOn = null;
this.lastModifedOn = null; this.lastModifedOn = null;
@@ -115,7 +117,7 @@ public class DepositProductData {
this.interestCompoundedEveryPeriodTypeOptions = interestCompoundedEveryPeriodTypeOptions; this.interestCompoundedEveryPeriodTypeOptions = interestCompoundedEveryPeriodTypeOptions;
} }
public DepositProductData(final DepositProductData product, final List<CurrencyData> currencyOptions, public DepositProductData(final DepositProductData product, final Collection<CurrencyData> currencyOptions,
final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions) { final List<EnumOptionData> interestCompoundedEveryPeriodTypeOptions) {
this.createdOn = product.getCreatedOn(); this.createdOn = product.getCreatedOn();
this.lastModifedOn = product.getLastModifedOn(); this.lastModifedOn = product.getLastModifedOn();
@@ -224,7 +226,7 @@ public class DepositProductData {
return lastModifedOn; return lastModifedOn;
} }
public List<CurrencyData> getCurrencyOptions() { public Collection<CurrencyData> getCurrencyOptions() {
return currencyOptions; return currencyOptions;
} }