diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java index e604c6ded..847a627e1 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/ClientLoanIntegrationTest.java @@ -963,22 +963,22 @@ public class ClientLoanIntegrationTest { private void verifyLoanRepaymentSchedule(final ArrayList loanSchedule) { System.out.println("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------"); - assertEquals("Checking for Due Date for 1st Month", new ArrayList(Arrays.asList(2011, 10, 20)), + assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 20)), loanSchedule.get(1).get("dueDate")); assertEquals("Checking for Principal Due for 1st Month", new Float("2911.49"), loanSchedule.get(1).get("principalOriginalDue")); assertEquals("Checking for Interest Due for 1st Month", new Float("240.00"), loanSchedule.get(1).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 2nd Month", new ArrayList(Arrays.asList(2011, 11, 20)), + assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2011, 11, 20)), loanSchedule.get(2).get("dueDate")); assertEquals("Checking for Principal Due for 2nd Month", new Float("2969.71"), loanSchedule.get(2).get("principalDue")); assertEquals("Checking for Interest Due for 2nd Month", new Float("181.77"), loanSchedule.get(2).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 3rd Month", new ArrayList(Arrays.asList(2011, 12, 20)), + assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2011, 12, 20)), loanSchedule.get(3).get("dueDate")); assertEquals("Checking for Principal Due for 3rd Month", new Float("3029.1"), loanSchedule.get(3).get("principalDue")); assertEquals("Checking for Interest Due for 3rd Month", new Float("122.38"), loanSchedule.get(3).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 4th Month", new ArrayList(Arrays.asList(2012, 1, 20)), + assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2012, 1, 20)), loanSchedule.get(4).get("dueDate")); assertEquals("Checking for Principal Due for 4th Month", new Float("3089.7"), loanSchedule.get(4).get("principalDue")); assertEquals("Checking for Interest Due for 4th Month", new Float("61.79"), loanSchedule.get(4).get("interestOriginalDue")); @@ -987,47 +987,47 @@ public class ClientLoanIntegrationTest { private void verifyLoanRepaymentScheduleForEqualPrincipal(final ArrayList loanSchedule) { System.out.println("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------"); - assertEquals("Checking for Due Date for 1st Month", new ArrayList(Arrays.asList(2014, 7, 2)), + assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2014, 7, 2)), loanSchedule.get(1).get("dueDate")); assertEquals("Checking for Principal Due for 1st Month", new Float("416700"), loanSchedule.get(1).get("principalOriginalDue")); assertEquals("Checking for Interest Due for 1st Month", new Float("200000"), loanSchedule.get(1).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 2nd Month", new ArrayList(Arrays.asList(2014, 8, 2)), + assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2014, 8, 2)), loanSchedule.get(2).get("dueDate")); assertEquals("Checking for Principal Due for 2nd Month", new Float("416700"), loanSchedule.get(2).get("principalDue")); assertEquals("Checking for Interest Due for 2nd Month", new Float("191700"), loanSchedule.get(2).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 3rd Month", new ArrayList(Arrays.asList(2014, 9, 2)), + assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2014, 9, 2)), loanSchedule.get(3).get("dueDate")); assertEquals("Checking for Principal Due for 3rd Month", new Float("416700"), loanSchedule.get(3).get("principalDue")); assertEquals("Checking for Interest Due for 3rd Month", new Float("183300"), loanSchedule.get(3).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 4th Month", new ArrayList(Arrays.asList(2014, 10, 2)), + assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2014, 10, 2)), loanSchedule.get(4).get("dueDate")); assertEquals("Checking for Principal Due for 4th Month", new Float("416700"), loanSchedule.get(4).get("principalDue")); assertEquals("Checking for Interest Due for 4th Month", new Float("175000"), loanSchedule.get(4).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 5th Month", new ArrayList(Arrays.asList(2014, 11, 2)), + assertEquals("Checking for Due Date for 5th Month", new ArrayList<>(Arrays.asList(2014, 11, 2)), loanSchedule.get(5).get("dueDate")); assertEquals("Checking for Principal Due for 5th Month", new Float("416700"), loanSchedule.get(5).get("principalDue")); assertEquals("Checking for Interest Due for 5th Month", new Float("166700"), loanSchedule.get(5).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 6th Month", new ArrayList(Arrays.asList(2014, 12, 2)), + assertEquals("Checking for Due Date for 6th Month", new ArrayList<>(Arrays.asList(2014, 12, 2)), loanSchedule.get(6).get("dueDate")); assertEquals("Checking for Principal Due for 6th Month", new Float("416700"), loanSchedule.get(6).get("principalDue")); assertEquals("Checking for Interest Due for 6th Month", new Float("158300"), loanSchedule.get(6).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 10th Month", new ArrayList(Arrays.asList(2015, 4, 2)), + assertEquals("Checking for Due Date for 10th Month", new ArrayList<>(Arrays.asList(2015, 4, 2)), loanSchedule.get(10).get("dueDate")); assertEquals("Checking for Principal Due for 10th Month", new Float("416700"), loanSchedule.get(10).get("principalDue")); assertEquals("Checking for Interest Due for 10th Month", new Float("125000"), loanSchedule.get(10).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 20th Month", new ArrayList(Arrays.asList(2016, 2, 2)), + assertEquals("Checking for Due Date for 20th Month", new ArrayList<>(Arrays.asList(2016, 2, 2)), loanSchedule.get(20).get("dueDate")); assertEquals("Checking for Principal Due for 20th Month", new Float("416700"), loanSchedule.get(20).get("principalDue")); assertEquals("Checking for Interest Due for 20th Month", new Float("41700"), loanSchedule.get(20).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 24th Month", new ArrayList(Arrays.asList(2016, 6, 2)), + assertEquals("Checking for Due Date for 24th Month", new ArrayList<>(Arrays.asList(2016, 6, 2)), loanSchedule.get(24).get("dueDate")); assertEquals("Checking for Principal Due for 24th Month", new Float("415900"), loanSchedule.get(24).get("principalDue")); assertEquals("Checking for Interest Due for 24th Month", new Float("8300"), loanSchedule.get(24).get("interestOriginalDue")); @@ -1037,54 +1037,54 @@ public class ClientLoanIntegrationTest { private void verifyLoanRepaymentScheduleForEqualPrincipalWithGrace(final ArrayList loanSchedule) { System.out.println("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------"); - assertEquals("Checking for Due Date for 1st Month", new ArrayList(Arrays.asList(2014, 7, 2)), + assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2014, 7, 2)), loanSchedule.get(1).get("dueDate")); validateNumberForEqualWithMsg("Checking for Principal Due for 1st Month", "0.0", String.valueOf(loanSchedule.get(1).get("principalOriginalDue"))); assertEquals("Checking for Interest Due for 1st Month", new Float("200000"), loanSchedule.get(1).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 2nd Month", new ArrayList(Arrays.asList(2014, 8, 2)), + assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2014, 8, 2)), loanSchedule.get(2).get("dueDate")); validateNumberForEqualWithMsg("Checking for Principal Due for 2nd Month", "0.0", String.valueOf(loanSchedule.get(2).get("principalOriginalDue"))); assertEquals("Checking for Interest Due for 2nd Month", new Float("200000"), loanSchedule.get(2).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 3rd Month", new ArrayList(Arrays.asList(2014, 9, 2)), + assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2014, 9, 2)), loanSchedule.get(3).get("dueDate")); validateNumberForEqualWithMsg("Checking for Principal Due for 3rd Month", "0.0", String.valueOf(loanSchedule.get(3).get("principalDue"))); assertEquals("Checking for Interest Due for 3rd Month", new Float("200000"), loanSchedule.get(3).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 4th Month", new ArrayList(Arrays.asList(2014, 10, 2)), + assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2014, 10, 2)), loanSchedule.get(4).get("dueDate")); validateNumberForEqualWithMsg("Checking for Principal Due for 4th Month", "0", String.valueOf(loanSchedule.get(4).get("principalDue"))); assertEquals("Checking for Interest Due for 4th Month", new Float("200000"), loanSchedule.get(4).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 5th Month", new ArrayList(Arrays.asList(2014, 11, 2)), + assertEquals("Checking for Due Date for 5th Month", new ArrayList<>(Arrays.asList(2014, 11, 2)), loanSchedule.get(5).get("dueDate")); validateNumberForEqualWithMsg("Checking for Principal Due for 5th Month", "0", String.valueOf(loanSchedule.get(5).get("principalDue"))); assertEquals("Checking for Interest Due for 5th Month", new Float("200000"), loanSchedule.get(5).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 6th Month", new ArrayList(Arrays.asList(2014, 12, 2)), + assertEquals("Checking for Due Date for 6th Month", new ArrayList<>(Arrays.asList(2014, 12, 2)), loanSchedule.get(6).get("dueDate")); assertEquals("Checking for Principal Due for 6th Month", new Float("526300"), loanSchedule.get(6).get("principalDue")); assertEquals("Checking for Interest Due for 6th Month", new Float("200000"), loanSchedule.get(6).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 7th Month", new ArrayList(Arrays.asList(2015, 1, 2)), + assertEquals("Checking for Due Date for 7th Month", new ArrayList<>(Arrays.asList(2015, 1, 2)), loanSchedule.get(7).get("dueDate")); assertEquals("Checking for Principal Due for 7th Month", new Float("526300"), loanSchedule.get(7).get("principalDue")); assertEquals("Checking for Interest Due for 7th Month", new Float("189500"), loanSchedule.get(7).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 10th Month", new ArrayList(Arrays.asList(2015, 4, 2)), + assertEquals("Checking for Due Date for 10th Month", new ArrayList<>(Arrays.asList(2015, 4, 2)), loanSchedule.get(10).get("dueDate")); assertEquals("Checking for Principal Due for 10th Month", new Float("526300"), loanSchedule.get(10).get("principalDue")); assertEquals("Checking for Interest Due for 10th Month", new Float("157900"), loanSchedule.get(10).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 20th Month", new ArrayList(Arrays.asList(2016, 2, 2)), + assertEquals("Checking for Due Date for 20th Month", new ArrayList<>(Arrays.asList(2016, 2, 2)), loanSchedule.get(20).get("dueDate")); assertEquals("Checking for Principal Due for 20th Month", new Float("526300"), loanSchedule.get(20).get("principalDue")); assertEquals("Checking for Interest Due for 20th Month", new Float("52600"), loanSchedule.get(20).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 24th Month", new ArrayList(Arrays.asList(2016, 6, 2)), + assertEquals("Checking for Due Date for 24th Month", new ArrayList<>(Arrays.asList(2016, 6, 2)), loanSchedule.get(24).get("dueDate")); assertEquals("Checking for Principal Due for 24th Month", new Float("526600"), loanSchedule.get(24).get("principalDue")); assertEquals("Checking for Interest Due for 24th Month", new Float("10500"), loanSchedule.get(24).get("interestOriginalDue")); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/GroupLoanIntegrationTest.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/GroupLoanIntegrationTest.java index 51a67ceb7..cf9e61e66 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/GroupLoanIntegrationTest.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/GroupLoanIntegrationTest.java @@ -93,22 +93,22 @@ public class GroupLoanIntegrationTest { private void verifyLoanRepaymentSchedule(final ArrayList loanSchedule) { System.out.println("--------------------VERIFYING THE PRINCIPAL DUES,INTEREST DUE AND DUE DATE--------------------------"); - assertEquals("Checking for Due Date for 1st Month", new ArrayList(Arrays.asList(2011, 10, 20)), + assertEquals("Checking for Due Date for 1st Month", new ArrayList<>(Arrays.asList(2011, 10, 20)), loanSchedule.get(1).get("dueDate")); assertEquals("Checking for Principal Due for 1st Month", new Float("2911.49"), loanSchedule.get(1).get("principalOriginalDue")); assertEquals("Checking for Interest Due for 1st Month", new Float("240.00"), loanSchedule.get(1).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 2nd Month", new ArrayList(Arrays.asList(2011, 11, 20)), + assertEquals("Checking for Due Date for 2nd Month", new ArrayList<>(Arrays.asList(2011, 11, 20)), loanSchedule.get(2).get("dueDate")); assertEquals("Checking for Principal Due for 2nd Month", new Float("2969.71"), loanSchedule.get(2).get("principalDue")); assertEquals("Checking for Interest Due for 2nd Month", new Float("181.77"), loanSchedule.get(2).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 3rd Month", new ArrayList(Arrays.asList(2011, 12, 20)), + assertEquals("Checking for Due Date for 3rd Month", new ArrayList<>(Arrays.asList(2011, 12, 20)), loanSchedule.get(3).get("dueDate")); assertEquals("Checking for Principal Due for 3rd Month", new Float("3029.1"), loanSchedule.get(3).get("principalDue")); assertEquals("Checking for Interest Due for 3rd Month", new Float("122.38"), loanSchedule.get(3).get("interestOriginalDue")); - assertEquals("Checking for Due Date for 4th Month", new ArrayList(Arrays.asList(2012, 1, 20)), + assertEquals("Checking for Due Date for 4th Month", new ArrayList<>(Arrays.asList(2012, 1, 20)), loanSchedule.get(4).get("dueDate")); assertEquals("Checking for Principal Due for 4th Month", new Float("3089.7"), loanSchedule.get(4).get("principalDue")); assertEquals("Checking for Interest Due for 4th Month", new Float("61.79"), loanSchedule.get(4).get("interestOriginalDue")); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/TemplateIntegrationTest.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/TemplateIntegrationTest.java index f30ae34c6..b5384f62b 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/TemplateIntegrationTest.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/TemplateIntegrationTest.java @@ -38,9 +38,9 @@ public class TemplateIntegrationTest { @Test public void test() { - final HashMap metadata = new HashMap(); + final HashMap metadata = new HashMap<>(); metadata.put("user", "resource_url"); - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("name", "foo"); map.put("text", "Hello {{template}}"); map.put("mappers", metadata); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/ClientHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/ClientHelper.java index 6442c555e..1ca6b4402 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/ClientHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/ClientHelper.java @@ -29,7 +29,7 @@ public class ClientHelper { } public static String getTestClientAsJSON(final String dateOfJoining, final String officeId) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("officeId", officeId); map.put("firstname", Utils.randomNameGenerator("Client_FirstName_", 5)); map.put("lastname", Utils.randomNameGenerator("Client_LastName_", 4)); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/GlobalConfigurationHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/GlobalConfigurationHelper.java index 53d3fdd8c..f8b99c378 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/GlobalConfigurationHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/GlobalConfigurationHelper.java @@ -67,7 +67,7 @@ public class GlobalConfigurationHelper { } public static String updateGlobalConfigUpdateValueAsJSON(final String value) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("value", value); System.out.println("map : " + map); return new Gson().toJson(map); @@ -81,7 +81,7 @@ public class GlobalConfigurationHelper { } public static String updateIsCacheEnabledGlobalConfigUpdateAsJSON(final String cacheType) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("cacheType", cacheType); System.out.println("map : " + map); return new Gson().toJson(map); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/GroupHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/GroupHelper.java index 15dc601bb..262076078 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/GroupHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/GroupHelper.java @@ -72,7 +72,7 @@ public class GroupHelper { } public static String getTestGroupAsJSON(final boolean active, final String activationDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("officeId", "1"); map.put("name", randomNameGenerator("Group_Name_", 5)); map.put("externalId", randomIDGenerator("ID_", 7)); @@ -93,7 +93,7 @@ public class GroupHelper { public static String associateClientAsJSON(final String clientMember) { final HashMap> map = new HashMap>(); - final List list = new ArrayList(); + final List list = new ArrayList<>(); list.add(clientMember); map.put("clientMembers", list); System.out.println("map : " + map); @@ -101,7 +101,7 @@ public class GroupHelper { } public static String activateGroupAsJSON(final String activationDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("dateFormat", "dd MMMM yyyy"); map.put("locale", "en"); if (StringUtils.isNotEmpty(activationDate)) { @@ -115,7 +115,7 @@ public class GroupHelper { } public static String updateGroupAsJSON(final String name) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("name", name); System.out.println("map : " + map); return new Gson().toJson(map); @@ -147,7 +147,7 @@ public class GroupHelper { public static void verifyGroupMembers(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer generatedGroupID, final Integer groupMember) { - List list = new ArrayList(); + List list = new ArrayList<>(); System.out.println("------------------------------CHECK GROUP MEMBERS------------------------------------\n"); final String GROUP_URL = "/mifosng-provider/api/v1/groups/" + generatedGroupID + "?associations=clientMembers&tenantIdentifier=default"; @@ -157,7 +157,7 @@ public class GroupHelper { public static void verifyEmptyGroupMembers(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer generatedGroupID) { - List list = new ArrayList(); + List list = new ArrayList<>(); System.out.println("------------------------------CHECK EMPTY GROUP MEMBER LIST------------------------------------\n"); final String GROUP_URL = "/mifosng-provider/api/v1/groups/" + generatedGroupID + "?associations=clientMembers&tenantIdentifier=default"; @@ -167,7 +167,7 @@ public class GroupHelper { public static void verifyGroupDeleted(final RequestSpecification requestSpec, final ResponseSpecification responseSpec, final Integer generatedGroupID) { - List list = new ArrayList(); + List list = new ArrayList<>(); System.out.println("------------------------------CHECK GROUP DELETED------------------------------------\n"); final String GROUP_URL = "/mifosng-provider/api/v1/groups/?tenantIdentifier=default"; list = Utils.performServerGet(requestSpec, responseSpec, GROUP_URL, "pageItems"); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/HolidayHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/HolidayHelper.java index a8277f28d..e9bea2729 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/HolidayHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/HolidayHelper.java @@ -28,9 +28,9 @@ public class HolidayHelper { } public static String getCreateHolidayDataAsJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); List> offices = new ArrayList>(); - HashMap officeMap = new HashMap(); + HashMap officeMap = new HashMap<>(); officeMap.put("officeId", OFFICE_ID); offices.add(officeMap); @@ -48,7 +48,7 @@ public class HolidayHelper { } public static String getActivateHolidayDataAsJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); String activateHoliday = new Gson().toJson(map); System.out.println(activateHoliday); return activateHoliday; diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/OfficeHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/OfficeHelper.java index b62c78eb3..08b2e7819 100755 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/OfficeHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/OfficeHelper.java @@ -26,7 +26,7 @@ public class OfficeHelper { public static String getAsJSON(final String openingDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("parentId", "1"); map.put("name", Utils.randomNameGenerator("Office_", 4)); map.put("dateFormat", "dd MMMM yyyy"); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/SchedulerJobHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/SchedulerJobHelper.java index f5efb06eb..5e325015c 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/SchedulerJobHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/SchedulerJobHelper.java @@ -60,7 +60,7 @@ public class SchedulerJobHelper { } public static String updateSchedulerJobAsJSON(final String active) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("active", active); System.out.println("map : " + map); return new Gson().toJson(map); @@ -82,7 +82,7 @@ public class SchedulerJobHelper { } public static String runSchedulerJobAsJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); String runSchedulerJob = new Gson().toJson(map); System.out.println(runSchedulerJob); return runSchedulerJob; diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/StandingInstructionsHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/StandingInstructionsHelper.java index dda238f60..abeed868f 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/StandingInstructionsHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/StandingInstructionsHelper.java @@ -48,7 +48,7 @@ public class StandingInstructionsHelper { public String build(final String clientId, final String fromAccountId, final String toAccountId, final String fromAccountType, final String toAccountType, final String validFrom, final String validTo, final String monthDay) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("name", Utils.randomNameGenerator("STANDING_INSTRUCTION_", 5)); map.put("dateFormat", "dd MMMM yyyy"); map.put("monthDayFormat", "dd MMMM"); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/SurveyHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/SurveyHelper.java index 6f9b3474f..140109ffa 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/SurveyHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/SurveyHelper.java @@ -23,7 +23,7 @@ public class SurveyHelper { } public static String getTestPPIAsJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("date", "2014-05-19 00:00:00"); map.put("ppi_household_members_cd_q1_householdmembers","107"); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/accounting/FinancialActivityAccountsMappingBuilder.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/accounting/FinancialActivityAccountsMappingBuilder.java index cb1fdfd22..a49af8102 100755 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/accounting/FinancialActivityAccountsMappingBuilder.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/accounting/FinancialActivityAccountsMappingBuilder.java @@ -7,7 +7,7 @@ import com.google.gson.Gson; public class FinancialActivityAccountsMappingBuilder { public static String build(Integer financialActivityId, Integer glAccountId) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("financialActivityId", financialActivityId); map.put("glAccountId", glAccountId); return new Gson().toJson(map); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/accounting/GLAccountBuilder.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/accounting/GLAccountBuilder.java index 53868fff4..b769effa8 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/accounting/GLAccountBuilder.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/accounting/GLAccountBuilder.java @@ -29,7 +29,7 @@ public class GLAccountBuilder { private static String description = "DEFAULT_DESCRIPTION"; public String build() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("name", GLAccountBuilder.name); map.put("glCode", GLAccountBuilder.GLCode); map.put("manualEntriesAllowed", GLAccountBuilder.manualEntriesAllowed); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/charges/ChargesHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/charges/ChargesHelper.java index 912e4f47d..00e4567a7 100755 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/charges/ChargesHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/charges/ChargesHelper.java @@ -112,7 +112,7 @@ public class ChargesHelper { } public static HashMap populateDefaultsForSavings() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("active", ChargesHelper.active); map.put("amount", ChargesHelper.amount); map.put("chargeAppliesTo", ChargesHelper.CHARGE_APPLIES_TO_SAVINGS); @@ -219,7 +219,7 @@ public class ChargesHelper { } public static HashMap populateDefaultsForLoan() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("active", ChargesHelper.active); map.put("amount", ChargesHelper.amount); map.put("chargeAppliesTo", ChargesHelper.CHARGE_APPLIES_TO_LOAN); @@ -264,7 +264,7 @@ public class ChargesHelper { } public static String getModifyChargeJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("amount", "200.0"); String json = new Gson().toJson(map); @@ -273,7 +273,7 @@ public class ChargesHelper { } public static String getModifyWithdrawalFeeSavingsChargeJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("chargeCalculationType", CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT); String json = new Gson().toJson(map); @@ -282,7 +282,7 @@ public class ChargesHelper { } public static String getModifyChargeAsPecentageAmountJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("chargeCalculationType", CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT); map.put("chargePaymentMode", CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER); @@ -292,7 +292,7 @@ public class ChargesHelper { } public static String getModifyChargeAsPecentageLoanAmountWithInterestJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("chargeCalculationType", CHARGE_CALCULATION_TYPE_PERCENTAGE_AMOUNT_AND_INTEREST); map.put("chargePaymentMode", CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER); @@ -302,7 +302,7 @@ public class ChargesHelper { } public static String getModifyChargeAsPercentageInterestJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("chargeCalculationType", CHARGE_CALCULATION_TYPE_PERCENTAGE_INTEREST); map.put("chargePaymentMode", CHARGE_PAYMENT_MODE_ACCOUNT_TRANSFER); @@ -312,7 +312,7 @@ public class ChargesHelper { } public static String getModifyChargeFeeFrequencyAsDaysJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("feeFrequency", ChargesHelper.CHARGE_FEE_FREQUENCY_DAYS); map.put("feeInterval", 2); @@ -322,7 +322,7 @@ public class ChargesHelper { } public static String getModifyChargeFeeFrequencyAsWeeksJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("feeFrequency", ChargesHelper.CHARGE_FEE_FREQUENCY_WEEKS); map.put("feeInterval", 2); @@ -332,7 +332,7 @@ public class ChargesHelper { } public static String getModifyChargeFeeFrequencyAsMonthsJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("feeFrequency", ChargesHelper.CHARGE_FEE_FREQUENCY_MONTHS); map.put("feeInterval", 2); @@ -342,7 +342,7 @@ public class ChargesHelper { } public static String getModifyChargeFeeFrequencyAsYearsJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("feeFrequency", ChargesHelper.CHARGE_FEE_FREQUENCY_YEARS); map.put("feeInterval", 2); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/fixeddeposit/FixedDepositAccountHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/fixeddeposit/FixedDepositAccountHelper.java index cf6130dab..ac04a9e9b 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/fixeddeposit/FixedDepositAccountHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/fixeddeposit/FixedDepositAccountHelper.java @@ -80,10 +80,10 @@ public class FixedDepositAccountHelper { public String build(final String clientId, final String productId, final String validFrom, final String validTo, final String penalInterestType) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); List> chartSlabs = new ArrayList>(); - HashMap chartSlabsMap1 = new HashMap(); + HashMap chartSlabsMap1 = new HashMap<>(); chartSlabsMap1.put("description", "First"); chartSlabsMap1.put("periodType", MONTHS); chartSlabsMap1.put("fromPeriod", "1"); @@ -92,7 +92,7 @@ public class FixedDepositAccountHelper { chartSlabsMap1.put("locale", LOCALE); chartSlabs.add(0, chartSlabsMap1); - HashMap chartSlabsMap2 = new HashMap(); + HashMap chartSlabsMap2 = new HashMap<>(); chartSlabsMap2.put("description", "Second"); chartSlabsMap2.put("periodType", MONTHS); chartSlabsMap2.put("fromPeriod", "7"); @@ -101,7 +101,7 @@ public class FixedDepositAccountHelper { chartSlabsMap2.put("locale", LOCALE); chartSlabs.add(1, chartSlabsMap2); - HashMap chartSlabsMap3 = new HashMap(); + HashMap chartSlabsMap3 = new HashMap<>(); chartSlabsMap3.put("description", "Third"); chartSlabsMap3.put("periodType", MONTHS); chartSlabsMap3.put("fromPeriod", "13"); @@ -110,7 +110,7 @@ public class FixedDepositAccountHelper { chartSlabsMap3.put("locale", LOCALE); chartSlabs.add(2, chartSlabsMap3); - HashMap chartSlabsMap4 = new HashMap(); + HashMap chartSlabsMap4 = new HashMap<>(); chartSlabsMap4.put("description", "Fourth"); chartSlabsMap4.put("periodType", MONTHS); chartSlabsMap4.put("fromPeriod", "19"); @@ -120,7 +120,7 @@ public class FixedDepositAccountHelper { chartSlabs.add(3, chartSlabsMap4); List> charts = new ArrayList>(); - HashMap chartsMap = new HashMap(); + HashMap chartsMap = new HashMap<>(); chartsMap.put("fromDate", validFrom); chartsMap.put("endDate", validTo); chartsMap.put("dateFormat", "dd MMMM yyyy"); @@ -324,7 +324,7 @@ public class FixedDepositAccountHelper { } private String getApproveFixedDepositAccountAsJSON(final String approvedOnDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("approvedOnDate", approvedOnDate); @@ -335,7 +335,7 @@ public class FixedDepositAccountHelper { } private String getRejectedFixedDepositAsJSON(final String rejectedOnDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("rejectedOnDate", rejectedOnDate); @@ -346,7 +346,7 @@ public class FixedDepositAccountHelper { } private String getWithdrawnFixedDepositAccountAsJSON(final String withdrawnApplicationOnDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("withdrawnOnDate", withdrawnApplicationOnDate); @@ -357,7 +357,7 @@ public class FixedDepositAccountHelper { } private String getActivatedFixedDepositAccountAsJSON(final String activationDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("activatedOnDate", activationDate); @@ -367,14 +367,14 @@ public class FixedDepositAccountHelper { } private String getCalculatedInterestForFixedDepositApplicationAsJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); String fixedDepositAccountCalculatedInterestJson = new Gson().toJson(map); System.out.println(fixedDepositAccountCalculatedInterestJson); return fixedDepositAccountCalculatedInterestJson; } private String getCalculatedPrematureAmountForFixedDepositAccountAsJSON(final String closedOnDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("closedOnDate", closedOnDate); @@ -385,7 +385,7 @@ public class FixedDepositAccountHelper { private String getPrematureCloseForFixedDepositAccountAsJSON(final String closedOnDate, final String closureType, final Integer toSavingsId) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("closedOnDate", closedOnDate); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/fixeddeposit/FixedDepositProductHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/fixeddeposit/FixedDepositProductHelper.java index c3ce46307..c5032a7c7 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/fixeddeposit/FixedDepositProductHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/fixeddeposit/FixedDepositProductHelper.java @@ -81,10 +81,10 @@ public class FixedDepositProductHelper { private Account[] accountList = null; public String build(final String validFrom, final String validTo) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); List> chartSlabs = new ArrayList>(); - HashMap chartSlabsMap1 = new HashMap(); + HashMap chartSlabsMap1 = new HashMap<>(); chartSlabsMap1.put("description", "First"); chartSlabsMap1.put("periodType", MONTHS); chartSlabsMap1.put("fromPeriod", "1"); @@ -93,7 +93,7 @@ public class FixedDepositProductHelper { chartSlabsMap1.put("locale", LOCALE); chartSlabs.add(0, chartSlabsMap1); - HashMap chartSlabsMap2 = new HashMap(); + HashMap chartSlabsMap2 = new HashMap<>(); chartSlabsMap2.put("description", "Second"); chartSlabsMap2.put("periodType", MONTHS); chartSlabsMap2.put("fromPeriod", "7"); @@ -102,7 +102,7 @@ public class FixedDepositProductHelper { chartSlabsMap2.put("locale", LOCALE); chartSlabs.add(1, chartSlabsMap2); - HashMap chartSlabsMap3 = new HashMap(); + HashMap chartSlabsMap3 = new HashMap<>(); chartSlabsMap3.put("description", "Third"); chartSlabsMap3.put("periodType", MONTHS); chartSlabsMap3.put("fromPeriod", "13"); @@ -111,7 +111,7 @@ public class FixedDepositProductHelper { chartSlabsMap3.put("locale", LOCALE); chartSlabs.add(2, chartSlabsMap3); - HashMap chartSlabsMap4 = new HashMap(); + HashMap chartSlabsMap4 = new HashMap<>(); chartSlabsMap4.put("description", "Fourth"); chartSlabsMap4.put("periodType", MONTHS); chartSlabsMap4.put("fromPeriod", "19"); @@ -121,7 +121,7 @@ public class FixedDepositProductHelper { chartSlabs.add(3, chartSlabsMap4); List> charts = new ArrayList>(); - HashMap chartsMap = new HashMap(); + HashMap chartsMap = new HashMap<>(); chartsMap.put("fromDate", validFrom); chartsMap.put("endDate", validTo); chartsMap.put("dateFormat", "dd MMMM yyyy"); @@ -177,7 +177,7 @@ public class FixedDepositProductHelper { } private Map getAccountMappingForCashBased() { - final Map map = new HashMap(); + final Map map = new HashMap<>(); if (accountList != null) { for (int i = 0; i < this.accountList.length; i++) { if (this.accountList[i].getAccountType().equals(Account.AccountType.ASSET)) { diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanApplicationTestBuilder.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanApplicationTestBuilder.java index a28978356..2d2214457 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanApplicationTestBuilder.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanApplicationTestBuilder.java @@ -42,7 +42,7 @@ public class LoanApplicationTestBuilder { public String build(final String ID, final String loanProductId, final String savingsID) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("dateFormat", "dd MMMM yyyy"); map.put("locale", "en_GB"); if (this.loanType == "group") { diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanProductTestBuilder.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanProductTestBuilder.java index f068f8abb..251f6c88a 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanProductTestBuilder.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanProductTestBuilder.java @@ -60,11 +60,11 @@ public class LoanProductTestBuilder { private String maxTrancheCount = "35000"; public String build(final String chargeId) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); if (chargeId != null) { List> charges = new ArrayList>(); - HashMap chargeMap = new HashMap(); + HashMap chargeMap = new HashMap<>(); chargeMap.put("id", chargeId); charges.add(chargeMap); map.put("charges", charges); @@ -233,7 +233,7 @@ public class LoanProductTestBuilder { } private Map getAccountMappingForCashBased() { - final Map map = new HashMap(); + final Map map = new HashMap<>(); for (int i = 0; i < this.accountList.length; i++) { if (this.accountList[i].getAccountType().equals(Account.AccountType.ASSET)) { final String ID = this.accountList[i].getAccountID().toString(); @@ -261,7 +261,7 @@ public class LoanProductTestBuilder { } private Map getAccountMappingForAccrualBased() { - final Map map = new HashMap(); + final Map map = new HashMap<>(); for (int i = 0; i < this.accountList.length; i++) { if (this.accountList[i].getAccountType().equals(Account.AccountType.ASSET)) { final String ID = this.accountList[i].getAccountID().toString(); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanTransactionHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanTransactionHelper.java index 370bea9e8..95e11ddb5 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanTransactionHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/loans/LoanTransactionHelper.java @@ -166,7 +166,7 @@ public class LoanTransactionHelper { } private String getDisburseLoanAsJSON(final String actualDisbursementDate, final String transactionAmount) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", "en"); map.put("dateFormat", "dd MMMM yyyy"); map.put("actualDisbursementDate", actualDisbursementDate); @@ -178,7 +178,7 @@ public class LoanTransactionHelper { } private String getApproveLoanAsJSON(final String approvalDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", "en"); map.put("dateFormat", "dd MMMM yyyy"); map.put("approvedOnDate", approvalDate); @@ -187,7 +187,7 @@ public class LoanTransactionHelper { } private String getRepaymentBodyAsJSON(final String transactionDate, final Float transactionAmount) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", "en"); map.put("dateFormat", "dd MMMM yyyy"); map.put("transactionDate", transactionDate); @@ -197,7 +197,7 @@ public class LoanTransactionHelper { } private String getWriteOffBodyAsJSON(final String transactionDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("dateFormat", "dd MMMM yyyy"); map.put("locale", "en"); map.put("note", " LOAN WRITE OFF!!!"); @@ -206,7 +206,7 @@ public class LoanTransactionHelper { } private String getWaiveBodyAsJSON(final String transactionDate, final String amountToBeWaived) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", "en"); map.put("dateFormat", "dd MMMM yyyy"); map.put("transactionDate", transactionDate); @@ -216,7 +216,7 @@ public class LoanTransactionHelper { } private String getWithdrawLoanApplicationBodyAsJSON(final String withdrawDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", "en"); map.put("dateFormat", "dd MMMM yyyy"); map.put("withdrawnOnDate", withdrawDate); @@ -230,7 +230,7 @@ public class LoanTransactionHelper { } public static String getSpecifiedDueDateChargesForLoanAsJSON(final String chargeId, final String dueDate, final String amount) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", "en_GB"); map.put("dateFormat", "dd MMMM yyyy"); map.put("amount", amount); @@ -246,7 +246,7 @@ public class LoanTransactionHelper { } public static String getDisbursementChargesForLoanAsJSON(final String chargeId, String amount) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", "en_GB"); map.put("dateFormat", "dd MMMM yyyy"); map.put("amount", amount); @@ -257,7 +257,7 @@ public class LoanTransactionHelper { } public static String getInstallmentChargesForLoanAsJSON(final String chargeId, final String amount) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", "en_GB"); map.put("dateFormat", "dd MMMM yyyy"); map.put("amount", amount); @@ -268,7 +268,7 @@ public class LoanTransactionHelper { } public static String getUpdateChargesForLoanAsJSON(String amount) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", "en_GB"); map.put("dateFormat", "dd MMMM yyyy"); map.put("amount", amount); @@ -278,7 +278,7 @@ public class LoanTransactionHelper { } public static String getPayChargeJSON(final String date, final String installmentNumber) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", "en_GB"); map.put("dateFormat", "dd MMMM yyyy"); map.put("transactionDate", date); @@ -291,7 +291,7 @@ public class LoanTransactionHelper { } public static String getWaiveChargeJSON(final String installmentNumber) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", "en_GB"); map.put("installmentNumber", installmentNumber); String json = new Gson().toJson(map); @@ -300,7 +300,7 @@ public class LoanTransactionHelper { } public String getLoanCalculationBodyAsJSON(final String productID) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("dateFormat", "dd MMMM yyyy"); map.put("locale", "en_GB"); map.put("productId", productID); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/recurringdeposit/RecurringDepositAccountHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/recurringdeposit/RecurringDepositAccountHelper.java index e9b896992..3a621d72e 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/recurringdeposit/RecurringDepositAccountHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/recurringdeposit/RecurringDepositAccountHelper.java @@ -91,10 +91,10 @@ public class RecurringDepositAccountHelper { public String build(final String clientId, final String productId, final String validFrom, final String validTo, final String penalInterestType) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); List> chartSlabs = new ArrayList>(); - HashMap chartSlabsMap1 = new HashMap(); + HashMap chartSlabsMap1 = new HashMap<>(); chartSlabsMap1.put("description", "First"); chartSlabsMap1.put("periodType", MONTHS); chartSlabsMap1.put("fromPeriod", "1"); @@ -103,7 +103,7 @@ public class RecurringDepositAccountHelper { chartSlabsMap1.put("locale", LOCALE); chartSlabs.add(0, chartSlabsMap1); - HashMap chartSlabsMap2 = new HashMap(); + HashMap chartSlabsMap2 = new HashMap<>(); chartSlabsMap2.put("description", "Second"); chartSlabsMap2.put("periodType", MONTHS); chartSlabsMap2.put("fromPeriod", "7"); @@ -112,7 +112,7 @@ public class RecurringDepositAccountHelper { chartSlabsMap2.put("locale", LOCALE); chartSlabs.add(1, chartSlabsMap2); - HashMap chartSlabsMap3 = new HashMap(); + HashMap chartSlabsMap3 = new HashMap<>(); chartSlabsMap3.put("description", "Third"); chartSlabsMap3.put("periodType", MONTHS); chartSlabsMap3.put("fromPeriod", "13"); @@ -121,7 +121,7 @@ public class RecurringDepositAccountHelper { chartSlabsMap3.put("locale", LOCALE); chartSlabs.add(2, chartSlabsMap3); - HashMap chartSlabsMap4 = new HashMap(); + HashMap chartSlabsMap4 = new HashMap<>(); chartSlabsMap4.put("description", "Fourth"); chartSlabsMap4.put("periodType", MONTHS); chartSlabsMap4.put("fromPeriod", "19"); @@ -131,7 +131,7 @@ public class RecurringDepositAccountHelper { chartSlabs.add(3, chartSlabsMap4); List> charts = new ArrayList>(); - HashMap chartsMap = new HashMap(); + HashMap chartsMap = new HashMap<>(); chartsMap.put("fromDate", validFrom); chartsMap.put("endDate", validTo); chartsMap.put("dateFormat", "dd MMMM yyyy"); @@ -378,7 +378,7 @@ public class RecurringDepositAccountHelper { } private String getApproveRecurringDepositAccountAsJSON(final String approvedOnDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("approvedOnDate", approvedOnDate); @@ -389,7 +389,7 @@ public class RecurringDepositAccountHelper { } private String getUpdateTransactionAsJSON(final String transactionDate, final Float transactionAmount) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("transactionDate", transactionDate); @@ -400,7 +400,7 @@ public class RecurringDepositAccountHelper { } private String getRejectedRecurringDepositAsJSON(final String rejectedOnDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("rejectedOnDate", rejectedOnDate); @@ -411,7 +411,7 @@ public class RecurringDepositAccountHelper { } private String getWithdrawnRecurringDepositAccountAsJSON(final String withdrawnApplicationOnDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("withdrawnOnDate", withdrawnApplicationOnDate); @@ -422,7 +422,7 @@ public class RecurringDepositAccountHelper { } private String getActivatedRecurringDepositAccountAsJSON(final String activationDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("activatedOnDate", activationDate); @@ -432,14 +432,14 @@ public class RecurringDepositAccountHelper { } private String getCalculatedInterestForRecurringDepositApplicationAsJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); String recurringDepositAccountCalculatedInterestJson = new Gson().toJson(map); System.out.println(recurringDepositAccountCalculatedInterestJson); return recurringDepositAccountCalculatedInterestJson; } private String getCalculatedPrematureAmountForRecurringDepositAccountAsJSON(final String closedOnDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("closedOnDate", closedOnDate); @@ -449,7 +449,7 @@ public class RecurringDepositAccountHelper { } private String getDepositToRecurringDepositAccountAsJSON(final Float depositAmount, final String depositedOnDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("transactionAmount", depositAmount); @@ -461,7 +461,7 @@ public class RecurringDepositAccountHelper { private String getPrematureCloseForRecurringDepositAccountAsJSON(final String closedOnDate, final String closureType, final Integer toSavingsId) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("closedOnDate", closedOnDate); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/recurringdeposit/RecurringDepositProductHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/recurringdeposit/RecurringDepositProductHelper.java index 0dae6feb4..f6cec04ac 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/recurringdeposit/RecurringDepositProductHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/recurringdeposit/RecurringDepositProductHelper.java @@ -79,10 +79,10 @@ public class RecurringDepositProductHelper { private Account[] accountList = null; public String build(final String validFrom, final String validTo) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); List> chartSlabs = new ArrayList>(); - HashMap chartSlabsMap1 = new HashMap(); + HashMap chartSlabsMap1 = new HashMap<>(); chartSlabsMap1.put("description", "First"); chartSlabsMap1.put("periodType", MONTHS); chartSlabsMap1.put("fromPeriod", "1"); @@ -91,7 +91,7 @@ public class RecurringDepositProductHelper { chartSlabsMap1.put("locale", LOCALE); chartSlabs.add(0, chartSlabsMap1); - HashMap chartSlabsMap2 = new HashMap(); + HashMap chartSlabsMap2 = new HashMap<>(); chartSlabsMap2.put("description", "Second"); chartSlabsMap2.put("periodType", MONTHS); chartSlabsMap2.put("fromPeriod", "7"); @@ -100,7 +100,7 @@ public class RecurringDepositProductHelper { chartSlabsMap2.put("locale", LOCALE); chartSlabs.add(1, chartSlabsMap2); - HashMap chartSlabsMap3 = new HashMap(); + HashMap chartSlabsMap3 = new HashMap<>(); chartSlabsMap3.put("description", "Third"); chartSlabsMap3.put("periodType", MONTHS); chartSlabsMap3.put("fromPeriod", "13"); @@ -109,7 +109,7 @@ public class RecurringDepositProductHelper { chartSlabsMap3.put("locale", LOCALE); chartSlabs.add(2, chartSlabsMap3); - HashMap chartSlabsMap4 = new HashMap(); + HashMap chartSlabsMap4 = new HashMap<>(); chartSlabsMap4.put("description", "Fourth"); chartSlabsMap4.put("periodType", MONTHS); chartSlabsMap4.put("fromPeriod", "19"); @@ -119,7 +119,7 @@ public class RecurringDepositProductHelper { chartSlabs.add(3, chartSlabsMap4); List> charts = new ArrayList>(); - HashMap chartsMap = new HashMap(); + HashMap chartsMap = new HashMap<>(); chartsMap.put("fromDate", validFrom); chartsMap.put("endDate", validTo); chartsMap.put("dateFormat", "dd MMMM yyyy"); @@ -181,7 +181,7 @@ public class RecurringDepositProductHelper { } private Map getAccountMappingForCashBased() { - final Map map = new HashMap(); + final Map map = new HashMap<>(); if (accountList != null) { for (int i = 0; i < this.accountList.length; i++) { if (this.accountList[i].getAccountType().equals(Account.AccountType.ASSET)) { diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/AccountTransferHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/AccountTransferHelper.java index e640afa08..66b8e4828 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/AccountTransferHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/AccountTransferHelper.java @@ -31,7 +31,7 @@ public class AccountTransferHelper { public String build(final String fromAccountId, final String fromClientId, final String toAccountId, final String toClientId, final String fromAccountType, final String toAccountType, final String transferAmount) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("dateFormat", "dd MMMM yyyy"); map.put("locale", LOCALE); map.put("fromClientId", fromClientId); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsAccountHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsAccountHelper.java index aaa62f257..6e98d58d1 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsAccountHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsAccountHelper.java @@ -179,7 +179,7 @@ public class SavingsAccountHelper { } private String getApproveSavingsAsJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("approvedOnDate", CREATED_DATE_PLUS_ONE); @@ -190,7 +190,7 @@ public class SavingsAccountHelper { } private String getRejectedSavingsAsJSON(final String rejectedOnDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("rejectedOnDate", rejectedOnDate); @@ -201,7 +201,7 @@ public class SavingsAccountHelper { } private String getWithdrawnSavingsAsJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("withdrawnOnDate", CREATED_DATE_PLUS_ONE); @@ -212,7 +212,7 @@ public class SavingsAccountHelper { } private String getActivatedSavingsAsJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("activatedOnDate", TRANSACTION_DATE); @@ -222,7 +222,7 @@ public class SavingsAccountHelper { } private String getSavingsTransactionJSON(final String amount, final String transactionDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("transactionDate", transactionDate); @@ -233,14 +233,14 @@ public class SavingsAccountHelper { } private String getCalculatedInterestForSavingsApplicationAsJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); String savingsAccountCalculatedInterestJson = new Gson().toJson(map); System.out.println(savingsAccountCalculatedInterestJson); return savingsAccountCalculatedInterestJson; } private String getSavingsPayChargeJSON(final String amount, final String dueDate) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("amount", amount); @@ -250,7 +250,7 @@ public class SavingsAccountHelper { } private String getSavingsWaiveChargeJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); String josn = new Gson().toJson(map); @@ -258,7 +258,7 @@ public class SavingsAccountHelper { } private String getModifyChargeJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("amount", "50"); @@ -267,7 +267,7 @@ public class SavingsAccountHelper { } private String getCloseAccountJSON() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("locale", CommonConstants.locale); map.put("dateFormat", CommonConstants.dateFormat); map.put("closedOnDate", LAST_TRANSACTION_DATE); @@ -347,7 +347,7 @@ public class SavingsAccountHelper { } private String getPeriodChargeRequestJSON(Integer chargeId) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("chargeId", chargeId); map.put("amount", 100); map.put("feeOnMonthDay", "15 January"); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsApplicationTestBuilder.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsApplicationTestBuilder.java index a060f9a0a..64f2f9155 100755 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsApplicationTestBuilder.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsApplicationTestBuilder.java @@ -12,7 +12,7 @@ public class SavingsApplicationTestBuilder { public String build(final String ID, final String savingsProductId, final String accountType) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("dateFormat", "dd MMMM yyyy"); if (accountType == "GROUP") { map.put("groupId", ID); diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsProductHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsProductHelper.java index d6eb80d6b..ddb7d0910 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsProductHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/savings/SavingsProductHelper.java @@ -65,7 +65,7 @@ public class SavingsProductHelper { private Account[] accountList = null; public String build() { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put("name", this.nameOfSavingsProduct); map.put("shortName", this.shortName); @@ -159,7 +159,7 @@ public class SavingsProductHelper { } private Map getAccountMappingForCashBased() { - final Map map = new HashMap(); + final Map map = new HashMap<>(); if (accountList != null) { for (int i = 0; i < this.accountList.length; i++) { if (this.accountList[i].getAccountType().equals(Account.AccountType.ASSET)) { diff --git a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/system/CodeHelper.java b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/system/CodeHelper.java index 42c21c8a1..62d960496 100644 --- a/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/system/CodeHelper.java +++ b/mifosng-provider/src/integrationTest/java/org/mifosplatform/integrationtests/common/system/CodeHelper.java @@ -66,13 +66,13 @@ public class CodeHelper { } public static String getTestCodeAsJSON(final String codeName) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put(CODE_NAME_ATTRIBUTE_NAME, codeName); return new Gson().toJson(map); } public static String getTestCodeValueAsJSON(final String codeValueName, final Integer position) { - final HashMap map = new HashMap(); + final HashMap map = new HashMap<>(); map.put(CODE_VALUE_NAME_ATTRIBUTE_NAME, codeValueName); map.put(CODE_VALUE_POSITION_ATTRIBUTE_NAME, position); return new Gson().toJson(map); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/api/GLClosureJsonInputParams.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/api/GLClosureJsonInputParams.java index 31307d85a..4d3bbf328 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/api/GLClosureJsonInputParams.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/api/GLClosureJsonInputParams.java @@ -20,7 +20,7 @@ public enum GLClosureJsonInputParams { this.value = value; } - private static final Set values = new HashSet(); + private static final Set values = new HashSet<>(); static { for (final GLClosureJsonInputParams type : GLClosureJsonInputParams.values()) { values.add(type.value); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/api/GLClosuresApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/api/GLClosuresApiResource.java index 68d8b7d48..4d58867f6 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/api/GLClosuresApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/api/GLClosuresApiResource.java @@ -43,7 +43,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class GLClosuresApiResource { - private static final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "officeId", "officeName", + private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "officeId", "officeName", "closingDate", "deleted", "createdDate", "lastUpdatedDate", "createdByUserId", "createdByUsername", "lastUpdatedByUserId", "lastUpdatedByUsername")); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/command/GLClosureCommand.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/command/GLClosureCommand.java index 7509bd4fb..7da7b28d8 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/command/GLClosureCommand.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/command/GLClosureCommand.java @@ -34,7 +34,7 @@ public class GLClosureCommand { public void validateForCreate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("GLClosure"); @@ -49,7 +49,7 @@ public class GLClosureCommand { } public void validateForUpdate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("GLClosure"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/data/GLClosureData.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/data/GLClosureData.java index ee4bad1d7..4e7a43d79 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/data/GLClosureData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/data/GLClosureData.java @@ -44,7 +44,7 @@ public class GLClosureData { @SuppressWarnings("unused") private final String comments; - private Collection allowedOffices = new ArrayList(); + private Collection allowedOffices = new ArrayList<>(); public GLClosureData(final Long id, final Long officeId, final String officeName, final LocalDate closingDate, final boolean deleted, final LocalDate createdDate, final LocalDate lastUpdatedDate, final Long createdByUserId, final String createdByUsername, diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/domain/GLClosure.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/domain/GLClosure.java index 4c141b170..a9af0cbbc 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/domain/GLClosure.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/closure/domain/GLClosure.java @@ -64,7 +64,7 @@ public class GLClosure extends AbstractAuditableCustom { } public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(5); + final Map actualChanges = new LinkedHashMap<>(5); handlePropertyUpdate(command, actualChanges, GLClosureJsonInputParams.COMMENTS.getValue(), this.comments); return actualChanges; } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingConstants.java index c9fd912c1..5fd67ea13 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingConstants.java @@ -35,7 +35,7 @@ public class AccountingConstants { return this.value; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); static { for (final CASH_ACCOUNTS_FOR_LOAN type : CASH_ACCOUNTS_FOR_LOAN.values()) { intToEnumMap.put(type.value, type); @@ -68,7 +68,7 @@ public class AccountingConstants { return this.value; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); static { for (final ACCRUAL_ACCOUNTS_FOR_LOAN type : ACCRUAL_ACCOUNTS_FOR_LOAN.values()) { intToEnumMap.put(type.value, type); @@ -155,7 +155,7 @@ public class AccountingConstants { return this.value; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); static { for (final CASH_ACCOUNTS_FOR_SAVINGS type : CASH_ACCOUNTS_FOR_SAVINGS.values()) { intToEnumMap.put(type.value, type); @@ -255,7 +255,7 @@ public class AccountingConstants { return this.value.toString(); } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); static { for (final FINANCIAL_ACTIVITY type : FINANCIAL_ACTIVITY.values()) { intToEnumMap.put(type.value, type); @@ -274,7 +274,7 @@ public class AccountingConstants { public static List getAllFinancialActivities() { if (financialActivities == null) { - financialActivities = new ArrayList(); + financialActivities = new ArrayList<>(); for (final FINANCIAL_ACTIVITY type : FINANCIAL_ACTIVITY.values()) { FinancialActivityData financialActivityData = convertToFinancialActivityData(type); financialActivities.add(financialActivityData); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingDropdownReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingDropdownReadPlatformServiceImpl.java index b89aef0ab..7755cb7aa 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingDropdownReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingDropdownReadPlatformServiceImpl.java @@ -60,7 +60,7 @@ public class AccountingDropdownReadPlatformServiceImpl implements AccountingDrop @Override public Map> retrieveAccountMappingOptions() { - final Map> accountOptions = new HashMap>(); + final Map> accountOptions = new HashMap<>(); List assetAccountOptions = this.accountReadPlatformService.retrieveAllEnabledDetailGLAccounts(GLAccountType.ASSET); if (assetAccountOptions.isEmpty()) { assetAccountOptions = null; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingEnumerations.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingEnumerations.java index a457ef948..cf3cc871b 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingEnumerations.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingEnumerations.java @@ -27,7 +27,7 @@ public class AccountingEnumerations { } public static List gLAccountType(final GLAccountType[] accountTypes) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final GLAccountType accountType : accountTypes) { optionDatas.add(gLAccountType(accountType)); } @@ -45,7 +45,7 @@ public class AccountingEnumerations { } public static List gLAccountUsage(final GLAccountUsage[] accountUsages) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final GLAccountUsage accountUsage : accountUsages) { optionDatas.add(gLAccountUsage(accountUsage)); } @@ -63,7 +63,7 @@ public class AccountingEnumerations { } public static List journalEntryTypes(final JournalEntryType[] journalEntryTypes) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final JournalEntryType journalEntryType : journalEntryTypes) { optionDatas.add(journalEntryType(journalEntryType)); } @@ -90,7 +90,7 @@ public class AccountingEnumerations { } public static List accountingRuleTypes(final AccountingRuleType[] accountingRuleTypes) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final AccountingRuleType accountingRuleType : accountingRuleTypes) { optionDatas.add(accountingRuleType(accountingRuleType)); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingRuleType.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingRuleType.java index 47c5d7803..4db02305c 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingRuleType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/common/AccountingRuleType.java @@ -18,7 +18,7 @@ public enum AccountingRuleType { private final Integer value; private final String code; - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); static { for (final AccountingRuleType type : AccountingRuleType.values()) { intToEnumMap.put(type.value, type); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/api/FinancialActivityAccountsConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/api/FinancialActivityAccountsConstants.java index 1da245b76..977c07ea1 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/api/FinancialActivityAccountsConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/api/FinancialActivityAccountsConstants.java @@ -6,7 +6,7 @@ import java.util.Set; public class FinancialActivityAccountsConstants { - public static final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "financialActivityData", + public static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "financialActivityData", "glAccountData", "glAccountOptions", "financialActivityOptions")); public static final String resourceNameForPermission = "FINANCIALACTIVITYACCOUNT"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/api/FinancialActivityAccountsJsonInputParams.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/api/FinancialActivityAccountsJsonInputParams.java index a99f771cd..a8171bf9c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/api/FinancialActivityAccountsJsonInputParams.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/api/FinancialActivityAccountsJsonInputParams.java @@ -20,7 +20,7 @@ public enum FinancialActivityAccountsJsonInputParams { this.value = value; } - private static final Set values = new HashSet(); + private static final Set values = new HashSet<>(); static { for (final FinancialActivityAccountsJsonInputParams type : FinancialActivityAccountsJsonInputParams.values()) { values.add(type.value); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/serialization/FinancialActivityAccountDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/serialization/FinancialActivityAccountDataValidator.java index 68f158ca2..94fe95f3e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/serialization/FinancialActivityAccountDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/serialization/FinancialActivityAccountDataValidator.java @@ -46,7 +46,7 @@ public final class FinancialActivityAccountDataValidator { public void validateForCreate(final String json) { validateJSONAndCheckForUnsupportedParams(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = getDataValidator(dataValidationErrors); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -69,7 +69,7 @@ public final class FinancialActivityAccountDataValidator { public void validateForUpdate(final String json) { validateJSONAndCheckForUnsupportedParams(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = getDataValidator(dataValidationErrors); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/service/FinancialActivityAccountWritePlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/service/FinancialActivityAccountWritePlatformServiceImpl.java index b83f3674d..1d2e1527b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/service/FinancialActivityAccountWritePlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/financialactivityaccount/service/FinancialActivityAccountWritePlatformServiceImpl.java @@ -135,7 +135,7 @@ public class FinancialActivityAccountWritePlatformServiceImpl implements Financi public Map findChanges(JsonCommand command, FinancialActivityAccount financialActivityAccount) { - Map changes = new HashMap(); + Map changes = new HashMap<>(); Long existingGLAccountId = financialActivityAccount.getGlAccount().getId(); Integer financialActivityType = financialActivityAccount.getFinancialActivityType(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/api/GLAccountJsonInputParams.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/api/GLAccountJsonInputParams.java index ced59a675..540e13b94 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/api/GLAccountJsonInputParams.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/api/GLAccountJsonInputParams.java @@ -21,7 +21,7 @@ public enum GLAccountJsonInputParams { this.value = value; } - private static final Set values = new HashSet(); + private static final Set values = new HashSet<>(); static { for (final GLAccountJsonInputParams type : GLAccountJsonInputParams.values()) { values.add(type.value); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/api/GLAccountsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/api/GLAccountsApiResource.java index b97cdd5c8..0885b45b7 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/api/GLAccountsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/api/GLAccountsApiResource.java @@ -50,7 +50,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class GLAccountsApiResource { - private static final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "name", "parentId", "glCode", + private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "parentId", "glCode", "disabled", "manualEntriesAllowed", "type", "usage", "description", "assetHeaderAccountOptions", "liabilityHeaderAccountOptions", "equityHeaderAccountOptions", "incomeHeaderAccountOptions", "expenseHeaderAccountOptions", "nameDecorated", "tagId", "allowedAssetsTagOptions", "allowedLiabilitiesTagOptions", "allowedEquityTagOptions", diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/command/GLAccountCommand.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/command/GLAccountCommand.java index a79e93a00..add0aba13 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/command/GLAccountCommand.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/command/GLAccountCommand.java @@ -48,7 +48,7 @@ public class GLAccountCommand { public void validateForCreate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("GLAccount"); @@ -80,7 +80,7 @@ public class GLAccountCommand { } public void validateForUpdate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("GLAccount"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/domain/GLAccount.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/domain/GLAccount.java index 775b7ac94..1fd8ba40a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/domain/GLAccount.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/domain/GLAccount.java @@ -39,7 +39,7 @@ public class GLAccount extends AbstractPersistable { @OneToMany(fetch = FetchType.LAZY) @JoinColumn(name = "parent_id") - private final List children = new LinkedList(); + private final List children = new LinkedList<>(); @Column(name = "name", nullable = false, length = 45) private String name; @@ -96,7 +96,7 @@ public class GLAccount extends AbstractPersistable { } public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(15); + final Map actualChanges = new LinkedHashMap<>(15); handlePropertyUpdate(command, actualChanges, GLAccountJsonInputParams.DESCRIPTION.getValue(), this.description); handlePropertyUpdate(command, actualChanges, GLAccountJsonInputParams.DISABLED.getValue(), this.disabled); handlePropertyUpdate(command, actualChanges, GLAccountJsonInputParams.GL_CODE.getValue(), this.glCode); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/domain/GLAccountType.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/domain/GLAccountType.java index 840dc41a5..1ad9b1d8b 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/domain/GLAccountType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/domain/GLAccountType.java @@ -28,7 +28,7 @@ public enum GLAccountType { return this.code; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); private static int minValue; private static int maxValue; static { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/domain/GLAccountUsage.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/domain/GLAccountUsage.java index f22822afd..cdeab3094 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/domain/GLAccountUsage.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/glaccount/domain/GLAccountUsage.java @@ -28,7 +28,7 @@ public enum GLAccountUsage { return this.code; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); private static int minValue; private static int maxValue; static { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/api/JournalEntriesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/api/JournalEntriesApiResource.java index e98f513e4..683405a88 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/api/JournalEntriesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/api/JournalEntriesApiResource.java @@ -45,7 +45,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class JournalEntriesApiResource { - private static final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "officeId", "officeName", + private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "officeId", "officeName", "glAccountName", "glAccountId", "glAccountCode", "glAccountType", "transactionDate", "entryType", "amount", "transactionId", "manualEntry", "entityType", "entityId", "createdByUserId", "createdDate", "createdByUserName", "comments", "reversed", "referenceNumber", "currency")); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/api/JournalEntryJsonInputParams.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/api/JournalEntryJsonInputParams.java index b45ebb489..14b655ab9 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/api/JournalEntryJsonInputParams.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/api/JournalEntryJsonInputParams.java @@ -23,7 +23,7 @@ public enum JournalEntryJsonInputParams { this.value = value; } - private static final Set values = new HashSet(); + private static final Set values = new HashSet<>(); static { for (final JournalEntryJsonInputParams type : JournalEntryJsonInputParams.values()) { values.add(type.value); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/command/JournalEntryCommand.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/command/JournalEntryCommand.java index df1589840..6459f2300 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/command/JournalEntryCommand.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/command/JournalEntryCommand.java @@ -66,7 +66,7 @@ public class JournalEntryCommand { public void validateForCreate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("GLJournalEntry"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/data/JournalEntryDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/data/JournalEntryDataValidator.java index f6583fff7..dd19d300f 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/data/JournalEntryDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/data/JournalEntryDataValidator.java @@ -24,7 +24,7 @@ public class JournalEntryDataValidator { private final FromJsonHelper fromApiJsonHelper; - public static final Set RUNNING_BALANCE_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet( + public static final Set RUNNING_BALANCE_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>( Arrays.asList(JournalEntryJsonInputParams.OFFICE_ID.getValue())); @Autowired @@ -35,7 +35,7 @@ public class JournalEntryDataValidator { public void validateForUpdateRunningbalance(final JsonCommand command) { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, command.json(), RUNNING_BALANCE_UPDATE_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("GLJournalEntry"); if (this.fromApiJsonHelper.parameterExists(JournalEntryJsonInputParams.OFFICE_ID.getValue(), command.parsedJson())) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/domain/JournalEntryType.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/domain/JournalEntryType.java index 6c316f5af..6a2400ff5 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/domain/JournalEntryType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/domain/JournalEntryType.java @@ -28,7 +28,7 @@ public enum JournalEntryType { return this.code; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); static { for (final JournalEntryType type : JournalEntryType.values()) { intToEnumMap.put(type.value, type); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java index b0c496497..20d4ef4f4 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/serialization/JournalEntryCommandFromApiJsonDeserializer.java @@ -105,7 +105,7 @@ public final class JournalEntryCommandFromApiJsonDeserializer extends AbstractFr for (int i = 0; i < array.size(); i++) { final JsonObject creditElement = array.get(i).getAsJsonObject(); - final Set parametersPassedInForCreditsCommand = new HashSet(); + final Set parametersPassedInForCreditsCommand = new HashSet<>(); final Long glAccountId = this.fromApiJsonHelper.extractLongNamed("glAccountId", creditElement); final String comments = this.fromApiJsonHelper.extractStringNamed("comments", creditElement); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccountingProcessorHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccountingProcessorHelper.java index 496ae3b6d..204d30d46 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccountingProcessorHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/AccountingProcessorHelper.java @@ -90,7 +90,7 @@ public class AccountingProcessorHelper { final Long loanProductId = (Long) accountingBridgeData.get("loanProductId"); final Long officeId = (Long) accountingBridgeData.get("officeId"); final CurrencyData currencyData = (CurrencyData) accountingBridgeData.get("currency"); - final List newLoanTransactions = new ArrayList(); + final List newLoanTransactions = new ArrayList<>(); boolean isAccountTransfer = (Boolean) accountingBridgeData.get("isAccountTransfer"); @SuppressWarnings("unchecked") @@ -110,8 +110,8 @@ public class AccountingProcessorHelper { final boolean reversed = (Boolean) map.get("reversed"); final Long paymentTypeId = (Long) map.get("paymentTypeId"); - final List feePaymentDetails = new ArrayList(); - final List penaltyPaymentDetails = new ArrayList(); + final List feePaymentDetails = new ArrayList<>(); + final List penaltyPaymentDetails = new ArrayList<>(); // extract charge payment details (if exists) if (map.containsKey("loanChargesPaid")) { @SuppressWarnings("unchecked") @@ -152,7 +152,7 @@ public class AccountingProcessorHelper { final Long loanProductId = (Long) accountingBridgeData.get("savingsProductId"); final Long officeId = (Long) accountingBridgeData.get("officeId"); final CurrencyData currencyData = (CurrencyData) accountingBridgeData.get("currency"); - final List newSavingsTransactions = new ArrayList(); + final List newSavingsTransactions = new ArrayList<>(); boolean isAccountTransfer = (Boolean) accountingBridgeData.get("isAccountTransfer"); @SuppressWarnings("unchecked") @@ -168,8 +168,8 @@ public class AccountingProcessorHelper { final Long paymentTypeId = (Long) map.get("paymentTypeId"); final BigDecimal overdraftAmount = (BigDecimal) map.get("overdraftAmount"); - final List feePayments = new ArrayList(); - final List penaltyPayments = new ArrayList(); + final List feePayments = new ArrayList<>(); + final List penaltyPayments = new ArrayList<>(); // extract charge payment details (if exists) if (map.containsKey("savingsChargesPaid")) { @SuppressWarnings("unchecked") @@ -383,7 +383,7 @@ public class AccountingProcessorHelper { * Map to track each account and the net credit to be made for a * particular account ***/ - final Map creditDetailsMap = new LinkedHashMap(); + final Map creditDetailsMap = new LinkedHashMap<>(); for (final ChargePaymentDTO chargePaymentDTO : chargePaymentDTOs) { final Long chargeId = chargePaymentDTO.getChargeId(); final GLAccount chargeSpecificAccount = getLinkedGLAccountForLoanCharges(loanProductId, accountMappingTypeId, chargeId); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java index 12e1a0cf3..7cfaed464 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryReadPlatformServiceImpl.java @@ -28,6 +28,7 @@ import org.mifosplatform.infrastructure.core.service.Page; import org.mifosplatform.infrastructure.core.service.PaginationHelper; import org.mifosplatform.infrastructure.core.service.RoutingDataSource; import org.mifosplatform.organisation.monetary.data.CurrencyData; +import org.mifosplatform.portfolio.account.PortfolioAccountType; import org.mifosplatform.portfolio.group.service.SearchParameters; import org.mifosplatform.portfolio.loanaccount.data.LoanTransactionEnumData; import org.mifosplatform.portfolio.loanproduct.service.LoanEnumerations; @@ -35,7 +36,6 @@ import org.mifosplatform.portfolio.note.data.NoteData; import org.mifosplatform.portfolio.paymentdetail.data.PaymentDetailData; import org.mifosplatform.portfolio.savings.data.SavingsAccountTransactionEnumData; import org.mifosplatform.portfolio.savings.service.SavingsEnumerations; -import org.mifosplatform.portfolio.account.PortfolioAccountType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.dao.EmptyResultDataAccessException; import org.springframework.jdbc.core.JdbcTemplate; @@ -47,7 +47,7 @@ public class JournalEntryReadPlatformServiceImpl implements JournalEntryReadPlat private final JdbcTemplate jdbcTemplate; - private final PaginationHelper paginationHelper = new PaginationHelper(); + private final PaginationHelper paginationHelper = new PaginationHelper<>(); @Autowired public JournalEntryReadPlatformServiceImpl(final RoutingDataSource dataSource) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryRunningBalanceUpdateServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryRunningBalanceUpdateServiceImpl.java index 3cd657f1c..b3755fcf8 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryRunningBalanceUpdateServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryRunningBalanceUpdateServiceImpl.java @@ -120,8 +120,8 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry @Transactional private void updateOrganizationRunningBalance(Date entityDate) { - Map runningBalanceMap = new HashMap(5); - Map> officesRunningBalance = new HashMap>(); + Map runningBalanceMap = new HashMap<>(5); + Map> officesRunningBalance = new HashMap<>(); List> list = jdbcTemplate.queryForList(organizationRunningBalanceSql, entityDate, entityDate); for (Map entries : list) { @@ -139,7 +139,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry if (officesRunningBalance.containsKey(officeId)) { runningBalance = officesRunningBalance.get(officeId); } else { - runningBalance = new HashMap(); + runningBalance = new HashMap<>(); officesRunningBalance.put(officeId, runningBalance); } if (!runningBalance.containsKey(accountId)) { @@ -157,7 +157,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry if (officesRunningBalance.containsKey(entryData.getOfficeId())) { officeRunningBalanceMap = officesRunningBalance.get(entryData.getOfficeId()); } else { - officeRunningBalanceMap = new HashMap(); + officeRunningBalanceMap = new HashMap<>(); officesRunningBalance.put(entryData.getOfficeId(), officeRunningBalanceMap); } BigDecimal officeRunningBalance = calculateRunningBalance(entryData, officeRunningBalanceMap); @@ -173,7 +173,7 @@ public class JournalEntryRunningBalanceUpdateServiceImpl implements JournalEntry @Transactional private void updateRunningBalance(Long officeId, Date entityDate) { - Map runningBalanceMap = new HashMap(5); + Map runningBalanceMap = new HashMap<>(5); List> list = jdbcTemplate.queryForList(officeRunningBalanceSql, officeId, entityDate, officeId, entityDate); for (Map entries : list) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java index 38cf9baa0..64ea21d64 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/journalentry/service/JournalEntryWritePlatformServiceJpaRepositoryImpl.java @@ -117,7 +117,7 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa validateBusinessRulesForJournalEntries(journalEntryCommand); /** Capture payment details **/ - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes); /** Set a transaction Id and save these Journal entries **/ @@ -203,8 +203,8 @@ public class JournalEntryWritePlatformServiceJpaRepositoryImpl implements Journa private void checkDebitOrCreditAccountsAreValid(final AccountingRule accountingRule, final SingleDebitOrCreditEntryCommand[] credits, final SingleDebitOrCreditEntryCommand[] debits) { // Validate the debit and credit arrays are appropriate accounts - List allowedCreditGLAccounts = new ArrayList(); - List allowedDebitGLAccounts = new ArrayList(); + List allowedCreditGLAccounts = new ArrayList<>(); + List allowedDebitGLAccounts = new ArrayList<>(); final SingleDebitOrCreditEntryCommand[] validCredits = new SingleDebitOrCreditEntryCommand[credits.length]; final SingleDebitOrCreditEntryCommand[] validDebits = new SingleDebitOrCreditEntryCommand[debits.length]; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/domain/PortfolioProductType.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/domain/PortfolioProductType.java index 3bb1a6a8e..e162c9b99 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/domain/PortfolioProductType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/domain/PortfolioProductType.java @@ -32,7 +32,7 @@ public enum PortfolioProductType { return this.code; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); static { for (final PortfolioProductType type : PortfolioProductType.values()) { intToEnumMap.put(type.value, type); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/serialization/ProductToGLAccountMappingFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/serialization/ProductToGLAccountMappingFromApiJsonDeserializer.java index 552367256..281a4ef1a 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/serialization/ProductToGLAccountMappingFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/serialization/ProductToGLAccountMappingFromApiJsonDeserializer.java @@ -67,7 +67,7 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer { public void validateForLoanProductCreate(final String json) { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanproduct"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -149,7 +149,7 @@ public final class ProductToGLAccountMappingFromApiJsonDeserializer { public void validateForSavingsProductCreate(final String json, DepositAccountType accountType) { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_PRODUCT_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/LoanProductToGLAccountMappingHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/LoanProductToGLAccountMappingHelper.java index 27d2666ec..49dc9cf26 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/LoanProductToGLAccountMappingHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/LoanProductToGLAccountMappingHelper.java @@ -110,7 +110,7 @@ public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappi public Map populateChangesForNewLoanProductToGLAccountMappingCreation(final JsonElement element, final AccountingRuleType accountingRuleType) { - final Map changes = new HashMap(); + final Map changes = new HashMap<>(); final Long fundAccountId = this.fromApiJsonHelper.extractLongNamed(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(), element); final Long loanPortfolioAccountId = this.fromApiJsonHelper.extractLongNamed( @@ -144,17 +144,18 @@ public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappi break; case CASH_BASED: populateChangesForCashBasedAccounting(changes, fundAccountId, loanPortfolioAccountId, incomeFromInterestId, - incomeFromFeeId, incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId,incomeFromRecoveryAccountId); + incomeFromFeeId, incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId, + incomeFromRecoveryAccountId); break; case ACCRUAL_PERIODIC: populateChangesForAccrualBasedAccounting(changes, fundAccountId, loanPortfolioAccountId, incomeFromInterestId, - incomeFromFeeId, incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId,incomeFromRecoveryAccountId, - receivableInterestAccountId, receivableFeeAccountId, receivablePenaltyAccountId); + incomeFromFeeId, incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId, + incomeFromRecoveryAccountId, receivableInterestAccountId, receivableFeeAccountId, receivablePenaltyAccountId); break; case ACCRUAL_UPFRONT: populateChangesForAccrualBasedAccounting(changes, fundAccountId, loanPortfolioAccountId, incomeFromInterestId, - incomeFromFeeId, incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId,incomeFromRecoveryAccountId, - receivableInterestAccountId, receivableFeeAccountId, receivablePenaltyAccountId); + incomeFromFeeId, incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId, + incomeFromRecoveryAccountId, receivableInterestAccountId, receivableFeeAccountId, receivablePenaltyAccountId); break; } @@ -163,21 +164,23 @@ public class LoanProductToGLAccountMappingHelper extends ProductToGLAccountMappi private void populateChangesForAccrualBasedAccounting(final Map changes, final Long fundAccountId, final Long loanPortfolioAccountId, final Long incomeFromInterestId, final Long incomeFromFeeId, final Long incomeFromPenaltyId, - final Long writeOffAccountId, final Long overPaymentAccountId, final Long transfersInSuspenseAccountId,final Long incomeFromRecoveryAccountId, - final Long receivableInterestAccountId, final Long receivableFeeAccountId, final Long receivablePenaltyAccountId) { + final Long writeOffAccountId, final Long overPaymentAccountId, final Long transfersInSuspenseAccountId, + final Long incomeFromRecoveryAccountId, final Long receivableInterestAccountId, final Long receivableFeeAccountId, + final Long receivablePenaltyAccountId) { changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_RECEIVABLE.getValue(), receivableInterestAccountId); changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.FEES_RECEIVABLE.getValue(), receivableFeeAccountId); changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.PENALTIES_RECEIVABLE.getValue(), receivablePenaltyAccountId); populateChangesForCashBasedAccounting(changes, fundAccountId, loanPortfolioAccountId, incomeFromInterestId, incomeFromFeeId, - incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId,incomeFromRecoveryAccountId); + incomeFromPenaltyId, writeOffAccountId, overPaymentAccountId, transfersInSuspenseAccountId, incomeFromRecoveryAccountId); } private void populateChangesForCashBasedAccounting(final Map changes, final Long fundAccountId, final Long loanPortfolioAccountId, final Long incomeFromInterestId, final Long incomeFromFeeId, final Long incomeFromPenaltyId, - final Long writeOffAccountId, final Long overPaymentAccountId, final Long transfersInSuspenseAccountId,final Long incomeFromRecoveryAccountId) { + final Long writeOffAccountId, final Long overPaymentAccountId, final Long transfersInSuspenseAccountId, + final Long incomeFromRecoveryAccountId) { changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.FUND_SOURCE.getValue(), fundAccountId); changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.LOAN_PORTFOLIO.getValue(), loanPortfolioAccountId); changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.INTEREST_ON_LOANS.getValue(), incomeFromInterestId); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingHelper.java index 820bcfaff..6b59c31f1 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingHelper.java @@ -175,12 +175,12 @@ public class ProductToGLAccountMappingHelper { * associated income Id's (value) extracted from the passed in * Jsoncommand **/ - final Map inputChargeToIncomeAccountMap = new HashMap(); + final Map inputChargeToIncomeAccountMap = new HashMap<>(); /*** * Variable stores all charges which have already been mapped to Income * Accounts in the system **/ - final Set existingCharges = new HashSet(); + final Set existingCharges = new HashSet<>(); if (chargeToIncomeAccountMappingArray != null && chargeToIncomeAccountMappingArray.size() > 0) { if (changes != null) { changes.put(arrayFragmentName, command.jsonFragment(arrayFragmentName)); @@ -253,12 +253,12 @@ public class ProductToGLAccountMappingHelper { * Variable stores a map representation of Payment channels (key) and * their fund sources (value) extracted from the passed in Jsoncommand **/ - final Map inputPaymentChannelFundSourceMap = new HashMap(); + final Map inputPaymentChannelFundSourceMap = new HashMap<>(); /*** * Variable stores all payment types which have already been mapped to * Fund Sources in the system **/ - final Set existingPaymentTypes = new HashSet(); + final Set existingPaymentTypes = new HashSet<>(); if (paymentChannelMappingArray != null && paymentChannelMappingArray.size() > 0) { if (changes != null) { changes.put(LOAN_PRODUCT_ACCOUNTING_PARAMS.PAYMENT_CHANNEL_FUND_SOURCE_MAPPING.getValue(), diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java index 86b674de3..b49e6ea49 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingReadPlatformServiceImpl.java @@ -69,7 +69,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product final String chargeName = rs.getString("chargeName"); final Boolean penalty = rs.getBoolean("penalty"); - final Map loanProductToGLAccountMap = new LinkedHashMap(5); + final Map loanProductToGLAccountMap = new LinkedHashMap<>(5); loanProductToGLAccountMap.put("id", id); loanProductToGLAccountMap.put("glAccountId", glAccountId); loanProductToGLAccountMap.put("productId", productId); @@ -89,7 +89,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product @Override public Map fetchAccountMappingDetailsForLoanProduct(final Long loanProductId, final Integer accountingType) { - final Map accountMappingDetails = new LinkedHashMap(8); + final Map accountMappingDetails = new LinkedHashMap<>(8); final ProductToGLAccountMappingMapper rm = new ProductToGLAccountMappingMapper(); final String sql = "select " + rm.schema() + " and product_id = ? and payment_type is null and mapping.charge_id is null"; @@ -127,7 +127,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.OVERPAYMENT.getValue(), gLAccountData); } else if (glAccountForLoan.equals(CASH_ACCOUNTS_FOR_LOAN.INCOME_FROM_RECOVERY)) { accountMappingDetails.put(LOAN_PRODUCT_ACCOUNTING_DATA_PARAMS.INCOME_FROM_RECOVERY.getValue(), gLAccountData); - } + } } } else if (AccountingRuleType.ACCRUAL_UPFRONT.getValue().equals(accountingType) || AccountingRuleType.ACCRUAL_PERIODIC.getValue().equals(accountingType)) { @@ -175,7 +175,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product @Override public Map fetchAccountMappingDetailsForSavingsProduct(final Long savingsProductId, final Integer accountingType) { - final Map accountMappingDetails = new LinkedHashMap(8); + final Map accountMappingDetails = new LinkedHashMap<>(8); final ProductToGLAccountMappingMapper rm = new ProductToGLAccountMappingMapper(); final String sql = "select " + rm.schema() + " and product_id = ? and payment_type is null and mapping.charge_id is null "; @@ -245,7 +245,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product List paymentTypeToGLAccountMappers = null; for (final Map productToGLAccountMap : paymentTypeToFundSourceMappingsList) { if (paymentTypeToGLAccountMappers == null) { - paymentTypeToGLAccountMappers = new ArrayList(); + paymentTypeToGLAccountMappers = new ArrayList<>(); } final Long paymentTypeId = (Long) productToGLAccountMap.get("paymentTypeId"); final String paymentTypeValue = (String) productToGLAccountMap.get("paymentTypeValue"); @@ -296,7 +296,7 @@ public class ProductToGLAccountMappingReadPlatformServiceImpl implements Product List chargeToGLAccountMappers = null; for (final Map chargeToIncomeAccountMap : chargeToFundSourceMappingsList) { if (chargeToGLAccountMappers == null) { - chargeToGLAccountMappers = new ArrayList(); + chargeToGLAccountMappers = new ArrayList<>(); } final Long glAccountId = (Long) chargeToIncomeAccountMap.get("glAccountId"); final String glAccountName = (String) chargeToIncomeAccountMap.get("glAccountName"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingWritePlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingWritePlatformServiceImpl.java index 35b9ff8bb..4f9e0cd21 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingWritePlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/ProductToGLAccountMappingWritePlatformServiceImpl.java @@ -225,7 +225,7 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc * Variable tracks all accounting mapping properties that have been * updated ***/ - Map changes = new HashMap(); + Map changes = new HashMap<>(); final JsonElement element = this.fromApiJsonHelper.parse(command.json()); final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(accountingRuleTypeId); @@ -256,7 +256,7 @@ public class ProductToGLAccountMappingWritePlatformServiceImpl implements Produc * Variable tracks all accounting mapping properties that have been * updated ***/ - Map changes = new HashMap(); + Map changes = new HashMap<>(); final JsonElement element = this.fromApiJsonHelper.parse(command.json()); final AccountingRuleType accountingRuleType = AccountingRuleType.fromInt(accountingRuleTypeId); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/SavingsProductToGLAccountMappingHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/SavingsProductToGLAccountMappingHelper.java index d97f2e3df..3ddb9464b 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/SavingsProductToGLAccountMappingHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/producttoaccountmapping/service/SavingsProductToGLAccountMappingHelper.java @@ -110,7 +110,7 @@ public class SavingsProductToGLAccountMappingHelper extends ProductToGLAccountMa public Map populateChangesForNewSavingsProductToGLAccountMappingCreation(final JsonElement element, final AccountingRuleType accountingRuleType) { - final Map changes = new HashMap(); + final Map changes = new HashMap<>(); final Long savingsReferenceId = this.fromApiJsonHelper.extractLongNamed( SAVINGS_PRODUCT_ACCOUNTING_PARAMS.SAVINGS_REFERENCE.getValue(), element); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/api/AccountingRuleApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/api/AccountingRuleApiResource.java index 6839dee74..009128e07 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/api/AccountingRuleApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/api/AccountingRuleApiResource.java @@ -55,7 +55,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class AccountingRuleApiResource { - private static final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "officeId", "officeName", + private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "officeId", "officeName", "accountToDebitId", "accountToCreditId", "name", "description", "systemDefined", "allowedCreditTagOptions", "allowedDebitTagOptions", "debitTags", "creditTags", "creditAccounts", "debitAccounts", "allowMultipleCreditEntries", "allowMultipleDebitEntries", "tag")); @@ -232,8 +232,8 @@ public class AccountingRuleApiResource { private Collection retrieveSelectedTags(final Collection allowedTagOptions, final List existedTags) { - final Collection tempOptions = new ArrayList(allowedTagOptions); - final Map selectedTags = new HashMap(); + final Collection tempOptions = new ArrayList<>(allowedTagOptions); + final Map selectedTags = new HashMap<>(); for (final AccountingTagRuleData accountingTagRuleData : existedTags) { for (final CodeValueData codeValueData : tempOptions) { if (codeValueData.getId().equals(accountingTagRuleData.getTag().getId())) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/api/AccountingRuleJsonInputParams.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/api/AccountingRuleJsonInputParams.java index fd3c22573..e2a70233d 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/api/AccountingRuleJsonInputParams.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/api/AccountingRuleJsonInputParams.java @@ -22,7 +22,7 @@ public enum AccountingRuleJsonInputParams { this.value = value; } - private static final Set values = new HashSet(); + private static final Set values = new HashSet<>(); static { for (final AccountingRuleJsonInputParams type : AccountingRuleJsonInputParams.values()) { values.add(type.value); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/domain/AccountingRule.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/domain/AccountingRule.java index 0f2f6e67e..5df4d63e8 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/domain/AccountingRule.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/domain/AccountingRule.java @@ -58,7 +58,7 @@ public class AccountingRule extends AbstractPersistable { @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "accountingRule", orphanRemoval = true) - private final List accountingTagRules = new ArrayList(); + private final List accountingTagRules = new ArrayList<>(); @Column(name = "allow_multiple_credits", nullable = false) private boolean allowMultipleCreditEntries; @@ -94,7 +94,7 @@ public class AccountingRule extends AbstractPersistable { } public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(10); + final Map actualChanges = new LinkedHashMap<>(10); handlePropertyUpdate(command, actualChanges, AccountingRuleJsonInputParams.OFFICE_ID.getValue(), this.office == null ? 0L : this.office.getId()); handlePropertyUpdate(command, actualChanges, AccountingRuleJsonInputParams.ACCOUNT_TO_DEBIT.getValue(), @@ -219,8 +219,8 @@ public class AccountingRule extends AbstractPersistable { } public void updateTags(final JournalEntryType type) { - final Set existedCreditTags = new HashSet(); - final Set existedDebitTags = new HashSet(); + final Set existedCreditTags = new HashSet<>(); + final Set existedDebitTags = new HashSet<>(); for (final AccountingTagRule accountingTagRule : this.accountingTagRules) { if (accountingTagRule.isCreditAccount()) { existedCreditTags.add(accountingTagRule); @@ -238,7 +238,7 @@ public class AccountingRule extends AbstractPersistable { } public Set getAccountingTagRulesByType(final JournalEntryType type) { - final Set existedTags = new HashSet(); + final Set existedTags = new HashSet<>(); for (final AccountingTagRule accountingTagRule : this.accountingTagRules) { if (accountingTagRule.getAccountType().equals(type.getValue())) { existedTags.add(accountingTagRule); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/serialization/AccountingRuleCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/serialization/AccountingRuleCommandFromApiJsonDeserializer.java index fa32cb386..968d264af 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/serialization/AccountingRuleCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/serialization/AccountingRuleCommandFromApiJsonDeserializer.java @@ -47,7 +47,7 @@ public class AccountingRuleCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("AccountingRule"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -149,7 +149,7 @@ public class AccountingRuleCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("AccountingRule"); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java index 57f1b8c07..ee197f5e1 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/service/AccountingRuleReadPlatformServiceImpl.java @@ -76,7 +76,7 @@ public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleRead @Override public Map extractData(final ResultSet rs) throws SQLException, DataAccessException { - final Map extractedData = new HashMap(); + final Map extractedData = new HashMap<>(); while (rs.next()) { final Long id = rs.getLong("id"); @@ -110,7 +110,7 @@ public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleRead creditTags = null; final GLAccountDataForLookup creditAccount = new GLAccountDataForLookup(accountToCreditId, creditAccountName, creditAccountGLCode); - creditAccounts = new ArrayList(Arrays.asList(creditAccount)); + creditAccounts = new ArrayList<>(Arrays.asList(creditAccount)); } if (accountToDebitId == null) { debitTags = !this.isAssociationParametersExists ? getCreditOrDebitTags(id, JournalEntryType.DEBIT.getValue()) @@ -121,7 +121,7 @@ public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleRead debitTags = null; final GLAccountDataForLookup debitAccount = new GLAccountDataForLookup(accountToDebitId, debitAccountName, debitAccountGLCode); - debitAccounts = new ArrayList(Arrays.asList(debitAccount)); + debitAccounts = new ArrayList<>(Arrays.asList(debitAccount)); } accountingRuleData = new AccountingRuleData(id, officeId, officeName, name, description, systemDefined, allowMultipleDebitEntries, allowMultipleCreditEntries, creditTags, debitTags, creditAccounts, debitAccounts); @@ -153,7 +153,7 @@ public class AccountingRuleReadPlatformServiceImpl implements AccountingRuleRead } sql = sql + " order by rule.id asc"; final Map extractedData = this.jdbcTemplate.query(sql, resultSetExtractor, arguments); - return new ArrayList(extractedData.values()); + return new ArrayList<>(extractedData.values()); } @Override diff --git a/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java index 3fbddd9f0..74cb96379 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/accounting/rule/service/AccountingRuleWritePlatformServiceJpaRepositoryImpl.java @@ -112,8 +112,8 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco // get the GL Accounts or tags to Debit and Credit final String[] debitTags = command.arrayValueOfParameterNamed(AccountingRuleJsonInputParams.DEBIT_ACCOUNT_TAGS.getValue()); final String[] creditTags = command.arrayValueOfParameterNamed(AccountingRuleJsonInputParams.CREDIT_ACCOUNT_TAGS.getValue()); - final Set incomingDebitTags = debitTags == null ? new HashSet() : new HashSet(Arrays.asList(debitTags)); - final Set incomingCreditTags = creditTags == null ? new HashSet() : new HashSet(Arrays.asList(creditTags)); + final Set incomingDebitTags = debitTags == null ? new HashSet() : new HashSet<>(Arrays.asList(debitTags)); + final Set incomingCreditTags = creditTags == null ? new HashSet() : new HashSet<>(Arrays.asList(creditTags)); final Long accountToDebitId = command.longValueOfParameterNamed(AccountingRuleJsonInputParams.ACCOUNT_TO_DEBIT.getValue()); final Long accountToCreditId = command.longValueOfParameterNamed(AccountingRuleJsonInputParams.ACCOUNT_TO_CREDIT.getValue()); @@ -121,7 +121,7 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco boolean allowMultipleDebitEntries = false; GLAccount debitAccount = null; GLAccount creditAccount = null; - List accountingTagRules = new ArrayList(); + List accountingTagRules = new ArrayList<>(); if ((accountToDebitId != null && debitTags != null) || (accountToDebitId == null && debitTags == null)) { throw new AccountingRuleDataException(AccountingRuleJsonInputParams.ACCOUNT_TO_DEBIT.getValue(), @@ -226,7 +226,7 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco accountingRule); if (!creditTagsToAdd.isEmpty()) { - List accountingTagRules = new ArrayList(); + List accountingTagRules = new ArrayList<>(); accountingTagRules = saveDebitOrCreditTags(creditTagsToAdd, JournalEntryType.CREDIT, accountingTagRules); accountingRule.updateAccountingRuleForTags(accountingTagRules); accountingRule.updateCreditAccount(null); @@ -243,7 +243,7 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco final Set debitTagsToAdd = determineCreditTagToAddAndRemoveOldTags(debitTags, JournalEntryType.DEBIT, accountingRule); if (!debitTagsToAdd.isEmpty()) { - List accountingTagRules = new ArrayList(); + List accountingTagRules = new ArrayList<>(); accountingTagRules = saveDebitOrCreditTags(debitTagsToAdd, JournalEntryType.DEBIT, accountingTagRules); accountingRule.updateAccountingRuleForTags(accountingTagRules); accountingRule.updateDebitAccount(null); @@ -276,12 +276,12 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco private Set determineCreditTagToAddAndRemoveOldTags(final String[] creditOrDebitTags, final JournalEntryType type, final AccountingRule accountingRule) { - final Set incomingTags = new HashSet(Arrays.asList(creditOrDebitTags)); + final Set incomingTags = new HashSet<>(Arrays.asList(creditOrDebitTags)); final Set existingTags = accountingRule.getAccountingTagRulesByType(type); final Set existingTagIds = retrieveExistingTagIds(existingTags); - final Set tagsToAdd = new HashSet(); + final Set tagsToAdd = new HashSet<>(); final Set tagsToRemove = existingTagIds; - final Map accountsToRemove = new HashMap(); + final Map accountsToRemove = new HashMap<>(); for (final String tagId : incomingTags) { if (existingTagIds.contains(tagId)) { @@ -299,13 +299,13 @@ public class AccountingRuleWritePlatformServiceJpaRepositoryImpl implements Acco } } } - accountingRule.removeOldTags(new ArrayList(accountsToRemove.values())); + accountingRule.removeOldTags(new ArrayList<>(accountsToRemove.values())); } return tagsToAdd; } private Set retrieveExistingTagIds(final Set existingCreditTags) { - final Set existingCreditTagIds = new HashSet(); + final Set existingCreditTagIds = new HashSet<>(); for (final AccountingTagRule accountingTagRule : existingCreditTags) { existingCreditTagIds.add(accountingTagRule.getTagId().toString()); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/api/AuditsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/api/AuditsApiResource.java index b7c952138..47af95738 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/api/AuditsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/api/AuditsApiResource.java @@ -40,7 +40,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class AuditsApiResource { - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "actionName", "entityName", "resourceId", + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "actionName", "entityName", "resourceId", "subresourceId", "maker", "madeOnDate", "checker", "checkedOnDate", "processingResult", "commandAsJson", "officeName", "groupLevelName", "groupName", "clientName", "loanAccountNo", "savingsAccountNo", "clientId", "loanId", "url")); @@ -123,7 +123,7 @@ public class AuditsApiResource { final AuditSearchData auditSearchData = this.auditReadPlatformService.retrieveSearchTemplate("audit"); - final Set RESPONSE_DATA_PARAMETERS_SEARCH_TEMPLATE = new HashSet(Arrays.asList("appUsers", "actionNames", + final Set RESPONSE_DATA_PARAMETERS_SEARCH_TEMPLATE = new HashSet<>(Arrays.asList("appUsers", "actionNames", "entityNames", "processingResults")); return this.toApiJsonSerializerSearchTemplate.serialize(settings, auditSearchData, RESPONSE_DATA_PARAMETERS_SEARCH_TEMPLATE); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/api/MakercheckersApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/api/MakercheckersApiResource.java index ef3a699cd..0682df96c 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/api/MakercheckersApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/api/MakercheckersApiResource.java @@ -42,7 +42,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class MakercheckersApiResource { - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "actionName", "entityName", "resourceId", + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "actionName", "entityName", "resourceId", "subresourceId", "maker", "madeOnDate", "checker", "checkedOnDate", "processingResult", "commandAsJson", "officeName", "groupLevelName", "groupName", "clientName", "loanAccountNo", "savingsAccountNo", "clientId", "loanId")); @@ -95,7 +95,7 @@ public class MakercheckersApiResource { final AuditSearchData auditSearchData = this.readPlatformService.retrieveSearchTemplate("makerchecker"); - final Set RESPONSE_DATA_PARAMETERS_SEARCH_TEMPLATE = new HashSet(Arrays.asList("appUsers", "actionNames", + final Set RESPONSE_DATA_PARAMETERS_SEARCH_TEMPLATE = new HashSet<>(Arrays.asList("appUsers", "actionNames", "entityNames")); return this.toApiJsonSerializerSearchTemplate.serialize(settings, auditSearchData, RESPONSE_DATA_PARAMETERS_SEARCH_TEMPLATE); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/AuditReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/AuditReadPlatformServiceImpl.java index 769cf2dcd..2965450df 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/commands/service/AuditReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/commands/service/AuditReadPlatformServiceImpl.java @@ -62,9 +62,9 @@ import com.google.gson.JsonObject; public class AuditReadPlatformServiceImpl implements AuditReadPlatformService { private final static Logger logger = LoggerFactory.getLogger(AuditReadPlatformServiceImpl.class); - private final static Set supportedOrderByValues = new HashSet(Arrays.asList("id", "actionName", "entityName", - "resourceId", "subresourceId", "madeOnDate", "checkedOnDate", "officeName", "groupName", "clientName", "loanAccountNo", - "savingsAccountNo", "clientId", "loanId")); + private final static Set supportedOrderByValues = new HashSet<>(Arrays.asList("id", "actionName", "entityName", "resourceId", + "subresourceId", "madeOnDate", "checkedOnDate", "officeName", "groupName", "clientName", "loanAccountNo", "savingsAccountNo", + "clientId", "loanId")); private final JdbcTemplate jdbcTemplate; private final PlatformSecurityContext context; @@ -74,7 +74,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService { private final ClientReadPlatformService clientReadPlatformService; private final LoanProductReadPlatformService loanProductReadPlatformService; private final StaffReadPlatformService staffReadPlatformService; - private final PaginationHelper paginationHelper = new PaginationHelper(); + private final PaginationHelper paginationHelper = new PaginationHelper<>(); private final PaginationParametersDataValidator paginationParametersDataValidator; private final SavingsProductReadPlatformService savingsProductReadPlatformService; private final DepositProductReadPlatformService depositProductReadPlatformService; @@ -377,7 +377,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService { private void updateEnumerations(Map commandAsJsonMap, JsonObject auditObject, String entityName) { if (entityName.equalsIgnoreCase("LOAN") || entityName.equalsIgnoreCase("LOANPRODUCT")) { - + final String[] enumTypes = { "loanTermFrequencyType", "termFrequencyType", "repaymentFrequencyType", "amortizationType", "interestType", "interestCalculationPeriodType", "interestRateFrequencyType", "accountingRule" }; @@ -394,7 +394,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService { } } } - + } else if (entityName.equalsIgnoreCase("SAVINGSPRODUCT") || entityName.equalsIgnoreCase("SAVINGSACCOUNT") || entityName.equalsIgnoreCase("RECURRINGDEPOSITPRODUCT") || entityName.equalsIgnoreCase("RECURRINGDEPOSITACCOUNT") || entityName.equalsIgnoreCase("FIXEDDEPOSITPRODUCT") || entityName.equalsIgnoreCase("FIXEDDEPOSITACCOUNT")) { @@ -416,7 +416,7 @@ public class AuditReadPlatformServiceImpl implements AuditReadPlatformService { } } } - } + } } } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/CacheApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/CacheApiConstants.java index 361c6c6d5..4e5a28579 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/CacheApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/CacheApiConstants.java @@ -8,6 +8,6 @@ public class CacheApiConstants { public static final String RESOURCE_NAME = "CACHE"; public static final String cacheTypeParameter = "cacheType"; - public static final Set REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(cacheTypeParameter)); + public static final Set REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(cacheTypeParameter)); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/api/CacheApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/api/CacheApiResource.java index 8d6b2729b..136d2c109 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/api/CacheApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/api/CacheApiResource.java @@ -41,7 +41,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class CacheApiResource { - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id")); + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id")); private final String resourceNameForPermissions = "CACHE"; private final PlatformSecurityContext context; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/command/UpdateCacheCommandHandler.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/command/UpdateCacheCommandHandler.java index e8b6db91f..b862767ee 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/command/UpdateCacheCommandHandler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/command/UpdateCacheCommandHandler.java @@ -49,7 +49,7 @@ public class UpdateCacheCommandHandler implements NewCommandSourceHandler { final Type typeOfMap = new TypeToken>() {}.getType(); command.checkForUnsupportedParameters(typeOfMap, json, CacheApiConstants.REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(CacheApiConstants.RESOURCE_NAME.toLowerCase()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/domain/CacheType.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/domain/CacheType.java index 2986b0cb7..425001edc 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/domain/CacheType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/domain/CacheType.java @@ -18,7 +18,7 @@ public enum CacheType { private final Integer value; private final String code; - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); static { for (final CacheType type : CacheType.values()) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/service/RuntimeDelegatingCacheManager.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/service/RuntimeDelegatingCacheManager.java index 97c457eda..4de26fffb 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/service/RuntimeDelegatingCacheManager.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/cache/service/RuntimeDelegatingCacheManager.java @@ -71,7 +71,7 @@ public class RuntimeDelegatingCacheManager implements CacheManager { public Map switchToCache(final boolean ehcacheEnabled, final CacheType toCacheType) { - final Map changes = new HashMap(); + final Map changes = new HashMap<>(); final boolean noCacheEnabled = !ehcacheEnabled; final boolean distributedCacheEnabled = !ehcacheEnabled; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/CodeConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/CodeConstants.java index 91b24d4ba..b9b3d13ff 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/CodeConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/CodeConstants.java @@ -23,7 +23,7 @@ public class CodeConstants { this.value = value; } - private static final Set values = new HashSet(); + private static final Set values = new HashSet<>(); static { for (final CODEVALUE_JSON_INPUT_PARAMS type : CODEVALUE_JSON_INPUT_PARAMS.values()) { values.add(type.value); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/api/CodeValuesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/api/CodeValuesApiResource.java index ec7c06779..1873fe824 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/api/CodeValuesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/api/CodeValuesApiResource.java @@ -45,7 +45,7 @@ public class CodeValuesApiResource { /** * The set of parameters that are supported in response for {@link CodeData} */ - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "name", "position")); + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "position")); private final String resourceNameForPermissions = "CODEVALUE"; private final PlatformSecurityContext context; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/api/CodesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/api/CodesApiResource.java index f5393703c..dca805e46 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/api/CodesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/api/CodesApiResource.java @@ -44,7 +44,7 @@ public class CodesApiResource { /** * The set of parameters that are supported in response for {@link CodeData} */ - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "name", "systemDefined")); + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "systemDefined")); private final String resourceNameForPermissions = "CODE"; private final PlatformSecurityContext context; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/domain/Code.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/domain/Code.java index 932f33aa7..01f68f974 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/domain/Code.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/domain/Code.java @@ -61,7 +61,7 @@ public class Code extends AbstractPersistable { if (this.systemDefined) { throw new SystemDefinedCodeCannotBeChangedException(); } - final Map actualChanges = new LinkedHashMap(1); + final Map actualChanges = new LinkedHashMap<>(1); final String firstnameParamName = "name"; if (command.isChangeInStringParameterNamed(firstnameParamName, this.name)) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/domain/CodeValue.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/domain/CodeValue.java index ab0586096..f128bbc8a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/domain/CodeValue.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/domain/CodeValue.java @@ -69,7 +69,7 @@ public class CodeValue extends AbstractPersistable { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(2); + final Map actualChanges = new LinkedHashMap<>(2); final String labelParamName = CODEVALUE_JSON_INPUT_PARAMS.NAME.getValue(); if (command.isChangeInStringParameterNamed(labelParamName, this.label)) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/serialization/CodeCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/serialization/CodeCommandFromApiJsonDeserializer.java index 7be885df1..6b6041a69 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/serialization/CodeCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/serialization/CodeCommandFromApiJsonDeserializer.java @@ -34,7 +34,7 @@ public final class CodeCommandFromApiJsonDeserializer { /** * The parameters supported for this command. */ - private final Set supportedParameters = new HashSet(Arrays.asList("name")); + private final Set supportedParameters = new HashSet<>(Arrays.asList("name")); private final FromJsonHelper fromApiJsonHelper; @Autowired @@ -48,7 +48,7 @@ public final class CodeCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("code"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -65,7 +65,7 @@ public final class CodeCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("code"); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/serialization/CodeValueCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/serialization/CodeValueCommandFromApiJsonDeserializer.java index afad9dac6..d134dda4d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/serialization/CodeValueCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/codes/serialization/CodeValueCommandFromApiJsonDeserializer.java @@ -47,7 +47,7 @@ public final class CodeValueCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("code.value"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -69,7 +69,7 @@ public final class CodeValueCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("code.value"); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/api/GlobalConfigurationApiConstant.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/api/GlobalConfigurationApiConstant.java index 1e07995d8..5f662ed6e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/api/GlobalConfigurationApiConstant.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/api/GlobalConfigurationApiConstant.java @@ -11,6 +11,6 @@ public class GlobalConfigurationApiConstant { public static final String ID = "id"; public static final String CONFIGURATION_RESOURCE_NAME = "globalConfiguration"; - public static final Set UPDATE_CONFIGURATION_DATA_PARAMETERS = new HashSet(Arrays.asList(ENABLED, VALUE)); + public static final Set UPDATE_CONFIGURATION_DATA_PARAMETERS = new HashSet<>(Arrays.asList(ENABLED, VALUE)); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/api/GlobalConfigurationApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/api/GlobalConfigurationApiResource.java index 7dcf00c56..b69f784b5 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/api/GlobalConfigurationApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/api/GlobalConfigurationApiResource.java @@ -34,7 +34,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class GlobalConfigurationApiResource { - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("globalConfiguration")); + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("globalConfiguration")); private final String resourceNameForPermissions = "CONFIGURATION"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/data/GlobalConfigurationDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/data/GlobalConfigurationDataValidator.java index b8cd3e452..85412a915 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/data/GlobalConfigurationDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/data/GlobalConfigurationDataValidator.java @@ -40,7 +40,7 @@ public class GlobalConfigurationDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_CONFIGURATION_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(CONFIGURATION_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/domain/GlobalConfigurationProperty.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/domain/GlobalConfigurationProperty.java index cb0b75b0b..dce9c075a 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/domain/GlobalConfigurationProperty.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/domain/GlobalConfigurationProperty.java @@ -56,7 +56,7 @@ public class GlobalConfigurationProperty extends AbstractPersistable { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(7); + final Map actualChanges = new LinkedHashMap<>(7); final String enabledParamName = "enabled"; if (command.isChangeInBooleanParameterNamed(enabledParamName, this.enabled)) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/serialization/GlobalConfigurationCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/serialization/GlobalConfigurationCommandFromApiJsonDeserializer.java index bf946e701..a18cb2668 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/serialization/GlobalConfigurationCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/configuration/serialization/GlobalConfigurationCommandFromApiJsonDeserializer.java @@ -33,7 +33,7 @@ public final class GlobalConfigurationCommandFromApiJsonDeserializer extends /** * The parameters supported for this command. */ - private final Set supportedParameters = new HashSet(Arrays.asList("globalConfiguration")); + private final Set supportedParameters = new HashSet<>(Arrays.asList("globalConfiguration")); private final FromJsonHelper fromApiJsonHelper; @Autowired diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/ApiParameterHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/ApiParameterHelper.java index 191abb7cf..b64e6fa81 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/ApiParameterHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/api/ApiParameterHelper.java @@ -32,24 +32,24 @@ public class ApiParameterHelper { } public static Set extractFieldsForResponseIfProvided(final MultivaluedMap queryParams) { - Set fields = new HashSet(); + Set fields = new HashSet<>(); String commaSerperatedParameters = ""; if (queryParams.getFirst("fields") != null) { commaSerperatedParameters = queryParams.getFirst("fields"); if (StringUtils.isNotBlank(commaSerperatedParameters)) { - fields = new HashSet(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*"))); + fields = new HashSet<>(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*"))); } } return fields; } public static Set extractAssociationsForResponseIfProvided(final MultivaluedMap queryParams) { - Set fields = new HashSet(); + Set fields = new HashSet<>(); String commaSerperatedParameters = ""; if (queryParams.getFirst("associations") != null) { commaSerperatedParameters = queryParams.getFirst("associations"); if (StringUtils.isNotBlank(commaSerperatedParameters)) { - fields = new HashSet(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*"))); + fields = new HashSet<>(Arrays.asList(commaSerperatedParameters.split("\\s*,\\s*"))); } } return fields; @@ -148,7 +148,7 @@ public class ApiParameterHelper { public static Map asMap(final MultivaluedMap queryParameters) { - final Map map = new HashMap(queryParameters.size()); + final Map map = new HashMap<>(queryParameters.size()); for (final String parameterName : queryParameters.keySet()) { final List values = queryParameters.get(parameterName); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/ApiGlobalErrorResponse.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/ApiGlobalErrorResponse.java index faacb05e1..f5e2012ed 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/ApiGlobalErrorResponse.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/ApiGlobalErrorResponse.java @@ -44,7 +44,7 @@ public class ApiGlobalErrorResponse { * they be needed. Typically used to express data validation errors with * parameters passed to API. */ - private List errors = new ArrayList(); + private List errors = new ArrayList<>(); public static ApiGlobalErrorResponse unAuthenticated() { @@ -76,7 +76,7 @@ public class ApiGlobalErrorResponse { globalErrorResponse.setUserMessageGlobalisationCode("error.msg.not.authorized"); globalErrorResponse.setDefaultUserMessage("Insufficient privileges to perform this action."); - final List errors = new ArrayList(); + final List errors = new ArrayList<>(); errors.add(ApiParameterError.generalError("error.msg.not.authorized", defaultUserMessage)); globalErrorResponse.setErrors(errors); @@ -91,7 +91,7 @@ public class ApiGlobalErrorResponse { globalErrorResponse.setUserMessageGlobalisationCode("validation.msg.domain.rule.violation"); globalErrorResponse.setDefaultUserMessage("Errors contain reason for domain rule violation."); - final List errors = new ArrayList(); + final List errors = new ArrayList<>(); errors.add(ApiParameterError.generalError(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs)); globalErrorResponse.setErrors(errors); @@ -107,7 +107,7 @@ public class ApiGlobalErrorResponse { globalErrorResponse.setUserMessageGlobalisationCode("error.msg.resource.not.found"); globalErrorResponse.setDefaultUserMessage("The requested resource is not available."); - final List errors = new ArrayList(); + final List errors = new ArrayList<>(); errors.add(ApiParameterError.resourceIdentifierNotFound(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs)); globalErrorResponse.setErrors(errors); @@ -123,7 +123,7 @@ public class ApiGlobalErrorResponse { globalErrorResponse.setUserMessageGlobalisationCode(globalisationMessageCode); globalErrorResponse.setDefaultUserMessage(defaultUserMessage); - final List errors = new ArrayList(); + final List errors = new ArrayList<>(); errors.add(ApiParameterError.parameterError(globalisationMessageCode, defaultUserMessage, parameterName, defaultUserMessageArgs)); globalErrorResponse.setErrors(errors); @@ -154,7 +154,7 @@ public class ApiGlobalErrorResponse { globalErrorResponse.setUserMessageGlobalisationCode("error.msg.platform.server.side.error"); globalErrorResponse.setDefaultUserMessage("An unexpected error occured on the platform server."); - final List errors = new ArrayList(); + final List errors = new ArrayList<>(); errors.add(ApiParameterError.generalError(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs)); globalErrorResponse.setErrors(errors); @@ -170,7 +170,7 @@ public class ApiGlobalErrorResponse { globalErrorResponse.setUserMessageGlobalisationCode("error.msg.platform.service.unavailable"); globalErrorResponse.setDefaultUserMessage("The server is currently unable to handle the request , please try after some time."); - final List errors = new ArrayList(); + final List errors = new ArrayList<>(); errors.add(ApiParameterError.generalError(globalisationMessageCode, defaultUserMessage, defaultUserMessageArgs)); globalErrorResponse.setErrors(errors); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/ApiParameterError.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/ApiParameterError.java index 905043376..8e1815425 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/ApiParameterError.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/ApiParameterError.java @@ -42,7 +42,7 @@ public class ApiParameterError { /** * Arguments related to the user error message. */ - private List args = new ArrayList(); + private List args = new ArrayList<>(); public static ApiParameterError generalError(final String globalisationMessageCode, final String defaultUserMessage, final Object... defaultUserMessageArgs) { @@ -70,7 +70,7 @@ public class ApiParameterError { this.developerMessage = defaultUserMessage; this.defaultUserMessage = defaultUserMessage; - final List messageArgs = new ArrayList(); + final List messageArgs = new ArrayList<>(); if (defaultUserMessageArgs != null) { for (final Object object : defaultUserMessageArgs) { messageArgs.add(ApiErrorMessageArg.from(object)); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/CommandProcessingResult.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/CommandProcessingResult.java index c394c0de8..4677264ed 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/CommandProcessingResult.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/CommandProcessingResult.java @@ -81,7 +81,7 @@ public class CommandProcessingResult { this.loanId = null; this.savingsId = null; this.transactionId = null; - this.changes = new HashMap(); + this.changes = new HashMap<>(); this.productId = null; this.subResourceId = null; } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/PaginationParametersDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/PaginationParametersDataValidator.java index 4bab152f3..482d10134 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/PaginationParametersDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/data/PaginationParametersDataValidator.java @@ -17,11 +17,11 @@ import org.springframework.stereotype.Component; @Component public class PaginationParametersDataValidator { - public static Set sortOrderValues = new HashSet(Arrays.asList("ASC", "DESC")); + public static Set sortOrderValues = new HashSet<>(Arrays.asList("ASC", "DESC")); public void validateParameterValues(PaginationParameters parameters, final Set supportedOrdeByValues, final String resourceName) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); if (parameters.isOrderByRequested() && !supportedOrdeByValues.contains(parameters.getOrderBy())) { final String defaultUserMessage = "The orderBy value '" + parameters.getOrderBy() diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/exceptionmapper/UnrecognizedQueryParamExceptionMapper.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/exceptionmapper/UnrecognizedQueryParamExceptionMapper.java index b94c7824a..8ad63a2c7 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/exceptionmapper/UnrecognizedQueryParamExceptionMapper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/exceptionmapper/UnrecognizedQueryParamExceptionMapper.java @@ -47,7 +47,7 @@ public class UnrecognizedQueryParamExceptionMapper implements ExceptionMapper errors = new ArrayList(); + final List errors = new ArrayList<>(); errors.add(error); final ApiGlobalErrorResponse invalidParameterError = ApiGlobalErrorResponse.badClientRequest( diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/exceptionmapper/UnsupportedCommandExceptionMapper.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/exceptionmapper/UnsupportedCommandExceptionMapper.java index d7ce4cc7b..5db5348ba 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/exceptionmapper/UnsupportedCommandExceptionMapper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/exceptionmapper/UnsupportedCommandExceptionMapper.java @@ -32,7 +32,7 @@ public class UnsupportedCommandExceptionMapper implements ExceptionMapper errors = new ArrayList(); + final List errors = new ArrayList<>(); final StringBuilder validationErrorCode = new StringBuilder("error.msg.command.unsupported"); final StringBuilder defaultEnglishMessage = new StringBuilder("The command ").append(exception.getUnsupportedCommandName()).append( diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/exceptionmapper/UnsupportedParameterExceptionMapper.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/exceptionmapper/UnsupportedParameterExceptionMapper.java index b4bf54d33..f7747ec66 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/exceptionmapper/UnsupportedParameterExceptionMapper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/exceptionmapper/UnsupportedParameterExceptionMapper.java @@ -32,7 +32,7 @@ public class UnsupportedParameterExceptionMapper implements ExceptionMapper errors = new ArrayList(); + final List errors = new ArrayList<>(); for (final String parameterName : exception.getUnsupportedParameters()) { final StringBuilder validationErrorCode = new StringBuilder("error.msg.parameter.unsupported"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/DatatableCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/DatatableCommandFromApiJsonDeserializer.java index 1d43f2dfc..fbe8adeaa 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/DatatableCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/DatatableCommandFromApiJsonDeserializer.java @@ -34,17 +34,17 @@ public class DatatableCommandFromApiJsonDeserializer { /** * The parameters supported for this command. */ - private final Set supportedParametersForCreate = new HashSet(Arrays.asList("datatableName", "apptableName", "multiRow", + private final Set supportedParametersForCreate = new HashSet<>(Arrays.asList("datatableName", "apptableName", "multiRow", "columns")); - private final Set supportedParametersForCreateColumns = new HashSet(Arrays.asList("name", "type", "length", + private final Set supportedParametersForCreateColumns = new HashSet<>(Arrays.asList("name", "type", "length", "mandatory", "code")); - private final Set supportedParametersForUpdate = new HashSet(Arrays.asList("apptableName", "changeColumns", + private final Set supportedParametersForUpdate = new HashSet<>(Arrays.asList("apptableName", "changeColumns", "addColumns", "dropColumns")); - private final Set supportedParametersForAddColumns = new HashSet(Arrays.asList("name", "type", "length", "mandatory", + private final Set supportedParametersForAddColumns = new HashSet<>(Arrays.asList("name", "type", "length", "mandatory", "after", "code")); - private final Set supportedParametersForChangeColumns = new HashSet(Arrays.asList("name", "newName", "length", + private final Set supportedParametersForChangeColumns = new HashSet<>(Arrays.asList("name", "newName", "length", "mandatory", "after", "code", "newCode")); - private final Set supportedParametersForDropColumns = new HashSet(Arrays.asList("name")); + private final Set supportedParametersForDropColumns = new HashSet<>(Arrays.asList("name")); private final Object[] supportedColumnTypes = { "string", "number", "decimal", "date", "text", "dropdown" }; private final Object[] supportedApptableNames = { "m_loan", "m_savings_account", "m_client", "m_group", "m_center", "m_office", "m_savings_product", "m_product_loan" }; @@ -97,7 +97,7 @@ public class DatatableCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParametersForCreate); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("datatable"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -147,7 +147,7 @@ public class DatatableCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParametersForUpdate); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("datatable"); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/FromJsonHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/FromJsonHelper.java index dfdfbb825..7d35adc8f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/FromJsonHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/FromJsonHelper.java @@ -73,7 +73,7 @@ public class FromJsonHelper { final Map requestMap = this.gsonConverter.fromJson(json, typeOfMap); - final List unsupportedParameterList = new ArrayList(); + final List unsupportedParameterList = new ArrayList<>(); for (final String providedParameter : requestMap.keySet()) { if (!supportedParams.contains(providedParameter)) { unsupportedParameterList.add(providedParameter); @@ -87,7 +87,7 @@ public class FromJsonHelper { if (object == null) { throw new InvalidParameterException(); } final Set> entries = object.entrySet(); - final List unsupportedParameterList = new ArrayList(); + final List unsupportedParameterList = new ArrayList<>(); for (final Entry providedParameter : entries) { if (!supportedParams.contains(providedParameter.getKey())) { @@ -227,8 +227,8 @@ public class FromJsonHelper { return this.helperDelegator.extractMonthDayFormatParameter(element); } - public Gson getGsonConverter() { - return this.gsonConverter; - } - + public Gson getGsonConverter() { + return this.gsonConverter; + } + } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/GoogleGsonSerializerHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/GoogleGsonSerializerHelper.java index fc365de9a..ee3c92f94 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/GoogleGsonSerializerHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/GoogleGsonSerializerHelper.java @@ -58,16 +58,16 @@ public final class GoogleGsonSerializerHelper { public Gson createGsonBuilderWithParameterExclusionSerializationStrategy(final Set supportedParameters, final boolean prettyPrint, final Set responseParameters) { - final Set parameterNamesToSkip = new HashSet(); + final Set parameterNamesToSkip = new HashSet<>(); if (!responseParameters.isEmpty()) { // strip out all known support parameters from expected response to // see if unsupported parameters requested for response. - final Set differentParametersDetectedSet = new HashSet(responseParameters); + final Set differentParametersDetectedSet = new HashSet<>(responseParameters); differentParametersDetectedSet.removeAll(supportedParameters); - if (!differentParametersDetectedSet.isEmpty()) { throw new UnsupportedParameterException(new ArrayList( + if (!differentParametersDetectedSet.isEmpty()) { throw new UnsupportedParameterException(new ArrayList<>( differentParametersDetectedSet)); } parameterNamesToSkip.addAll(supportedParameters); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/JsonParserHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/JsonParserHelper.java index 407526c34..32bc4b9fc 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/JsonParserHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/serialization/JsonParserHelper.java @@ -298,7 +298,7 @@ public class JsonParserHelper { final DateTimeFormatter formatter = DateTimeFormat.forPattern(dateFormat).withLocale(clientApplicationLocale); value = MonthDay.parse(valueAsString.toLowerCase(clientApplicationLocale), formatter); } catch (final IllegalArgumentException e) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.month.day", "The parameter " + parameterName + " is invalid based on the monthDayFormat: '" + dateFormat + "' and locale: '" + clientApplicationLocale + "' provided:", parameterName, valueAsString, @@ -356,7 +356,7 @@ public class JsonParserHelper { if (StringUtils.isBlank(dateFormat) || clientApplicationLocale == null) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); if (StringUtils.isBlank(dateFormat)) { final String defaultMessage = new StringBuilder("The parameter '" + parameterName + "' requires a 'dateFormat' parameter to be passed with it.").toString(); @@ -382,7 +382,7 @@ public class JsonParserHelper { eventLocalDate = DateTimeFormat.forPattern(dateFormat).withLocale(clientApplicationLocale) .parseLocalDate(dateAsString.toLowerCase(clientApplicationLocale)); } catch (final IllegalArgumentException e) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.date.format", "The parameter " + parameterName + " is invalid based on the dateFormat: '" + dateFormat + "' and locale: '" + clientApplicationLocale + "' provided:", parameterName, dateAsString, dateFormat); @@ -400,7 +400,7 @@ public class JsonParserHelper { if (clientApplicationLocale == null) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final String defaultMessage = new StringBuilder("The parameter '" + parameterName + "' requires a 'locale' parameter to be passed with it.").toString(); final ApiParameterError error = ApiParameterError.parameterError("validation.msg.missing.locale.parameter", defaultMessage, @@ -445,7 +445,7 @@ public class JsonParserHelper { return number; } catch (final ParseException e) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.integer.format", "The parameter " + parameterName + " has value: " + numericalValueFormatted + " which is invalid integer value for provided locale of [" + clientApplicationLocale.toString() + "].", parameterName, numericalValueFormatted, clientApplicationLocale); @@ -469,7 +469,7 @@ public class JsonParserHelper { return number; } catch (final NumberFormatException e) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.integer", "The parameter " + parameterName + " has value: " + numericalValueFormatted + " which is invalid integer.", parameterName, numericalValueFormatted); @@ -485,7 +485,7 @@ public class JsonParserHelper { if (clientApplicationLocale == null) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final String defaultMessage = new StringBuilder("The parameter '" + parameterName + "' requires a 'locale' parameter to be passed with it.").toString(); final ApiParameterError error = ApiParameterError.parameterError("validation.msg.missing.locale.parameter", defaultMessage, @@ -524,7 +524,7 @@ public class JsonParserHelper { return number; } catch (final ParseException e) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.decimal.format", "The parameter " + parameterName + " has value: " + numericalValueFormatted + " which is invalid decimal value for provided locale of [" + clientApplicationLocale.toString() + "].", parameterName, numericalValueFormatted, clientApplicationLocale); @@ -540,7 +540,7 @@ public class JsonParserHelper { public static Locale localeFromString(final String localeAsString) { if (StringUtils.isBlank(localeAsString)) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.locale.format", "The parameter locale is invalid. It cannot be blank.", "locale"); dataValidationErrors.add(error); @@ -575,7 +575,7 @@ public class JsonParserHelper { private static Locale localeFrom(final String languageCode, final String courntryCode, final String variantCode) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final List allowedLanguages = Arrays.asList(Locale.getISOLanguages()); if (!allowedLanguages.contains(languageCode.toLowerCase())) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/DateUtils.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/DateUtils.java index aec12e287..ca7a9801c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/DateUtils.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/DateUtils.java @@ -49,7 +49,7 @@ public class DateUtils { final DateTime dateTime = dateStringFormat.parseDateTime(stringDate); return dateTime.toLocalDate(); } catch (final IllegalArgumentException e) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final ApiParameterError error = ApiParameterError.parameterError("validation.msg.invalid.date.pattern", "The parameter date (" + stringDate + ") is invalid w.r.t. pattern " + pattern, "date", stringDate, pattern); dataValidationErrors.add(error); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/PaginationHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/PaginationHelper.java index 1464108f2..b24df1567 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/PaginationHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/PaginationHelper.java @@ -20,6 +20,6 @@ public class PaginationHelper { // determine how many rows are available final int totalFilteredRecords = jt.queryForInt(sqlCountRows); - return new Page(items, totalFilteredRecords); + return new Page<>(items, totalFilteredRecords); } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/ThreadLocalContextUtil.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/ThreadLocalContextUtil.java index 5b347fa92..6a90141a2 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/ThreadLocalContextUtil.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/ThreadLocalContextUtil.java @@ -15,9 +15,9 @@ public class ThreadLocalContextUtil { public static final String CONTEXT_TENANTS = "tenants"; - private static final ThreadLocal contextHolder = new ThreadLocal(); + private static final ThreadLocal contextHolder = new ThreadLocal<>(); - private static final ThreadLocal tenantcontext = new ThreadLocal(); + private static final ThreadLocal tenantcontext = new ThreadLocal<>(); public static void setTenant(final MifosPlatformTenant tenant) { Assert.notNull(tenant, "tenant cannot be null"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TomcatJdbcDataSourcePerTenantService.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TomcatJdbcDataSourcePerTenantService.java index 8b020ba82..c6de3bd8f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TomcatJdbcDataSourcePerTenantService.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/core/service/TomcatJdbcDataSourcePerTenantService.java @@ -28,7 +28,7 @@ import org.springframework.stereotype.Service; @Service public class TomcatJdbcDataSourcePerTenantService implements RoutingDataSourceService { - private final Map tenantToDataSourceMap = new HashMap(1); + private final Map tenantToDataSourceMap = new HashMap<>(1); private final DataSource tenantDataSource; @Autowired @@ -88,13 +88,13 @@ public class TomcatJdbcDataSourcePerTenantService implements RoutingDataSourceSe * Vishwas- Do we need to enable the below properties and add * ResetAbandonedTimer for long running batch Jobs? **/ - //poolConfiguration.setMaxActive(tenant.getMaxActive()); - //poolConfiguration.setMinIdle(tenant.getMinIdle()); - //poolConfiguration.setMaxIdle(tenant.getMaxIdle()); + // poolConfiguration.setMaxActive(tenant.getMaxActive()); + // poolConfiguration.setMinIdle(tenant.getMinIdle()); + // poolConfiguration.setMaxIdle(tenant.getMaxIdle()); - //poolConfiguration.setSuspectTimeout(tenant.getSuspectTimeout()); - //poolConfiguration.setTimeBetweenEvictionRunsMillis(tenant.getTimeBetweenEvictionRunsMillis()); - //poolConfiguration.setMinEvictableIdleTimeMillis(tenant.getMinEvictableIdleTimeMillis()); + // poolConfiguration.setSuspectTimeout(tenant.getSuspectTimeout()); + // poolConfiguration.setTimeBetweenEvictionRunsMillis(tenant.getTimeBetweenEvictionRunsMillis()); + // poolConfiguration.setMinEvictableIdleTimeMillis(tenant.getMinEvictableIdleTimeMillis()); poolConfiguration.setJdbcInterceptors("org.apache.tomcat.jdbc.pool.interceptor.ConnectionState;" + "org.apache.tomcat.jdbc.pool.interceptor.StatementFinalizer;org.apache.tomcat.jdbc.pool.interceptor.SlowQueryReport"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/DataTableApiConstant.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/DataTableApiConstant.java index 7abcd71c4..2ec8b7fa0 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/DataTableApiConstant.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/DataTableApiConstant.java @@ -14,7 +14,7 @@ public class DataTableApiConstant { public static final String categoryParamName ="category"; public static final String localParamName = "locale"; - public static final Set REGISTER_PARAMS = new HashSet(Arrays.asList(categoryParamName,localParamName)); + public static final Set REGISTER_PARAMS = new HashSet<>(Arrays.asList(categoryParamName,localParamName)); public static final String DATATABLE_RESOURCE_NAME ="dataTables"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/ReportsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/ReportsApiResource.java index 7419f5047..798d8e733 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/ReportsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/ReportsApiResource.java @@ -41,7 +41,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class ReportsApiResource { - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "reportName", "reportType", + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "reportName", "reportType", "reportSubType", "reportCategory", "description", "reportSql", "coreReport", "useReport", "reportParameters")); private final String resourceNameForPermissions = "REPORT"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/RunreportsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/RunreportsApiResource.java index 7bd4c9759..879956b83 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/RunreportsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/api/RunreportsApiResource.java @@ -145,7 +145,7 @@ public class RunreportsApiResource { private Map getReportParams(final MultivaluedMap queryParams, final Boolean isPentaho) { - final Map reportParams = new HashMap(); + final Map reportParams = new HashMap<>(); final Set keys = queryParams.keySet(); String pKey; String pValue; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/data/DataTableValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/data/DataTableValidator.java index 7ac9a99a2..2c0215f97 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/data/DataTableValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/data/DataTableValidator.java @@ -36,7 +36,7 @@ public class DataTableValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, REGISTER_PARAMS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(DATATABLE_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/data/ReportData.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/data/ReportData.java index d6c6a2fe5..648383477 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/data/ReportData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/data/ReportData.java @@ -75,13 +75,13 @@ final public class ReportData { public void appendedTemplate(final Collection allowedParameters) { - final List reportTypes = new ArrayList(); + final List reportTypes = new ArrayList<>(); reportTypes.add("Table"); reportTypes.add("Pentaho"); reportTypes.add("Chart"); this.allowedReportTypes = reportTypes; - final List reportSubTypes = new ArrayList(); + final List reportSubTypes = new ArrayList<>(); reportSubTypes.add("Bar"); reportSubTypes.add("Pie"); this.allowedReportSubTypes = reportSubTypes; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/data/ResultsetColumnHeaderData.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/data/ResultsetColumnHeaderData.java index 62ceacc59..68ff31154 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/data/ResultsetColumnHeaderData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/data/ResultsetColumnHeaderData.java @@ -31,7 +31,7 @@ public final class ResultsetColumnHeaderData { final Long columnLength = null; final boolean columnNullable = false; final boolean columnIsPrimaryKey = false; - final List columnValues = new ArrayList(); + final List columnValues = new ArrayList<>(); final String columnCode = null; return new ResultsetColumnHeaderData(columnName, columnType, columnLength, columnNullable, columnIsPrimaryKey, columnValues, columnCode); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/domain/Report.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/domain/Report.java index 8c9fa4f43..11e5b9f11 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/domain/Report.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/domain/Report.java @@ -62,7 +62,7 @@ public final class Report extends AbstractPersistable { @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "report", orphanRemoval = true) - private final Set reportParameterUsages = new HashSet(); + private final Set reportParameterUsages = new HashSet<>(); public static Report fromJson(final JsonCommand command) { @@ -118,7 +118,7 @@ public final class Report extends AbstractPersistable { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(8); + final Map actualChanges = new LinkedHashMap<>(8); String paramName = "reportName"; if (command.isChangeInStringParameterNamed(paramName, this.reportName)) { @@ -203,7 +203,7 @@ public final class Report extends AbstractPersistable { private void validate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("report"); baseDataValidator.reset().parameter("reportName").value(this.reportName).notBlank().notExceedingLengthOf(100); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/serialization/ReportCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/serialization/ReportCommandFromApiJsonDeserializer.java index 3e9d3bd0c..8567b8d3a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/serialization/ReportCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/serialization/ReportCommandFromApiJsonDeserializer.java @@ -25,7 +25,7 @@ public final class ReportCommandFromApiJsonDeserializer { /** * The parameters supported for this command. */ - private final Set supportedParameters = new HashSet(Arrays.asList("reportName", "reportType", "reportSubType", + private final Set supportedParameters = new HashSet<>(Arrays.asList("reportName", "reportType", "reportSubType", "reportCategory", "description", "reportSql", "useReport", "reportParameters")); private final FromJsonHelper fromApiJsonHelper; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/GenericDataServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/GenericDataServiceImpl.java index 6a9926fc4..fe5fbec67 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/GenericDataServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/GenericDataServiceImpl.java @@ -44,9 +44,8 @@ public class GenericDataServiceImpl implements GenericDataService { final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql); - - final List columnHeaders = new ArrayList(); - final List resultsetDataRows = new ArrayList(); + final List columnHeaders = new ArrayList<>(); + final List resultsetDataRows = new ArrayList<>(); final SqlRowSetMetaData rsmd = rs.getMetaData(); @@ -60,7 +59,7 @@ public class GenericDataServiceImpl implements GenericDataService { } while (rs.next()) { - final List columnValues = new ArrayList(); + final List columnValues = new ArrayList<>(); for (int i = 0; i < rsmd.getColumnCount(); i++) { final String columnName = rsmd.getColumnName(i + 1); final String columnValue = rs.getString(columnName); @@ -180,7 +179,7 @@ public class GenericDataServiceImpl implements GenericDataService { final SqlRowSet columnDefinitions = getDatatableMetaData(datatable); - final List columnHeaders = new ArrayList(); + final List columnHeaders = new ArrayList<>(); columnDefinitions.beforeFirst(); while (columnDefinitions.next()) { @@ -193,7 +192,7 @@ public class GenericDataServiceImpl implements GenericDataService { final boolean columnNullable = "YES".equalsIgnoreCase(isNullable); final boolean columnIsPrimaryKey = "PRI".equalsIgnoreCase(isPrimaryKey); - List columnValues = new ArrayList(); + List columnValues = new ArrayList<>(); String codeName = null; if ("varchar".equalsIgnoreCase(columnType)) { @@ -238,8 +237,7 @@ public class GenericDataServiceImpl implements GenericDataService { */ private List retreiveColumnValues(final String codeName) { - - final List columnValues = new ArrayList(); + final List columnValues = new ArrayList<>(); final String sql = "select v.id, v.code_score, v.code_value from m_code m " + " join m_code_value v on v.code_id = m.id " + " where m.code_name = '" + codeName + "' order by v.order_position, v.id"; @@ -260,8 +258,7 @@ public class GenericDataServiceImpl implements GenericDataService { private List retreiveColumnValues(final Integer codeId) { - - final List columnValues = new ArrayList(); + final List columnValues = new ArrayList<>(); if (codeId != null) { final String sql = "select v.id, v.code_value from m_code_value v where v.code_id =" + codeId + " order by v.order_position, v.id"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadReportingServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadReportingServiceImpl.java index 783f89fe0..c58e53f08 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadReportingServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadReportingServiceImpl.java @@ -363,7 +363,7 @@ public class ReadReportingServiceImpl implements ReadReportingService { rptParamValues.put("userhierarchy", userhierarchy); final MifosPlatformTenant tenant = ThreadLocalContextUtil.getTenant(); - + rptParamValues.put("tenantUrl", tenantUrl); rptParamValues.put("username", tenant.getSchemaUsername()); rptParamValues.put("password", tenant.getSchemaPassword()); @@ -462,7 +462,7 @@ public class ReadReportingServiceImpl implements ReadReportingService { final Collection rpJoins = this.jdbcTemplate.query(sql, rm, new Object[] {}); - final Collection reportList = new ArrayList(); + final Collection reportList = new ArrayList<>(); if (rpJoins == null || rpJoins.size() == 0) { return reportList; } Collection reportParameters = null; @@ -484,7 +484,7 @@ public class ReadReportingServiceImpl implements ReadReportingService { if (rpJoin.getReportId().equals(prevReportId)) { // more than one parameter for report if (reportParameters == null) { - reportParameters = new ArrayList(); + reportParameters = new ArrayList<>(); } reportParameters.add(new ReportParameterData(rpJoin.getReportParameterId(), rpJoin.getParameterId(), rpJoin .getReportParameterName(), rpJoin.getParameterName())); @@ -512,7 +512,7 @@ public class ReadReportingServiceImpl implements ReadReportingService { if (rpJoin.getReportParameterId() != null) { // report has at least one parameter - reportParameters = new ArrayList(); + reportParameters = new ArrayList<>(); reportParameters.add(new ReportParameterData(rpJoin.getReportParameterId(), rpJoin.getParameterId(), rpJoin .getReportParameterName(), rpJoin.getParameterName())); } else { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java index 8e8bfe4bb..5175bd27b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReadWriteNonCoreDataServiceImpl.java @@ -134,7 +134,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql); - final List datatables = new ArrayList(); + final List datatables = new ArrayList<>(); while (rs.next()) { final String appTableName = rs.getString("application_table_name"); final String registeredDatatableName = rs.getString("registered_table_name"); @@ -528,7 +528,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ final String fkName = dataTableNameAlias + "_" + fkColumnName; StringBuilder sqlBuilder = new StringBuilder(); final StringBuilder constrainBuilder = new StringBuilder(); - final Map codeMappings = new HashMap(); + final Map codeMappings = new HashMap<>(); sqlBuilder = sqlBuilder.append("CREATE TABLE `" + datatableName + "` ("); if (multiRow) { @@ -565,7 +565,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ registerColumnCodeMapping(codeMappings); } catch (final SQLGrammarException e) { final Throwable realCause = e.getCause(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("datatable"); if (realCause.getMessage().toLowerCase().contains("duplicate column name")) { @@ -787,7 +787,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ validateDatatableName(datatableName); final List columnHeaderData = this.genericDataService.fillResultsetColumnHeaders(datatableName); - final Map mapColumnNameDefinition = new HashMap(); + final Map mapColumnNameDefinition = new HashMap<>(); for (final ResultsetColumnHeaderData columnHeader : columnHeaderData) { mapColumnNameDefinition.put(columnHeader.getColumnName(), columnHeader); } @@ -834,7 +834,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ StringBuilder sqlBuilder = new StringBuilder("ALTER TABLE `" + datatableName + "`"); final StringBuilder constrainBuilder = new StringBuilder(); - final List codeMappings = new ArrayList(); + final List codeMappings = new ArrayList<>(); for (final JsonElement column : dropColumns) { parseDatatableColumnForDrop(column.getAsJsonObject(), sqlBuilder, datatableName, constrainBuilder, codeMappings); } @@ -852,7 +852,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ StringBuilder sqlBuilder = new StringBuilder("ALTER TABLE `" + datatableName + "`"); final StringBuilder constrainBuilder = new StringBuilder(); - final Map codeMappings = new HashMap(); + final Map codeMappings = new HashMap<>(); for (final JsonElement column : addColumns) { parseDatatableColumnForAdd(column.getAsJsonObject(), sqlBuilder, datatableName.toLowerCase().replaceAll("\\s", "_"), constrainBuilder, codeMappings, isConstraintApproach); @@ -871,8 +871,8 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ StringBuilder sqlBuilder = new StringBuilder("ALTER TABLE `" + datatableName + "`"); final StringBuilder constrainBuilder = new StringBuilder(); - final Map codeMappings = new HashMap(); - final List removeMappings = new ArrayList(); + final Map codeMappings = new HashMap<>(); + final List removeMappings = new ArrayList<>(); for (final JsonElement column : changeColumns) { parseDatatableColumnForUpdate(column.getAsJsonObject(), mapColumnNameDefinition, sqlBuilder, datatableName, constrainBuilder, codeMappings, removeMappings, isConstraintApproach); @@ -895,7 +895,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ } } catch (final SQLGrammarException e) { final Throwable realCause = e.getCause(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("datatable"); if (realCause.getMessage().toLowerCase().contains("unknown column")) { @@ -933,7 +933,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ this.jdbcTemplate.batchUpdate(sqlArray); } catch (final SQLGrammarException e) { final Throwable realCause = e.getCause(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("datatable"); if (realCause.getMessage().contains("Unknown table")) { baseDataValidator.reset().parameter("datatableName").failWithCode("does.not.exist"); @@ -1218,12 +1218,12 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql); - final List resultsetDataRows = new ArrayList(); + final List resultsetDataRows = new ArrayList<>(); final SqlRowSetMetaData rsmd = rs.getMetaData(); while (rs.next()) { - final List columnValues = new ArrayList(); + final List columnValues = new ArrayList<>(); for (int i = 0; i < rsmd.getColumnCount(); i++) { final String columnName = rsmd.getColumnName(i + 1); final String columnValue = rs.getString(columnName); @@ -1387,7 +1387,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ final String fkName) { final Map affectedColumns = getAffectedColumns(grs.getColumnHeaders(), queryParams, fkName); - final Map affectedAndChangedColumns = new HashMap(); + final Map affectedAndChangedColumns = new HashMap<>(); for (final String key : affectedColumns.keySet()) { final String columnValue = affectedColumns.get(key); @@ -1435,7 +1435,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ String columnHeaderUnderscored; boolean notFound; - final Map affectedColumns = new HashMap(); + final Map affectedColumns = new HashMap<>(); final Set keys = queryParams.keySet(); for (final String key : keys) { // ignores id and foreign key fields @@ -1475,7 +1475,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ if (StringUtils.isEmpty(paramValue) && columnHeader.isMandatory()) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final ApiParameterError error = ApiParameterError.parameterError("error.msg.column.mandatory", "Mandatory", columnHeader.getColumnName()); dataValidationErrors.add(error); @@ -1489,7 +1489,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ if (columnHeader.isCodeValueDisplayType()) { if (columnHeader.isColumnValueNotAllowed(paramValue)) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final ApiParameterError error = ApiParameterError.parameterError("error.msg.invalid.columnValue", "Value not found in Allowed Value list", columnHeader.getColumnName(), paramValue); dataValidationErrors.add(error); @@ -1502,7 +1502,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ final Integer codeLookup = Integer.valueOf(paramValue); if (columnHeader.isColumnCodeNotAllowed(codeLookup)) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final ApiParameterError error = ApiParameterError.parameterError("error.msg.invalid.columnValue", "Value not found in Allowed Value list", columnHeader.getColumnName(), paramValue); dataValidationErrors.add(error); @@ -1544,7 +1544,7 @@ public class ReadWriteNonCoreDataServiceImpl implements ReadWriteNonCoreDataServ final ApiParameterError error = ApiParameterError.parameterError( "validation.msg.datatable.entry.column.exceeds.maxlength", "The column `" + columnHeader.getColumnName() + "` exceeds its defined max-length ", columnHeader.getColumnName(), paramValue); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); dataValidationErrors.add(error); throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", "Validation errors exist.", dataValidationErrors); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReportWritePlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReportWritePlatformServiceImpl.java index 4cb2c2bf1..60fb028b5 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReportWritePlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/dataqueries/service/ReportWritePlatformServiceImpl.java @@ -176,7 +176,7 @@ public class ReportWritePlatformServiceImpl implements ReportWritePlatformServic final JsonArray reportParametersArray = command.arrayOfParameterNamed("reportParameters"); if (reportParametersArray != null) { - reportParameterUsages = new HashSet(); + reportParameterUsages = new HashSet<>(); for (int i = 0; i < reportParametersArray.size(); i++) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/api/DocumentManagementApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/api/DocumentManagementApiResource.java index 901fd87fc..742954ac4 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/api/DocumentManagementApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/api/DocumentManagementApiResource.java @@ -49,7 +49,7 @@ import com.sun.jersey.multipart.FormDataParam; @Scope("singleton") public class DocumentManagementApiResource { - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "parentEntityType", "parentEntityId", + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "parentEntityType", "parentEntityId", "name", "fileName", "size", "type", "description")); private final String SystemEntityType = "DOCUMENT"; @@ -120,7 +120,7 @@ public class DocumentManagementApiResource { @FormDataParam("file") final FormDataBodyPart bodyPart, @FormDataParam("name") final String name, @FormDataParam("description") final String description) { - final Set modifiedParams = new HashSet(); + final Set modifiedParams = new HashSet<>(); modifiedParams.add("name"); modifiedParams.add("description"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/command/DocumentCommandValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/command/DocumentCommandValidator.java index ab93dc3cf..af65ae696 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/command/DocumentCommandValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/command/DocumentCommandValidator.java @@ -21,7 +21,7 @@ public class DocumentCommandValidator { } public void validateForUpdate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("document"); @@ -40,7 +40,7 @@ public class DocumentCommandValidator { } public void validateForCreate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("document"); baseDataValidator.reset().parameter("parentEntityType").value(this.command.getParentEntityType()).notBlank() diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/contentrepository/ContentRepositoryUtils.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/contentrepository/ContentRepositoryUtils.java index cac7d697d..fa07e199f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/contentrepository/ContentRepositoryUtils.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/contentrepository/ContentRepositoryUtils.java @@ -136,7 +136,7 @@ public class ContentRepositoryUtils { } public static void validateClientImageNotEmpty(final String imageFileName) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); if (imageFileName == null) { final StringBuilder validationErrorCode = new StringBuilder("validation.msg.clientImage.cannot.be.blank"); final StringBuilder defaultEnglishMessage = new StringBuilder("The parameter image cannot be blank."); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/domain/StorageType.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/domain/StorageType.java index 152189114..2d6f02a89 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/domain/StorageType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/documentmanagement/domain/StorageType.java @@ -16,7 +16,7 @@ public enum StorageType { return this.value; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); static { for (final StorageType type : StorageType.values()) { intToEnumMap.put(type.value, type); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/annotation/CronMethodParser.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/annotation/CronMethodParser.java index ba44331d0..acc368d69 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/annotation/CronMethodParser.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/annotation/CronMethodParser.java @@ -29,7 +29,7 @@ public class CronMethodParser { private static final String RESOURCE_PATTERN = "**/*.class"; - private static final Map targetMethosMap = new HashMap(); + private static final Map targetMethosMap = new HashMap<>(); private static final ResourcePatternResolver resourcePatternResolver = new PathMatchingResourcePatternResolver(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/api/SchedulerJobApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/api/SchedulerJobApiConstants.java index 947f8ca70..e0d0e63c8 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/api/SchedulerJobApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/api/SchedulerJobApiConstants.java @@ -27,18 +27,18 @@ public class SchedulerJobApiConstants { public static final String cronExpressionParamName = "cronExpression"; public static final String schedulerStatusParamName = "active"; - public static final Set JOB_DETAIL_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(jobIdentifierParamName, + public static final Set JOB_DETAIL_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(jobIdentifierParamName, displayNameParamName, nextRunTimeParamName, initializingErrorParamName, cronExpressionParamName, jobActiveStatusParamName, currentlyRunningParamName, lastRunHistoryObjParamName)); - public static final Set JOB_HISTORY_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(versionParamName, + public static final Set JOB_HISTORY_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(versionParamName, jobRunStartTimeParamName, jobRunEndTimeParamName, statusParamName, jobRunErrorMessageParamName, triggerTypeParamName, jobRunErrorLogParamName)); - public static final Set JOB_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(displayNameParamName, + public static final Set JOB_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(displayNameParamName, jobActiveStatusParamName, cronExpressionParamName)); - public static final Set SCHEDULER_DETAIL_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(schedulerStatusParamName)); + public static final Set SCHEDULER_DETAIL_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(schedulerStatusParamName)); public static final String COMMAND_EXECUTE_JOB = "executeJob"; public static final String COMMAND_STOP_SCHEDULER = "stop"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/data/JobDetailDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/data/JobDetailDataValidator.java index b95bc34f1..2e03af50a 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/data/JobDetailDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/data/JobDetailDataValidator.java @@ -36,7 +36,7 @@ public class JobDetailDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SchedulerJobApiConstants.JOB_UPDATE_REQUEST_DATA_PARAMETERS); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SchedulerJobApiConstants.JOB_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/domain/ScheduledJobDetail.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/domain/ScheduledJobDetail.java index 302bba956..e90b912f3 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/domain/ScheduledJobDetail.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/domain/ScheduledJobDetail.java @@ -132,7 +132,7 @@ public class ScheduledJobDetail extends AbstractPersistable { } public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(9); + final Map actualChanges = new LinkedHashMap<>(9); if (command.isChangeInStringParameterNamed(SchedulerJobApiConstants.displayNameParamName, this.jobDisplayName)) { final String newValue = command.stringValueOfParameterNamed(SchedulerJobApiConstants.displayNameParamName).trim(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/service/JobRegisterServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/service/JobRegisterServiceImpl.java index 1a41f2803..f9d8179e3 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/service/JobRegisterServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/service/JobRegisterServiceImpl.java @@ -51,7 +51,7 @@ public class JobRegisterServiceImpl implements JobRegisterService { private final TenantDetailsService tenantDetailsService; - private final HashMap schedulers = new HashMap(4); + private final HashMap schedulers = new HashMap<>(4); @Autowired public JobRegisterServiceImpl(final ApplicationContext applicationContext, final SchedularWritePlatformService schedularService, @@ -95,7 +95,7 @@ public class JobRegisterServiceImpl implements JobRegisterService { if (scheduler == null || !scheduler.checkExists(jobKey)) { final JobDetail jobDetail = createJobDetail(scheduledJobDetail); final String tempSchedulerName = "temp" + scheduledJobDetail.getId(); - final List> listenerClasses = new ArrayList>(2); + final List> listenerClasses = new ArrayList<>(2); listenerClasses.add(SchedulerJobListener.class); listenerClasses.add(SchedulerStopListener.class); final Scheduler tempScheduler = createScheduler(tempSchedulerName, 1, listenerClasses); @@ -108,12 +108,9 @@ public class JobRegisterServiceImpl implements JobRegisterService { } } catch (final Exception e) { - final String msg = "Job execution failed for job with id:" - + scheduledJobDetail.getId(); - logger.error(msg, e); - throw new PlatformInternalServerException( - "error.msg.sheduler.job.execution.failed", msg, - scheduledJobDetail.getId()); + final String msg = "Job execution failed for job with id:" + scheduledJobDetail.getId(); + logger.error(msg, e); + throw new PlatformInternalServerException("error.msg.sheduler.job.execution.failed", msg, scheduledJobDetail.getId()); } } @@ -218,9 +215,7 @@ public class JobRegisterServiceImpl implements JobRegisterService { scheduledJobDetails.updateNextRunTime(null); final String stackTrace = getStackTraceAsString(throwable); scheduledJobDetails.updateErrorLog(stackTrace); - logger.error( - "Could not schedule job: " - + scheduledJobDetails.getJobName(), throwable); + logger.error("Could not schedule job: " + scheduledJobDetails.getJobName(), throwable); } scheduledJobDetails.updateCurrentlyRunningStatus(false); } @@ -264,7 +259,7 @@ public class JobRegisterServiceImpl implements JobRegisterService { final SchedulerFactoryBean schedulerFactoryBean = new SchedulerFactoryBean(); schedulerFactoryBean.setSchedulerName(name); if (listenerClasses == null) { - listenerClasses = new ArrayList>(1); + listenerClasses = new ArrayList<>(1); listenerClasses.add(SchedulerJobListener.class); } schedulerFactoryBean.setGlobalJobListeners(getGlobalListener(listenerClasses)); @@ -280,7 +275,7 @@ public class JobRegisterServiceImpl implements JobRegisterService { } private JobListener[] getGlobalListener(final List> listenerClasses) throws ClassNotFoundException { - final List listeners = new ArrayList(listenerClasses.size()); + final List listeners = new ArrayList<>(listenerClasses.size()); for (final Class listenerClass : listenerClasses) { final JobListener listener = (JobListener) getBeanObject(listenerClass); listeners.add(listener); @@ -309,7 +304,7 @@ public class JobRegisterServiceImpl implements JobRegisterService { * @throws ClassNotFoundException */ private Object getBeanObject(final Class classType) throws ClassNotFoundException { - final List> typesList = new ArrayList>(); + final List> typesList = new ArrayList<>(); final Class[] interfaceType = classType.getInterfaces(); if (interfaceType.length > 0) { typesList.addAll(Arrays.asList(interfaceType)); @@ -320,7 +315,7 @@ public class JobRegisterServiceImpl implements JobRegisterService { } typesList.add(superclassType); } - final List beanNames = new ArrayList(); + final List beanNames = new ArrayList<>(); for (final Class clazz : typesList) { beanNames.addAll(Arrays.asList(this.applicationContext.getBeanNamesForType(clazz))); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/service/SchedulerJobRunnerReadServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/service/SchedulerJobRunnerReadServiceImpl.java index d64b75b0e..9ecffbd03 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/service/SchedulerJobRunnerReadServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/jobs/service/SchedulerJobRunnerReadServiceImpl.java @@ -24,7 +24,7 @@ public class SchedulerJobRunnerReadServiceImpl implements SchedulerJobRunnerRead private final JdbcTemplate jdbcTemplate; - private final PaginationHelper paginationHelper = new PaginationHelper(); + private final PaginationHelper paginationHelper = new PaginationHelper<>(); @Autowired public SchedulerJobRunnerReadServiceImpl(final RoutingDataSource dataSource) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/api/AuthenticationApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/api/AuthenticationApiResource.java index 7d0050136..25648f6e8 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/api/AuthenticationApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/api/AuthenticationApiResource.java @@ -59,11 +59,11 @@ public class AuthenticationApiResource { final Authentication authentication = new UsernamePasswordAuthenticationToken(username, password); final Authentication authenticationCheck = this.customAuthenticationProvider.authenticate(authentication); - final Collection permissions = new ArrayList(); + final Collection permissions = new ArrayList<>(); AuthenticatedUserData authenticatedUserData = new AuthenticatedUserData(username, permissions); if (authenticationCheck.isAuthenticated()) { - final Collection authorities = new ArrayList(authenticationCheck.getAuthorities()); + final Collection authorities = new ArrayList<>(authenticationCheck.getAuthorities()); for (final GrantedAuthority grantedAuthority : authorities) { permissions.add(grantedAuthority.getAuthority()); } @@ -71,7 +71,7 @@ public class AuthenticationApiResource { final byte[] base64EncodedAuthenticationKey = Base64.encode(username + ":" + password); final AppUser principal = (AppUser) authenticationCheck.getPrincipal(); - final Collection roles = new ArrayList(); + final Collection roles = new ArrayList<>(); final Set userRoles = principal.getRoles(); for (final Role role : userRoles) { roles.add(role.toData()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/data/PlatformRequestLog.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/data/PlatformRequestLog.java index 11fa7c07e..7dacef195 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/data/PlatformRequestLog.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/security/data/PlatformRequestLog.java @@ -35,7 +35,7 @@ public class PlatformRequestLog { final String requestUrl = request.getRequestURL().toString(); @SuppressWarnings("unchecked") - final Map parameters = new HashMap(request.getParameterMap()); + final Map parameters = new HashMap<>(request.getParameterMap()); parameters.remove("password"); parameters.remove("_"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/sms/SmsApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/sms/SmsApiConstants.java index d4fc02e90..28367704f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/sms/SmsApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/sms/SmsApiConstants.java @@ -27,9 +27,9 @@ public class SmsApiConstants { // response parameters public static final String statusParamName = "status"; - public static final Set CREATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, groupIdParamName, clientIdParamName, staffIdParamName, messageParamName)); - public static final Set UPDATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(messageParamName)); + public static final Set UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(messageParamName)); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/sms/data/SmsDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/sms/data/SmsDataValidator.java index 889df8df7..b6809bbb7 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/sms/data/SmsDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/sms/data/SmsDataValidator.java @@ -41,7 +41,7 @@ public final class SmsDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SmsApiConstants.CREATE_REQUEST_DATA_PARAMETERS); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SmsApiConstants.RESOURCE_NAME); @@ -105,7 +105,7 @@ public final class SmsDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SmsApiConstants.UPDATE_REQUEST_DATA_PARAMETERS); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SmsApiConstants.RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/sms/domain/SmsMessage.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/sms/domain/SmsMessage.java index dede38b88..7a879783a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/sms/domain/SmsMessage.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/sms/domain/SmsMessage.java @@ -68,7 +68,7 @@ public class SmsMessage extends AbstractPersistable { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(1); + final Map actualChanges = new LinkedHashMap<>(1); if (command.isChangeInStringParameterNamed(SmsApiConstants.messageParamName, this.message)) { final String newValue = command.stringValueOfParameterNamed(SmsApiConstants.messageParamName); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/api/LikelihoodApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/api/LikelihoodApiConstants.java index 830c222c4..75c769ce8 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/api/LikelihoodApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/api/LikelihoodApiConstants.java @@ -12,8 +12,8 @@ public class LikelihoodApiConstants { public static final String LIKELIHOOD_RESOURCE_NAME = "likelihood"; - public static final Set UPDATE_LIKELIHOOD_DATA_PARAMETERS = new HashSet(Arrays.asList(ACTIVE)); + public static final Set UPDATE_LIKELIHOOD_DATA_PARAMETERS = new HashSet<>(Arrays.asList(ACTIVE)); - public static final Set VALID_LIKELIHOOD_ENABLED_VALUES = new HashSet(Arrays.asList(LikelihoodStatus.DISABLED, + public static final Set VALID_LIKELIHOOD_ENABLED_VALUES = new HashSet<>(Arrays.asList(LikelihoodStatus.DISABLED, LikelihoodStatus.ENABLED)); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/api/SurveyApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/api/SurveyApiResource.java index 0ebc2c0ac..53d25e115 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/api/SurveyApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/api/SurveyApiResource.java @@ -12,7 +12,6 @@ import javax.ws.rs.PathParam; import javax.ws.rs.Produces; import javax.ws.rs.core.MediaType; -import org.apache.commons.lang.StringUtils; import org.mifosplatform.commands.domain.CommandWrapper; import org.mifosplatform.commands.service.CommandWrapperBuilder; import org.mifosplatform.commands.service.PortfolioCommandSourceWritePlatformService; @@ -25,8 +24,6 @@ import org.mifosplatform.infrastructure.survey.data.ClientScoresOverview; import org.mifosplatform.infrastructure.survey.data.SurveyData; import org.mifosplatform.infrastructure.survey.data.SurveyDataTableData; import org.mifosplatform.infrastructure.survey.service.ReadSurveyService; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Component; @@ -46,8 +43,6 @@ public class SurveyApiResource { private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService; private final GenericDataService genericDataService; - private final static Logger logger = LoggerFactory.getLogger(SurveyApiResource.class); - @Autowired public SurveyApiResource(final DefaultToApiJsonSerializer toApiJsonSerializer, final PlatformSecurityContext context, final ReadSurveyService readSurveyService, final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, @@ -149,10 +144,6 @@ public class SurveyApiResource { } - private boolean is(final String commandParam, final String commandValue) { - return StringUtils.isNotBlank(commandParam) && commandParam.trim().equalsIgnoreCase(commandValue); - } - @DELETE @Path("{surveyName}/{clientId}/{fulfilledId}") @Consumes({ MediaType.APPLICATION_JSON }) diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/ClientScoresOverview.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/ClientScoresOverview.java index 7f8618fc3..dcf0fc134 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/ClientScoresOverview.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/ClientScoresOverview.java @@ -7,21 +7,23 @@ import org.joda.time.LocalDate; */ public class ClientScoresOverview { + @SuppressWarnings("unused") final private String surveyName; - final private long id ; - final private String likelihoodCode ; + @SuppressWarnings("unused") + final private long id; + @SuppressWarnings("unused") + final private String likelihoodCode; + @SuppressWarnings("unused") final private String likelihoodName; + @SuppressWarnings("unused") final private long score; + @SuppressWarnings("unused") final private Double povertyLine; + @SuppressWarnings("unused") final private LocalDate date; - public ClientScoresOverview(final String likelihoodCode, - final String likelihoodName, - final long score, - final Double povertyLine, - final LocalDate date, - final long resourceId, - final String surveyName) { + public ClientScoresOverview(final String likelihoodCode, final String likelihoodName, final long score, final Double povertyLine, + final LocalDate date, final long resourceId, final String surveyName) { this.likelihoodCode = likelihoodCode; this.likelihoodName = likelihoodName; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/LikeliHoodPovertyLineData.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/LikeliHoodPovertyLineData.java index e802ac3d7..e7858a694 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/LikeliHoodPovertyLineData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/LikeliHoodPovertyLineData.java @@ -13,10 +13,8 @@ public class LikeliHoodPovertyLineData { final long enabled; List povertyLineData; - public LikeliHoodPovertyLineData(final long resourceId, final List povertyLineData, - final String likeliHoodName, - final String likeliHoodCode, - final long enabled){ + public LikeliHoodPovertyLineData(final long resourceId, final List povertyLineData, final String likeliHoodName, + final String likeliHoodCode, final long enabled) { this.resourceId = resourceId; this.povertyLineData = povertyLineData; this.likeliHoodName = likeliHoodName; @@ -25,14 +23,8 @@ public class LikeliHoodPovertyLineData { } - - public void addPovertyLine(PovertyLineData povertyLineData) - { + public void addPovertyLine(PovertyLineData povertyLineData) { this.povertyLineData.add(povertyLineData); } - public void setEnabled(final Long enabled) - { - // this.enabled = enabled; - } } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/LikelihoodData.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/LikelihoodData.java index 843db080d..c52ee02f3 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/LikelihoodData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/LikelihoodData.java @@ -1,7 +1,5 @@ package org.mifosplatform.infrastructure.survey.data; -import java.util.List; - /** * Created by Cieyou on 3/12/14. */ @@ -12,11 +10,7 @@ public class LikelihoodData { final String likeliHoodCode; final long enabled; - - public LikelihoodData(final long resourceId, - final String likeliHoodName, - final String likeliHoodCode, - final long enabled){ + public LikelihoodData(final long resourceId, final String likeliHoodName, final String likeliHoodCode, final long enabled) { this.resourceId = resourceId; this.likeliHoodName = likeliHoodName; this.likeliHoodCode = likeliHoodCode; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/LikelihoodDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/LikelihoodDataValidator.java index 8ac384f44..b104e9166 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/LikelihoodDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/LikelihoodDataValidator.java @@ -39,7 +39,7 @@ public class LikelihoodDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, LikelihoodApiConstants.UPDATE_LIKELIHOOD_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(LikelihoodApiConstants.LIKELIHOOD_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/SurveyDataTableData.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/SurveyDataTableData.java index 197b026ec..c6f3c980d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/SurveyDataTableData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/data/SurveyDataTableData.java @@ -1,22 +1,14 @@ package org.mifosplatform.infrastructure.survey.data; import org.mifosplatform.infrastructure.dataqueries.data.DatatableData; -import org.mifosplatform.infrastructure.dataqueries.data.ResultsetColumnHeaderData; -import java.util.List; - -/** - * Created by Cieyou on 2/27/14. - */ public class SurveyDataTableData { @SuppressWarnings("unused") private final DatatableData datatableData; @SuppressWarnings("unused") - private final boolean enabled ; - - + private final boolean enabled; public static SurveyDataTableData create(final DatatableData datatableData, final boolean enabled) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/domain/Likelihood.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/domain/Likelihood.java index f1ddb4969..1c6392053 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/domain/Likelihood.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/domain/Likelihood.java @@ -1,22 +1,19 @@ package org.mifosplatform.infrastructure.survey.domain; +import java.util.LinkedHashMap; +import java.util.Map; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Table; + import org.mifosplatform.infrastructure.core.api.JsonCommand; import org.mifosplatform.infrastructure.survey.api.LikelihoodApiConstants; import org.mifosplatform.infrastructure.survey.data.LikelihoodStatus; import org.springframework.data.jpa.domain.AbstractPersistable; -import javax.persistence.Column; -import javax.persistence.Entity; -import javax.persistence.Table; -import javax.persistence.UniqueConstraint; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * Created by Cieyou on 3/12/14. - */ @Entity -@Table(name="ppi_likelihoods_ppi") +@Table(name = "ppi_likelihoods_ppi") public final class Likelihood extends AbstractPersistable { @Column(name = "ppi_name", nullable = false) @@ -28,32 +25,28 @@ public final class Likelihood extends AbstractPersistable { @Column(name = "enabled", nullable = false) private Long enabled; - public Map update(final JsonCommand command) - { - final Map actualChanges = new LinkedHashMap(7); + public Map update(final JsonCommand command) { + final Map actualChanges = new LinkedHashMap<>(7); final boolean enabled = command.booleanPrimitiveValueOfParameterNamed(LikelihoodApiConstants.ACTIVE); Long changeToValue = null; - if(enabled){ - changeToValue = LikelihoodStatus.ENABLED; - }else{ - changeToValue = LikelihoodStatus.DISABLED; + if (enabled) { + changeToValue = LikelihoodStatus.ENABLED; + } else { + changeToValue = LikelihoodStatus.DISABLED; } - - if(!changeToValue.equals(this.enabled)) - { - actualChanges.put(LikelihoodApiConstants.ACTIVE,enabled); + if (!changeToValue.equals(this.enabled)) { + actualChanges.put(LikelihoodApiConstants.ACTIVE, enabled); this.enabled = changeToValue; } return actualChanges; } - public boolean isActivateCommand(final JsonCommand command) - { + public boolean isActivateCommand(final JsonCommand command) { return command.booleanPrimitiveValueOfParameterNamed(LikelihoodApiConstants.ACTIVE); } @@ -66,8 +59,7 @@ public final class Likelihood extends AbstractPersistable { return super.getId(); } - public void disable() - { + public void disable() { this.enabled = LikelihoodStatus.DISABLED; } } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/service/PovertyLineServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/service/PovertyLineServiceImpl.java index 1c3241228..84c5b357d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/service/PovertyLineServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/service/PovertyLineServiceImpl.java @@ -34,12 +34,12 @@ public class PovertyLineServiceImpl implements PovertyLineService { final SqlRowSet likelihoods = this._getLikelihoods(); - List listOfLikeliHoodPovertyLineData = new ArrayList(); + List listOfLikeliHoodPovertyLineData = new ArrayList<>(); while (likelihoods.next()) { final String codeName = likelihoods.getString("code"); - List povertyLineDatas = new ArrayList(); + List povertyLineDatas = new ArrayList<>(); // create a new povertyLine object when ever it belong to the // current likelihood @@ -74,7 +74,7 @@ public class PovertyLineServiceImpl implements PovertyLineService { final SqlRowSet povertyLines = this._getPovertyLines(likelihoodId); - List povertyLineDatas = new ArrayList(); + List povertyLineDatas = new ArrayList<>(); while (povertyLines.next()) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/service/ReadLikelihoodServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/service/ReadLikelihoodServiceImpl.java index f35c9b71a..178ce04b0 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/service/ReadLikelihoodServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/service/ReadLikelihoodServiceImpl.java @@ -29,7 +29,7 @@ public class ReadLikelihoodServiceImpl implements ReadLikelihoodService { public List retrieveAll(final String ppiName) { final SqlRowSet likelihood = this._getLikelihood(ppiName); - List likelihoodDatas = new ArrayList(); + List likelihoodDatas = new ArrayList<>(); while (likelihood.next()) { likelihoodDatas.add(new LikelihoodData(likelihood.getLong("id"), likelihood.getString("name"), likelihood.getString("code"), diff --git a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/service/ReadSurveyServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/service/ReadSurveyServiceImpl.java index e3edece36..68208ba61 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/service/ReadSurveyServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/infrastructure/survey/service/ReadSurveyServiceImpl.java @@ -49,7 +49,7 @@ public class ReadSurveyServiceImpl implements ReadSurveyService { final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql); - final List surveyDataTables = new ArrayList(); + final List surveyDataTables = new ArrayList<>(); while (rs.next()) { final String appTableName = rs.getString("application_table_name"); final String registeredDatatableName = rs.getString("registered_table_name"); @@ -115,7 +115,7 @@ public class ReadSurveyServiceImpl implements ReadSurveyService { final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql); - List scoresOverviews = new ArrayList(); + List scoresOverviews = new ArrayList<>(); while (rs.next()) { scoresOverviews.add(new ClientScoresOverview(rs.getString("code"), rs.getString("name"), rs.getLong("score"), rs @@ -130,7 +130,7 @@ public class ReadSurveyServiceImpl implements ReadSurveyService { final String surveyNameSql = retrieveAllSurveyNameSQL(); final SqlRowSet surveyNames = this.jdbcTemplate.queryForRowSet(surveyNameSql); - ArrayList sqls = new ArrayList(); + ArrayList sqls = new ArrayList<>(); while (surveyNames.next()) { sqls.add("SELECT '" + surveyNames.getString("name") @@ -141,7 +141,7 @@ public class ReadSurveyServiceImpl implements ReadSurveyService { + " JOIN ppi_likelihoods lkh on lkh.id = lkp.likelihood_id " + " WHERE client_id = " + clientId); } - List scoresOverviews = new ArrayList(); + List scoresOverviews = new ArrayList<>(); for (String sql : sqls) { final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/mix/api/MixTaxonomyApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/mix/api/MixTaxonomyApiResource.java index be61dbb76..30f1fd15b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/mix/api/MixTaxonomyApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/mix/api/MixTaxonomyApiResource.java @@ -28,7 +28,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class MixTaxonomyApiResource { - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("taxonomyId", "name", "namespace", "dimension", + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("taxonomyId", "name", "namespace", "dimension", "description")); private final PlatformSecurityContext context; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/mix/api/MixTaxonomyMappingApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/mix/api/MixTaxonomyMappingApiResource.java index ef25bf378..90ef13f7c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/mix/api/MixTaxonomyMappingApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/mix/api/MixTaxonomyMappingApiResource.java @@ -32,7 +32,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class MixTaxonomyMappingApiResource { - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("identifier", "config")); + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("identifier", "config")); private final PlatformSecurityContext context; private final ToApiJsonSerializer toApiJsonSerializer; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/mix/service/XBRLBuilder.java b/mifosng-provider/src/main/java/org/mifosplatform/mix/service/XBRLBuilder.java index f49b6aed9..5cfd6c33d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/mix/service/XBRLBuilder.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/mix/service/XBRLBuilder.java @@ -43,7 +43,7 @@ public class XBRLBuilder { public String build(final Map map, final Date startDate, final Date endDate, final String currency) { this.instantScenarioCounter = 1; this.durationScenarioCounter = 1; - this.contextMap = new HashMap(); + this.contextMap = new HashMap<>(); final Document doc = DocumentHelper.createDocument(); this.root = doc.addElement("xbrl"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/mix/service/XBRLResultServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/mix/service/XBRLResultServiceImpl.java index 69a297020..f7e692893 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/mix/service/XBRLResultServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/mix/service/XBRLResultServiceImpl.java @@ -57,11 +57,11 @@ public class XBRLResultServiceImpl implements XBRLResultService { final String config = taxonomyMapping.getConfig(); if (config != null) { // - HashMap configMap = new HashMap(); + HashMap configMap = new HashMap<>(); configMap = new Gson().fromJson(config, configMap.getClass()); if (configMap == null) { return null; } // - final HashMap resultMap = new HashMap(); + final HashMap resultMap = new HashMap<>(); setupBalanceMap(getAccountSql(startDate, endDate)); for (final Entry entry : configMap.entrySet()) { final BigDecimal value = processMappingString(entry.getValue()); @@ -136,7 +136,7 @@ public class XBRLResultServiceImpl implements XBRLResultService { private void setupBalanceMap(final String sql) { if (this.accountBalanceMap == null) { - this.accountBalanceMap = new HashMap(); + this.accountBalanceMap = new HashMap<>(); final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql); while (rs.next()) { this.accountBalanceMap.put(rs.getString("glcode"), rs.getBigDecimal("balance")); @@ -170,7 +170,7 @@ public class XBRLResultServiceImpl implements XBRLResultService { public ArrayList getGLCodes(final String template) { - final ArrayList placeholders = new ArrayList(); + final ArrayList placeholders = new ArrayList<>(); if (template != null) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/api/HolidayApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/api/HolidayApiConstants.java index 933fcb736..f5e710959 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/api/HolidayApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/api/HolidayApiConstants.java @@ -24,11 +24,11 @@ public class HolidayApiConstants { public static final String processed = "processed"; public static final String status = "status"; - public static final Set HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, nameParamName, fromDateParamName, toDateParamName, descriptionParamName, officesParamName, repaymentsRescheduledToParamName)); - public static final Set HOLIDAY_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName, nameParamName, + public static final Set HOLIDAY_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, nameParamName, fromDateParamName, descriptionParamName, toDateParamName, repaymentsRescheduledToParamName, localeParamName, dateFormatParamName, status)); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/data/HolidayDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/data/HolidayDataValidator.java index 485402ea2..062b3260d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/data/HolidayDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/data/HolidayDataValidator.java @@ -42,7 +42,7 @@ public class HolidayDataValidator { HolidayApiConstants.HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(HolidayApiConstants.HOLIDAY_RESOURCE_NAME); @@ -68,7 +68,7 @@ public class HolidayDataValidator { final JsonArray array = topLevelJsonElement.get(HolidayApiConstants.officesParamName).getAsJsonArray(); if (array.size() > 0) { - offices = new HashSet(array.size()); + offices = new HashSet<>(array.size()); for (int i = 0; i < array.size(); i++) { final JsonObject officeElement = array.get(i).getAsJsonObject(); final Long officeId = this.fromApiJsonHelper.extractLongNamed(HolidayApiConstants.officeIdParamName, officeElement); @@ -90,7 +90,7 @@ public class HolidayDataValidator { HolidayApiConstants.HOLIDAY_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(HolidayApiConstants.HOLIDAY_RESOURCE_NAME); @@ -125,7 +125,7 @@ public class HolidayDataValidator { final JsonArray array = topLevelJsonElement.get(HolidayApiConstants.officesParamName).getAsJsonArray(); if (array.size() > 0) { - offices = new HashSet(array.size()); + offices = new HashSet<>(array.size()); for (int i = 0; i < array.size(); i++) { final JsonObject officeElement = array.get(i).getAsJsonObject(); final Long officeId = this.fromApiJsonHelper.extractLongNamed(HolidayApiConstants.officeIdParamName, officeElement); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/domain/Holiday.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/domain/Holiday.java index 5caf6a5a9..d647ed319 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/domain/Holiday.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/domain/Holiday.java @@ -91,9 +91,9 @@ public class Holiday extends AbstractPersistable { } public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(7); + final Map actualChanges = new LinkedHashMap<>(7); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("holiday" + ".update"); final HolidayStatusType currentStatus = HolidayStatusType.fromInt(this.status); @@ -177,8 +177,8 @@ public class Holiday extends AbstractPersistable { boolean updated = false; if (this.offices != null) { - final Set currentSetOfOffices = new HashSet(this.offices); - final Set newSetOfOffices = new HashSet(newOffices); + final Set currentSetOfOffices = new HashSet<>(this.offices); + final Set newSetOfOffices = new HashSet<>(newOffices); if (!(currentSetOfOffices.equals(newSetOfOffices))) { updated = true; @@ -262,7 +262,7 @@ public class Holiday extends AbstractPersistable { } public void activate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("holiday" + ".activate"); final HolidayStatusType currentStatus = HolidayStatusType.fromInt(this.status); @@ -275,7 +275,7 @@ public class Holiday extends AbstractPersistable { } public void delete() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("holiday" + ".delete"); final HolidayStatusType currentStatus = HolidayStatusType.fromInt(this.status); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/service/HolidayWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/service/HolidayWritePlatformServiceJpaRepositoryImpl.java index c2809ae9d..db509d32b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/service/HolidayWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/holiday/service/HolidayWritePlatformServiceJpaRepositoryImpl.java @@ -144,7 +144,7 @@ public class HolidayWritePlatformServiceJpaRepositoryImpl implements HolidayWrit && topLevelJsonElement.get(HolidayApiConstants.officesParamName).isJsonArray()) { final JsonArray array = topLevelJsonElement.get(HolidayApiConstants.officesParamName).getAsJsonArray(); - offices = new HashSet(array.size()); + offices = new HashSet<>(array.size()); for (int i = 0; i < array.size(); i++) { final JsonObject officeElement = array.get(i).getAsJsonObject(); final Long officeId = this.fromApiJsonHelper.extractLongNamed(HolidayApiConstants.officeIdParamName, officeElement); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/api/CurrenciesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/api/CurrenciesApiResource.java index 1129033da..8bff6609b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/api/CurrenciesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/api/CurrenciesApiResource.java @@ -37,7 +37,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class CurrenciesApiResource { - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("selectedCurrencyOptions", "currencyOptions")); + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("selectedCurrencyOptions", "currencyOptions")); private final String resourceNameForPermissions = "CURRENCY"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/serialization/CurrencyCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/serialization/CurrencyCommandFromApiJsonDeserializer.java index 89a4475d2..cc4157995 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/serialization/CurrencyCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/serialization/CurrencyCommandFromApiJsonDeserializer.java @@ -31,7 +31,7 @@ public final class CurrencyCommandFromApiJsonDeserializer { /** * The parameters supported for this command. */ - private final Set supportedParameters = new HashSet(Arrays.asList("currencies")); + private final Set supportedParameters = new HashSet<>(Arrays.asList("currencies")); private final FromJsonHelper fromApiJsonHelper; @@ -47,7 +47,7 @@ public final class CurrencyCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("currencies"); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/service/CurrencyWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/service/CurrencyWritePlatformServiceJpaRepositoryImpl.java index ae0e12252..778af0051 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/service/CurrencyWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/monetary/service/CurrencyWritePlatformServiceJpaRepositoryImpl.java @@ -65,9 +65,9 @@ public class CurrencyWritePlatformServiceJpaRepositoryImpl implements CurrencyWr final String[] currencies = command.arrayValueOfParameterNamed("currencies"); - final Map changes = new LinkedHashMap(); - final List allowedCurrencyCodes = new ArrayList(); - final Set allowedCurrencies = new HashSet(); + final Map changes = new LinkedHashMap<>(); + final List allowedCurrencyCodes = new ArrayList<>(); + final Set allowedCurrencies = new HashSet<>(); for (final String currencyCode : currencies) { final ApplicationCurrency currency = this.applicationCurrencyRepository.findOneWithNotFoundDetection(currencyCode); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficeTransactionsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficeTransactionsApiResource.java index fb5032fa5..37c89b425 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficeTransactionsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficeTransactionsApiResource.java @@ -40,7 +40,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class OfficeTransactionsApiResource { - private static final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "transactionDate", "fromOfficeId", + private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "transactionDate", "fromOfficeId", "fromOfficeName", "toOfficeId", "toOfficeIdName", "currencyCode", "digitsAfterDecimal", "inMultiplesOf", "transactionAmount", "description", "allowedOffices", "currencyOptions")); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficesApiResource.java index 563645349..77dddceef 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/api/OfficesApiResource.java @@ -46,7 +46,7 @@ public class OfficesApiResource { * The set of parameters that are supported in response for * {@link OfficeData}. */ - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "name", "nameDecorated", "externalId", + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "nameDecorated", "externalId", "openingDate", "hierarchy", "parentId", "parentName", "allowedParents")); private final String resourceNameForPermissions = "OFFICE"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/domain/Office.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/domain/Office.java index 0a81661ff..9028026ba 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/domain/Office.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/domain/Office.java @@ -36,7 +36,7 @@ public class Office extends AbstractPersistable { @OneToMany(fetch = FetchType.EAGER) @JoinColumn(name = "parent_id") - private final List children = new LinkedList(); + private final List children = new LinkedList<>(); @ManyToOne(fetch = FetchType.LAZY) @JoinColumn(name = "parent_id") @@ -99,7 +99,7 @@ public class Office extends AbstractPersistable { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(7); + final Map actualChanges = new LinkedHashMap<>(7); final String dateFormatAsInput = command.dateFormat(); final String localeAsInput = command.locale(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/serialization/OfficeCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/serialization/OfficeCommandFromApiJsonDeserializer.java index 3de26be1a..e9d319fe2 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/serialization/OfficeCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/serialization/OfficeCommandFromApiJsonDeserializer.java @@ -35,7 +35,7 @@ public final class OfficeCommandFromApiJsonDeserializer { /** * The parameters supported for this command. */ - private final Set supportedParameters = new HashSet(Arrays.asList("name", "parentId", "openingDate", "externalId", + private final Set supportedParameters = new HashSet<>(Arrays.asList("name", "parentId", "openingDate", "externalId", "locale", "dateFormat")); private final FromJsonHelper fromApiJsonHelper; @@ -51,7 +51,7 @@ public final class OfficeCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("office"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -86,7 +86,7 @@ public final class OfficeCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("office"); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/serialization/OfficeTransactionCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/serialization/OfficeTransactionCommandFromApiJsonDeserializer.java index fbf2de335..581944a82 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/serialization/OfficeTransactionCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/serialization/OfficeTransactionCommandFromApiJsonDeserializer.java @@ -33,7 +33,7 @@ public final class OfficeTransactionCommandFromApiJsonDeserializer { /** * The parameters supported for this command. */ - private final Set supportedParameters = new HashSet(Arrays.asList("fromOfficeId", "toOfficeId", "transactionDate", + private final Set supportedParameters = new HashSet<>(Arrays.asList("fromOfficeId", "toOfficeId", "transactionDate", "currencyCode", "transactionAmount", "description", "locale", "dateFormat")); private final FromJsonHelper fromApiJsonHelper; @@ -49,7 +49,7 @@ public final class OfficeTransactionCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("officeTransaction"); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformServiceImpl.java index 29c5c67af..f5dd0af71 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/office/service/OfficeReadPlatformServiceImpl.java @@ -187,7 +187,7 @@ public class OfficeReadPlatformServiceImpl implements OfficeReadPlatformService public Collection retrieveAllowedParents(final Long officeId) { this.context.authenticatedUser(); - final Collection filterParentLookups = new ArrayList(); + final Collection filterParentLookups = new ArrayList<>(); if (isNotHeadOffice(officeId)) { final Collection parentLookups = retrieveAllOfficesForDropdown(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/api/StaffApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/api/StaffApiResource.java index 0f8cbcece..acf989c83 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/api/StaffApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/api/StaffApiResource.java @@ -48,7 +48,7 @@ public class StaffApiResource { * The set of parameters that are supported in response for * {@link StaffData}. */ - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "firstname", "lastname", "displayName", + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "firstname", "lastname", "displayName", "officeId", "officeName", "isLoanOfficer", "externalId", "mobileNo", "allowedOffices", "isActive")); private final String resourceNameForPermissions = "STAFF"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/domain/Staff.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/domain/Staff.java index 6bc4a3214..f9b34f4a1 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/domain/Staff.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/domain/Staff.java @@ -112,7 +112,7 @@ public class Staff extends AbstractPersistable { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(7); + final Map actualChanges = new LinkedHashMap<>(7); final String officeIdParamName = "officeId"; if (command.isChangeInLongParameterNamed(officeIdParamName, this.office.getId())) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java index 319dee492..4077d9f38 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/staff/serialization/StaffCommandFromApiJsonDeserializer.java @@ -32,7 +32,7 @@ public final class StaffCommandFromApiJsonDeserializer { /** * The parameters supported for this command. */ - private final Set supportedParameters = new HashSet(Arrays.asList("firstname", "lastname", "officeId", "externalId", + private final Set supportedParameters = new HashSet<>(Arrays.asList("firstname", "lastname", "officeId", "externalId", "mobileNo", "isLoanOfficer", "isActive")); private final FromJsonHelper fromApiJsonHelper; @@ -48,7 +48,7 @@ public final class StaffCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("staff"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -87,7 +87,7 @@ public final class StaffCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("staff"); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/organisation/workingdays/domain/RepaymentRescheduleType.java b/mifosng-provider/src/main/java/org/mifosplatform/organisation/workingdays/domain/RepaymentRescheduleType.java index 7c4eea891..03caeeb15 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/organisation/workingdays/domain/RepaymentRescheduleType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/organisation/workingdays/domain/RepaymentRescheduleType.java @@ -31,7 +31,7 @@ public enum RepaymentRescheduleType { return this.code; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); private static int minValue; private static int maxValue; static { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/PortfolioAccountType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/PortfolioAccountType.java index 8e75a7534..671d081d8 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/PortfolioAccountType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/PortfolioAccountType.java @@ -31,7 +31,7 @@ public enum PortfolioAccountType { } public static Object[] integerValues() { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final PortfolioAccountType enumType : values()) { if (enumType.getValue() > 0) { values.add(enumType.getValue()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/api/AccountTransfersApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/api/AccountTransfersApiConstants.java index 261e28848..a6aa0650f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/api/AccountTransfersApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/api/AccountTransfersApiConstants.java @@ -21,7 +21,7 @@ public class AccountTransfersApiConstants { public static final String transferAmountParamName = "transferAmount"; public static final String transferDescriptionParamName = "transferDescription"; - public static final Set REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(AccountDetailConstants.localeParamName, + public static final Set REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(AccountDetailConstants.localeParamName, AccountDetailConstants.dateFormatParamName, AccountDetailConstants.fromOfficeIdParamName, AccountDetailConstants.fromClientIdParamName, AccountDetailConstants.fromAccountTypeParamName, AccountDetailConstants.fromAccountIdParamName, AccountDetailConstants.toOfficeIdParamName, @@ -33,6 +33,6 @@ public class AccountTransfersApiConstants { * {@link AccountTransferData}. Where possible, we try to get response * parameters to match those of request parameters. */ - public static final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(AccountDetailConstants.idParamName, + public static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(AccountDetailConstants.idParamName, transferDescriptionParamName, "currency")); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/api/StandingInstructionApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/api/StandingInstructionApiConstants.java index 3daf4b35e..f363958df 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/api/StandingInstructionApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/api/StandingInstructionApiConstants.java @@ -28,7 +28,7 @@ public class StandingInstructionApiConstants { public static final String recurrenceOnMonthDayParamName = "recurrenceOnMonthDay"; public static final String monthDayFormatParamName = "monthDayFormat"; - public static final Set CREATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList( + public static final Set CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList( AccountDetailConstants.localeParamName, AccountDetailConstants.dateFormatParamName, AccountDetailConstants.fromOfficeIdParamName, AccountDetailConstants.fromClientIdParamName, AccountDetailConstants.fromAccountTypeParamName, AccountDetailConstants.fromAccountIdParamName, @@ -38,12 +38,12 @@ public class StandingInstructionApiConstants { validFromParamName, validTillParamName, recurrenceTypeParamName, recurrenceFrequencyParamName, recurrenceIntervalParamName, recurrenceOnMonthDayParamName, nameParamName, monthDayFormatParamName)); - public static final Set UPDATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList( + public static final Set UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList( AccountDetailConstants.localeParamName, AccountDetailConstants.dateFormatParamName, priorityParamName, instructionTypeParamName, statusParamName, amountParamName, validFromParamName, validTillParamName, recurrenceTypeParamName, recurrenceFrequencyParamName, recurrenceIntervalParamName, recurrenceOnMonthDayParamName, monthDayFormatParamName)); - public static final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(AccountDetailConstants.idParamName, + public static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(AccountDetailConstants.idParamName, nameParamName, priorityParamName, instructionTypeParamName, statusParamName, AccountDetailConstants.transferTypeParamName, validFromParamName, validTillParamName)); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/data/AccountTransfersDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/data/AccountTransfersDataValidator.java index c9d3b5406..1ea3b8cac 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/data/AccountTransfersDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/data/AccountTransfersDataValidator.java @@ -53,7 +53,7 @@ public class AccountTransfersDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(ACCOUNT_TRANSFER_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/data/StandingInstructionDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/data/StandingInstructionDataValidator.java index 09986bcbc..08fb59f3d 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/data/StandingInstructionDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/data/StandingInstructionDataValidator.java @@ -71,7 +71,7 @@ public class StandingInstructionDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, CREATE_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(STANDING_INSTRUCTION_RESOURCE_NAME); this.accountTransfersDetailDataValidator.validate(command, baseDataValidator); @@ -169,7 +169,7 @@ public class StandingInstructionDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, UPDATE_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(STANDING_INSTRUCTION_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/domain/AccountTransferDetails.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/domain/AccountTransferDetails.java index 6db213699..d87335bab 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/domain/AccountTransferDetails.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/domain/AccountTransferDetails.java @@ -67,7 +67,7 @@ public class AccountTransferDetails extends AbstractPersistable { @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "accountTransferDetails", orphanRemoval = true) - private final List accountTransferTransactions = new ArrayList(); + private final List accountTransferTransactions = new ArrayList<>(); @OneToOne(mappedBy = "accountTransferDetails", cascade = CascadeType.ALL, optional = true, orphanRemoval = true, fetch = FetchType.LAZY) private AccountTransferStandingInstruction accountTransferStandingInstruction; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/domain/AccountTransferStandingInstruction.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/domain/AccountTransferStandingInstruction.java index fda5f3cf3..c17f1191a 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/domain/AccountTransferStandingInstruction.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/domain/AccountTransferStandingInstruction.java @@ -129,7 +129,7 @@ public class AccountTransferStandingInstruction extends AbstractPersistable dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(STANDING_INSTRUCTION_RESOURCE_NAME); @@ -138,9 +138,9 @@ public class AccountTransferStandingInstruction extends AbstractPersistable update(JsonCommand command) { - final Map actualChanges = new HashMap(); + final Map actualChanges = new HashMap<>(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(STANDING_INSTRUCTION_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/AccountTransfersReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/AccountTransfersReadPlatformServiceImpl.java index 201f8af59..c617d6530 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/AccountTransfersReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/AccountTransfersReadPlatformServiceImpl.java @@ -50,7 +50,7 @@ public class AccountTransfersReadPlatformServiceImpl implements AccountTransfers private final AccountTransfersMapper accountTransfersMapper; // pagination - private final PaginationHelper paginationHelper = new PaginationHelper(); + private final PaginationHelper paginationHelper = new PaginationHelper<>(); @Autowired public AccountTransfersReadPlatformServiceImpl(final RoutingDataSource dataSource, @@ -162,7 +162,7 @@ public class AccountTransfersReadPlatformServiceImpl implements AccountTransfers toClientOptions = this.clientReadPlatformService.retrieveAllForLookupByOfficeId(mostRelevantToOfficeId); if (toClientOptions != null && toClientOptions.size() == 1) { - toClient = new ArrayList(toClientOptions).get(0); + toClient = new ArrayList<>(toClientOptions).get(0); toAccountOptions = retrieveToAccounts(fromAccount, mostRelevantToAccountType, mostRelevantToClientId); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/PortfolioAccountReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/PortfolioAccountReadPlatformServiceImpl.java index 83116e5fb..b60f2a513 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/PortfolioAccountReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/PortfolioAccountReadPlatformServiceImpl.java @@ -93,9 +93,9 @@ public class PortfolioAccountReadPlatformServiceImpl implements PortfolioAccount @Override public Collection retrieveAllForLookup(final Integer accountTypeId, final Long clientId, - final String currencyCode, final long[] accountStatus,final Integer depositType) { + final String currencyCode, final long[] accountStatus, final Integer depositType) { - List sqlParams = new ArrayList(); + List sqlParams = new ArrayList<>(); sqlParams.add(clientId); Collection accounts = null; String sql = null; @@ -127,8 +127,8 @@ public class PortfolioAccountReadPlatformServiceImpl implements PortfolioAccount sql += " and sa.currency_code = ?"; sqlParams.add(currencyCode); } - - if(depositType != null){ + + if (depositType != null) { sql += " and sa.deposit_type_enum = ?"; sqlParams.add(depositType); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/StandingInstructionReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/StandingInstructionReadPlatformServiceImpl.java index c29262953..91fddefc7 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/StandingInstructionReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/StandingInstructionReadPlatformServiceImpl.java @@ -66,7 +66,7 @@ public class StandingInstructionReadPlatformServiceImpl implements StandingInstr private final StandingInstructionMapper standingInstructionMapper; // pagination - private final PaginationHelper paginationHelper = new PaginationHelper(); + private final PaginationHelper paginationHelper = new PaginationHelper<>(); @Autowired public StandingInstructionReadPlatformServiceImpl(final RoutingDataSource dataSource, @@ -190,7 +190,7 @@ public class StandingInstructionReadPlatformServiceImpl implements StandingInstr toClientOptions = this.clientReadPlatformService.retrieveAllForLookupByOfficeId(mostRelevantToOfficeId); if (toClientOptions != null && toClientOptions.size() == 1) { - toClient = new ArrayList(toClientOptions).get(0); + toClient = new ArrayList<>(toClientOptions).get(0); toAccountOptions = retrieveToAccounts(fromAccount, mostRelevantToAccountType, mostRelevantToClientId); } @@ -250,7 +250,7 @@ public class StandingInstructionReadPlatformServiceImpl implements StandingInstr sqlBuilder.append(" where "); } boolean addAndCaluse = false; - List paramObj = new ArrayList(); + List paramObj = new ArrayList<>(); if (standingInstructionDTO.transferType() != null) { if (addAndCaluse) { sqlBuilder.append(" and "); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/StandingInstructionWritePlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/StandingInstructionWritePlatformServiceImpl.java index 586d0b1c5..8e7ac25c7 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/StandingInstructionWritePlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/account/service/StandingInstructionWritePlatformServiceImpl.java @@ -161,7 +161,7 @@ public class StandingInstructionWritePlatformServiceImpl implements StandingInst public CommandProcessingResult delete(final Long id) { AccountTransferStandingInstruction standingInstructionsForUpdate = this.standingInstructionRepository.findOne(id); standingInstructionsForUpdate.updateStatus(StandingInstructionStatus.DELETED.getValue()); - final Map actualChanges = new HashMap(); + final Map actualChanges = new HashMap<>(); actualChanges.put(statusParamName, StandingInstructionStatus.DELETED.getValue()); return new CommandProcessingResultBuilder() // .withEntityId(id) // diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/CalendarConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/CalendarConstants.java index 95a030d5b..96402c408 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/CalendarConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/CalendarConstants.java @@ -25,7 +25,7 @@ public class CalendarConstants { this.value = value; } - private static final Set values = new HashSet(); + private static final Set values = new HashSet<>(); static { for (final CALENDAR_SUPPORTED_PARAMETERS param : CALENDAR_SUPPORTED_PARAMETERS.values()) { values.add(param.value); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/api/CalendarsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/api/CalendarsApiResource.java index 5d4501901..16495f762 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/api/CalendarsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/api/CalendarsApiResource.java @@ -56,7 +56,7 @@ public class CalendarsApiResource { /** * The set of parameters that are supported in response for {@link Calendar} */ - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "entityId", "entityType", "title", + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "entityId", "entityType", "title", "description", "location", "startDate", "endDate", "duration", "type", "repeating", "recurrence", "frequency", "interval", "repeatsOnDay", "remindBy", "firstReminder", "secondReminder", "humanReadable", "createdDate", "lastUpdatedDate", "createdByUserId", "createdByUsername", "lastUpdatedByUserId", "lastUpdatedByUsername", "recurringDates", @@ -127,7 +127,7 @@ public class CalendarsApiResource { final Set associationParameters = ApiParameterHelper.extractAssociationsForResponseIfProvided(uriInfo.getQueryParameters()); - Collection calendarsData = new ArrayList(); + Collection calendarsData = new ArrayList<>(); final List calendarTypeOptions = CalendarUtils.createIntegerListFromQueryParameter(calendarType); @@ -168,7 +168,7 @@ public class CalendarsApiResource { @Produces({ MediaType.APPLICATION_JSON }) public String createCalendar(@PathParam("entityType") final String entityType, @PathParam("entityId") final Long entityId, final String apiRequestBodyAsJson) { - + final CalendarEntityType calendarEntityType = CalendarEntityType.getEntityType(entityType); if (calendarEntityType == null) { throw new CalendarEntityTypeNotSupportedException(entityType); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/Calendar.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/Calendar.java index 2041f8a91..33a590dce 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/Calendar.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/Calendar.java @@ -83,7 +83,7 @@ public class Calendar extends AbstractAuditableCustom { @OneToMany(fetch = FetchType.EAGER) @JoinColumn(name = "calendar_id") - private Set calendarHistory = new HashSet(); + private final Set calendarHistory = new HashSet<>(); protected Calendar() { @@ -93,7 +93,7 @@ public class Calendar extends AbstractAuditableCustom { final LocalDate endDate, final Integer duration, final Integer typeId, final boolean repeating, final String recurrence, final Integer remindById, final Integer firstReminder, final Integer secondReminder) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(CALENDAR_RESOURCE_NAME); final CalendarType calendarType = CalendarType.fromInt(typeId); @@ -171,7 +171,7 @@ public class Calendar extends AbstractAuditableCustom { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(9); + final Map actualChanges = new LinkedHashMap<>(9); if (command.isChangeInStringParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue(), this.title)) { final String newValue = command.stringValueOfParameterNamed(CALENDAR_SUPPORTED_PARAMETERS.TITLE.getValue()); @@ -264,7 +264,7 @@ public class Calendar extends AbstractAuditableCustom { // if repeating is false then update recurrence to NULL if (!this.repeating) this.recurrence = null; - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(CALENDAR_RESOURCE_NAME); final CalendarType calendarType = CalendarType.fromInt(this.typeId); @@ -318,18 +318,19 @@ public class Calendar extends AbstractAuditableCustom { return actualChanges; } - + @SuppressWarnings("null") - public Map updateRepeatingCalendar(final LocalDate calendarStartDate, final CalendarFrequencyType frequencyType, final Integer interval, final Integer repeatsOnDay){ - final Map actualChanges = new LinkedHashMap(9); - - if(calendarStartDate != null & this.startDate != null){ - if(!calendarStartDate.equals(this.getStartDateLocalDate())){ + public Map updateRepeatingCalendar(final LocalDate calendarStartDate, final CalendarFrequencyType frequencyType, + final Integer interval, final Integer repeatsOnDay) { + final Map actualChanges = new LinkedHashMap<>(9); + + if (calendarStartDate != null & this.startDate != null) { + if (!calendarStartDate.equals(this.getStartDateLocalDate())) { actualChanges.put("startDate", calendarStartDate); this.startDate = calendarStartDate.toDate(); } } - + final String newRecurrence = Calendar.constructRecurrence(frequencyType, interval, repeatsOnDay); if (!StringUtils.isBlank(this.recurrence) && !newRecurrence.equalsIgnoreCase(this.recurrence)) { actualChanges.put("recurrence", newRecurrence); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarEntityType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarEntityType.java index 2641d020e..b90bfca91 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarEntityType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarEntityType.java @@ -29,7 +29,7 @@ public enum CalendarEntityType { return this.code; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); private static int minValue; private static int maxValue; static { @@ -115,7 +115,7 @@ public enum CalendarEntityType { return this.value.equals(CalendarEntityType.CLIENTS.getValue()); } - private static final Map entityNameToEnumMap = new HashMap(); + private static final Map entityNameToEnumMap = new HashMap<>(); static { for (final CalendarEntityType entityType : CalendarEntityType.values()) { @@ -126,7 +126,7 @@ public enum CalendarEntityType { public static CalendarEntityType getEntityType(String entityType) { return entityNameToEnumMap.get(entityType.toLowerCase()); } - + public static boolean isSavings(final Integer value) { return CalendarEntityType.SAVINGS.value.equals(value) ? true : false; } @@ -134,7 +134,7 @@ public enum CalendarEntityType { public static boolean isSavings(final String name) { return CalendarEntityType.SAVINGS.name().equalsIgnoreCase(name) ? true : false; } - + public boolean isSavings() { return this.value.equals(CalendarEntityType.SAVINGS.getValue()); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarFrequencyType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarFrequencyType.java index 7a7be41f0..8a87ea0ba 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarFrequencyType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarFrequencyType.java @@ -32,7 +32,7 @@ public enum CalendarFrequencyType { return this.code; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); private static int minValue = CalendarFrequencyType.DAILY.value; private static int maxValue = CalendarFrequencyType.YEARLY.value; @@ -86,8 +86,10 @@ public enum CalendarFrequencyType { return this.value.equals(CalendarFrequencyType.INVALID.value); } - /** To convert from period frequency type tp calendar frequency type. - * This method requires code refactoring. + /** + * To convert from period frequency type tp calendar frequency type. This + * method requires code refactoring. + * * @param periodFrequencyType * @return */ @@ -105,9 +107,11 @@ public enum CalendarFrequencyType { return CalendarFrequencyType.INVALID; } } - - /** To convert from period frequency type tp calendar frequency type. - * This method requires code refactoring. + + /** + * To convert from period frequency type tp calendar frequency type. This + * method requires code refactoring. + * * @param frequencyType * @return */ diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarRemindBy.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarRemindBy.java index a3f6b8400..f9982e69f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarRemindBy.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarRemindBy.java @@ -28,7 +28,7 @@ public enum CalendarRemindBy { return this.code; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); private static int minValue; private static int maxValue; static { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarType.java index 092f8c9c1..05833fdf3 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarType.java @@ -29,7 +29,7 @@ public enum CalendarType { return this.code; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); private static int minValue; private static int maxValue; static { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarWeekDaysType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarWeekDaysType.java index 1845d5753..3423076c5 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarWeekDaysType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/domain/CalendarWeekDaysType.java @@ -32,7 +32,7 @@ public enum CalendarWeekDaysType { return this.code; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); private static int minValue = CalendarWeekDaysType.MO.value; private static int maxValue = CalendarWeekDaysType.SU.value; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/serialization/CalendarCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/serialization/CalendarCommandFromApiJsonDeserializer.java index fc18c9859..deeeee2b9 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/serialization/CalendarCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/serialization/CalendarCommandFromApiJsonDeserializer.java @@ -86,7 +86,7 @@ public class CalendarCommandFromApiJsonDeserializer extends AbstractFromApiJsonD this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("calendar"); @@ -196,7 +196,7 @@ public class CalendarCommandFromApiJsonDeserializer extends AbstractFromApiJsonD this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("calendar"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarEnumerations.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarEnumerations.java index 7a82bbceb..7991058cc 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarEnumerations.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarEnumerations.java @@ -27,7 +27,7 @@ public class CalendarEnumerations { } public static List calendarEntityType(final CalendarEntityType[] entityTypes) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final CalendarEntityType entityType : entityTypes) { optionDatas.add(calendarEntityType(entityType)); } @@ -44,7 +44,7 @@ public class CalendarEnumerations { } public static List calendarType(final CalendarType[] types) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final CalendarType type : types) { optionDatas.add(calendarType(type)); } @@ -61,7 +61,7 @@ public class CalendarEnumerations { } public static List calendarRemindBy(final CalendarRemindBy[] remindBys) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final CalendarRemindBy remindBy : remindBys) { optionDatas.add(calendarRemindBy(remindBy)); } @@ -79,7 +79,7 @@ public class CalendarEnumerations { } public static List calendarFrequencyType(final CalendarFrequencyType[] calendarFrequencyTypes) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final CalendarFrequencyType calendarFrequencyType : calendarFrequencyTypes) { if (!calendarFrequencyType.isInvalid()) { optionDatas.add(calendarFrequencyType(calendarFrequencyType)); @@ -99,7 +99,7 @@ public class CalendarEnumerations { } public static List calendarWeekDaysType(final CalendarWeekDaysType[] calendarWeekDaysTypes) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final CalendarWeekDaysType calendarWeekDaysType : calendarWeekDaysTypes) { if (!calendarWeekDaysType.isInvalid()) { optionDatas.add(calendarWeekDaysType(calendarWeekDaysType)); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarReadPlatformServiceImpl.java index be5d039d4..59831792e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarReadPlatformServiceImpl.java @@ -311,7 +311,7 @@ public class CalendarReadPlatformServiceImpl implements CalendarReadPlatformServ @Override public Collection updateWithRecurringDates(final Collection calendarsData) { - final Collection recuCalendarsData = new ArrayList(); + final Collection recuCalendarsData = new ArrayList<>(); final boolean withHistory = true; final LocalDate tillDate = null; for (final CalendarData calendarData : calendarsData) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarUtils.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarUtils.java index c77c273d2..4fa960502 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarUtils.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarUtils.java @@ -106,7 +106,7 @@ public class CalendarUtils { private static Collection convertToLocalDateList(final DateList dates) { - final Collection recurringDates = new ArrayList(); + final Collection recurringDates = new ArrayList<>(); for (@SuppressWarnings("rawtypes") final Iterator iterator = dates.iterator(); iterator.hasNext();) { @@ -394,7 +394,7 @@ public class CalendarUtils { } public static List createIntegerListFromQueryParameter(final String calendarTypeQuery) { - final List calendarTypeOptions = new ArrayList(); + final List calendarTypeOptions = new ArrayList<>(); // adding all calendar Types if query parameter is "all" if (calendarTypeQuery.equalsIgnoreCase("all")) { calendarTypeOptions.add(1); @@ -405,7 +405,7 @@ public class CalendarUtils { } // creating a list of calendar type options from the comma separated // query parameter. - final List calendarTypeOptionsInQuery = new ArrayList(); + final List calendarTypeOptionsInQuery = new ArrayList<>(); final StringTokenizer st = new StringTokenizer(calendarTypeQuery, ","); while (st.hasMoreElements()) { calendarTypeOptionsInQuery.add(st.nextElement().toString()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarWritePlatformServiceJpaRepositoryImpl.java index 0889895ab..3c6fdb158 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/calendar/service/CalendarWritePlatformServiceJpaRepositoryImpl.java @@ -103,7 +103,7 @@ public class CalendarWritePlatformServiceJpaRepositoryImpl implements CalendarWr final Integer entityTypeId = entityType.getValue(); final Calendar newCalendar = Calendar.fromJson(command); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("calendar"); if (entityActivationDate == null || newCalendar.getStartDateLocalDate().isBefore(entityActivationDate)) { final DateTimeFormatter formatter = DateTimeFormat.forPattern(command.dateFormat()).withLocale(command.extractLocale()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/api/ChargesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/api/ChargesApiResource.java index 154c7f108..e52f8e27c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/api/ChargesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/api/ChargesApiResource.java @@ -41,7 +41,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class ChargesApiResource { - private final Set CHARGES_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "name", "amount", "currency", "penalty", + private final Set CHARGES_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "amount", "currency", "penalty", "active", "chargeAppliesTo", "chargeTimeType", "chargeCalculationType", "chargeCalculationTypeOptions", "chargeAppliesToOptions", "chargeTimeTypeOptions", "currencyOptions", "loanChargeCalculationTypeOptions", "loanChargeTimeTypeOptions", "savingsChargeCalculationTypeOptions", "savingsChargeTimeTypeOptions")); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/domain/Charge.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/domain/Charge.java index 8d5020209..f079079d6 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/domain/Charge.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/domain/Charge.java @@ -129,7 +129,7 @@ public class Charge extends AbstractPersistable { this.active = active; this.chargePaymentMode = paymentMode == null ? null : paymentMode.getValue(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("charges"); if (isMonthlyFee() || isAnnualFee()) { @@ -258,11 +258,11 @@ public class Charge extends AbstractPersistable { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(7); + final Map actualChanges = new LinkedHashMap<>(7); final String localeAsInput = command.locale(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("charges"); final String nameParamName = "name"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/serialization/ChargeDefinitionCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/serialization/ChargeDefinitionCommandFromApiJsonDeserializer.java index 85555d4fd..324602ae8 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/serialization/ChargeDefinitionCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/serialization/ChargeDefinitionCommandFromApiJsonDeserializer.java @@ -39,7 +39,7 @@ public final class ChargeDefinitionCommandFromApiJsonDeserializer { /** * The parameters supported for this command. */ - private final Set supportedParameters = new HashSet(Arrays.asList("name", "amount", "locale", "currencyCode", + private final Set supportedParameters = new HashSet<>(Arrays.asList("name", "amount", "locale", "currencyCode", "currencyOptions", "chargeAppliesTo", "chargeTimeType", "chargeCalculationType", "chargeCalculationTypeOptions", "penalty", "active", "chargePaymentMode", "feeOnMonthDay", "feeInterval", "monthDayFormat", "minCap", "maxCap", "feeFrequency")); @@ -56,7 +56,7 @@ public final class ChargeDefinitionCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("charge"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -113,12 +113,13 @@ public final class ChargeDefinitionCommandFromApiJsonDeserializer { } final ChargeTimeType ctt = ChargeTimeType.fromInt(chargeTimeType); - + if (ctt.isWeeklyFee()) { - final String monthDay = this.fromApiJsonHelper.extractStringNamed("feeOnMonthDay", element); - baseDataValidator.reset().parameter("feeOnMonthDay").value(monthDay).mustBeBlankWhenParameterProvidedIs("chargeTimeType", chargeTimeType); + final String monthDay = this.fromApiJsonHelper.extractStringNamed("feeOnMonthDay", element); + baseDataValidator.reset().parameter("feeOnMonthDay").value(monthDay) + .mustBeBlankWhenParameterProvidedIs("chargeTimeType", chargeTimeType); } - + if (ctt.isMonthlyFee()) { final MonthDay monthDay = this.fromApiJsonHelper.extractMonthDayNamed("feeOnMonthDay", element); baseDataValidator.reset().parameter("feeOnMonthDay").value(monthDay).notNull(); @@ -174,7 +175,7 @@ public final class ChargeDefinitionCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("charge"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -217,7 +218,7 @@ public final class ChargeDefinitionCommandFromApiJsonDeserializer { final Collection validLoanValues = Arrays.asList(ChargeTimeType.validLoanValues()); final Collection validSavingsValues = Arrays.asList(ChargeTimeType.validSavingsValues()); - final Collection allValidValues = new ArrayList(validLoanValues); + final Collection allValidValues = new ArrayList<>(validLoanValues); allValidValues.addAll(validSavingsValues); baseDataValidator.reset().parameter("chargeTimeType").value(chargeTimeType).notNull() diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeDropdownReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeDropdownReadPlatformServiceImpl.java index 91e291ef1..907000762 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeDropdownReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/charge/service/ChargeDropdownReadPlatformServiceImpl.java @@ -32,7 +32,7 @@ public class ChargeDropdownReadPlatformServiceImpl implements ChargeDropdownRead @Override public List retrieveApplicableToTypes() { - final List chargeAppliesToTypes = new ArrayList(); + final List chargeAppliesToTypes = new ArrayList<>(); for (final ChargeAppliesTo chargeAppliesTo : ChargeAppliesTo.values()) { if (ChargeAppliesTo.INVALID.equals(chargeAppliesTo)) { continue; @@ -44,7 +44,7 @@ public class ChargeDropdownReadPlatformServiceImpl implements ChargeDropdownRead @Override public List retrieveCollectionTimeTypes() { - final List chargeTimeTypes = new ArrayList(); + final List chargeTimeTypes = new ArrayList<>(); for (final ChargeTimeType chargeTimeType : ChargeTimeType.values()) { if (ChargeTimeType.INVALID.equals(chargeTimeType) || ChargeTimeType.SAVINGS_CLOSURE.equals(chargeTimeType)) { continue; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientApiConstants.java index f2ec031d8..cb1882d0b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientApiConstants.java @@ -70,13 +70,13 @@ public class ClientApiConstants { public static final String officeOptionsParamName = "officeOptions"; public static final String staffOptionsParamName = "staffOptions"; - public static final Set CLIENT_CREATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set CLIENT_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, groupIdParamName, accountNoParamName, externalIdParamName, mobileNoParamName, firstnameParamName, middlenameParamName, lastnameParamName, fullnameParamName, officeIdParamName, activeParamName, activationDateParamName, staffIdParamName, submittedOnDateParamName, savingsProductIdParamName, dateOfBirthParamName, genderIdParamName, clientTypeIdParamName, clientClassificationIdParamName)); - public static final Set CLIENT_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set CLIENT_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, accountNoParamName, externalIdParamName, mobileNoParamName, firstnameParamName, middlenameParamName, lastnameParamName, fullnameParamName, activeParamName, activationDateParamName, staffIdParamName, savingsProductIdParamName, dateOfBirthParamName, genderIdParamName, clientTypeIdParamName, clientClassificationIdParamName)); @@ -86,16 +86,16 @@ public class ClientApiConstants { * {@link ClientData}. Where possible, we try to get response parameters to * match those of request parameters. */ - public static final Set CLIENT_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName, accountNoParamName, + public static final Set CLIENT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, accountNoParamName, externalIdParamName, statusParamName, activeParamName, activationDateParamName, firstnameParamName, middlenameParamName, lastnameParamName, fullnameParamName, displayNameParamName, mobileNoParamName, officeIdParamName, officeNameParamName, transferToOfficeIdParamName, transferToOfficeNameParamName, hierarchyParamName, imageIdParamName, imagePresentParamName, staffIdParamName, staffNameParamName, timelineParamName, groupsParamName, officeOptionsParamName, staffOptionsParamName, dateOfBirthParamName, genderParamName,clientTypeParamName,clientClassificationParamName)); - public static final Set ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, activationDateParamName)); - public static final Set CLIENT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set CLIENT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, closureDateParamName, closureReasonIdParamName)); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientIdentifiersApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientIdentifiersApiResource.java index 1f79f67bf..d0f946ff9 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientIdentifiersApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientIdentifiersApiResource.java @@ -46,7 +46,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class ClientIdentifiersApiResource { - private static final Set CLIENT_IDENTIFIER_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "clientId", + private static final Set CLIENT_IDENTIFIER_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "clientId", "documentType", "documentKey", "description", "allowedDocumentTypes")); private final String resourceNameForPermissions = "CLIENTIDENTIFIER"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientsApiResource.java index 4dad051fc..b91043b54 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/api/ClientsApiResource.java @@ -261,7 +261,7 @@ public class ClientsApiResource { final AccountSummaryCollectionData clientAccount = this.accountDetailsReadPlatformService.retrieveClientAccountDetails(clientId); - final Set CLIENT_ACCOUNTS_DATA_PARAMETERS = new HashSet(Arrays.asList("loanAccounts", "savingsAccounts")); + final Set CLIENT_ACCOUNTS_DATA_PARAMETERS = new HashSet<>(Arrays.asList("loanAccounts", "savingsAccounts")); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); return this.clientAccountSummaryToApiJsonSerializer.serialize(settings, clientAccount, CLIENT_ACCOUNTS_DATA_PARAMETERS); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/command/ClientIdentifierCommand.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/command/ClientIdentifierCommand.java index 038249f43..c7093f67a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/command/ClientIdentifierCommand.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/command/ClientIdentifierCommand.java @@ -40,7 +40,7 @@ public class ClientIdentifierCommand { } public void validateForCreate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("clientIdentifier"); @@ -52,7 +52,7 @@ public class ClientIdentifierCommand { } public void validateForUpdate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("clientIdentifier"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/command/ClientNoteCommand.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/command/ClientNoteCommand.java index 6c73a7f82..5acd28fa3 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/command/ClientNoteCommand.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/command/ClientNoteCommand.java @@ -24,7 +24,7 @@ public class ClientNoteCommand { } public void validate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("clientnote"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/data/ClientDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/data/ClientDataValidator.java index c154294c3..6914642c5 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/data/ClientDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/data/ClientDataValidator.java @@ -47,7 +47,7 @@ public final class ClientDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.CLIENT_CREATE_REQUEST_DATA_PARAMETERS); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(ClientApiConstants.CLIENT_RESOURCE_NAME); @@ -244,7 +244,7 @@ public final class ClientDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.CLIENT_UPDATE_REQUEST_DATA_PARAMETERS); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(ClientApiConstants.CLIENT_RESOURCE_NAME); @@ -382,7 +382,7 @@ public final class ClientDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.ACTIVATION_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(ClientApiConstants.CLIENT_RESOURCE_NAME); @@ -407,12 +407,12 @@ public final class ClientDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); - final Set supportedParametersUnassignStaff = new HashSet(Arrays.asList(ClientApiConstants.staffIdParamName)); + final Set supportedParametersUnassignStaff = new HashSet<>(Arrays.asList(ClientApiConstants.staffIdParamName)); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParametersUnassignStaff); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(ClientApiConstants.CLIENT_RESOURCE_NAME); @@ -431,12 +431,12 @@ public final class ClientDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); - final Set supportedParametersUnassignStaff = new HashSet(Arrays.asList(ClientApiConstants.staffIdParamName)); + final Set supportedParametersUnassignStaff = new HashSet<>(Arrays.asList(ClientApiConstants.staffIdParamName)); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParametersUnassignStaff); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(ClientApiConstants.CLIENT_RESOURCE_NAME); @@ -458,7 +458,7 @@ public final class ClientDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, ClientApiConstants.CLIENT_CLOSE_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(ClientApiConstants.CLIENT_RESOURCE_NAME); @@ -480,12 +480,12 @@ public final class ClientDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); - final Set supportedParameters = new HashSet(Arrays.asList(ClientApiConstants.savingsAccountIdParamName)); + final Set supportedParameters = new HashSet<>(Arrays.asList(ClientApiConstants.savingsAccountIdParamName)); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(ClientApiConstants.CLIENT_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/Client.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/Client.java index 75288993e..d0a62e814 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/Client.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/Client.java @@ -273,7 +273,7 @@ public final class Client extends AbstractPersistable { } if (clientParentGroup != null) { - this.groups = new HashSet(); + this.groups = new HashSet<>(); this.groups.add(clientParentGroup); } @@ -295,7 +295,7 @@ public final class Client extends AbstractPersistable { } private void validate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); validateNameParts(dataValidationErrors); validateActivationDate(dataValidationErrors); if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } @@ -329,7 +329,7 @@ public final class Client extends AbstractPersistable { final ApiParameterError error = ApiParameterError.parameterError("error.msg.clients.already.active", defaultUserMessage, ClientApiConstants.activationDateParamName, activationLocalDate.toString(formatter)); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); dataValidationErrors.add(error); throw new PlatformApiDataValidationException(dataValidationErrors); @@ -381,7 +381,7 @@ public final class Client extends AbstractPersistable { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(9); + final Map actualChanges = new LinkedHashMap<>(9); if (command.isChangeInIntegerParameterNamed(ClientApiConstants.statusParamName, this.status)) { final Integer newValue = command.integerValueOfParameterNamed(ClientApiConstants.statusParamName); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/ClientIdentifier.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/ClientIdentifier.java index 46a75e728..9362c7717 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/ClientIdentifier.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/domain/ClientIdentifier.java @@ -64,7 +64,7 @@ public class ClientIdentifier extends AbstractAuditableCustom { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(7); + final Map actualChanges = new LinkedHashMap<>(7); final String documentTypeIdParamName = "documentTypeId"; if (command.isChangeInLongParameterNamed(documentTypeIdParamName, this.documentType.getId())) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/serialization/ClientIdentifierCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/serialization/ClientIdentifierCommandFromApiJsonDeserializer.java index e7626da2c..91f52b386 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/serialization/ClientIdentifierCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/serialization/ClientIdentifierCommandFromApiJsonDeserializer.java @@ -33,7 +33,7 @@ public final class ClientIdentifierCommandFromApiJsonDeserializer extends Abstra /** * The parameters supported for this command. */ - private final Set supportedParameters = new HashSet(Arrays.asList("documentTypeId", "documentKey", "description")); + private final Set supportedParameters = new HashSet<>(Arrays.asList("documentTypeId", "documentKey", "description")); private final FromJsonHelper fromApiJsonHelper; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java index 9648bd8de..194801c26 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientReadPlatformServiceImpl.java @@ -54,7 +54,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService private final CodeValueReadPlatformService codeValueReadPlatformService; private final SavingsProductReadPlatformService savingsProductReadPlatformService; // data mappers - private final PaginationHelper paginationHelper = new PaginationHelper(); + private final PaginationHelper paginationHelper = new PaginationHelper<>(); private final ClientMapper clientMapper = new ClientMapper(); private final ClientLookupMapper lookupMapper = new ClientLookupMapper(); private final ClientMembersOfGroupMapper membersOfGroupMapper = new ClientMembersOfGroupMapper(); @@ -95,13 +95,13 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService if (CollectionUtils.isEmpty(staffOptions)) { staffOptions = null; } - final List genderOptions = new ArrayList( + final List genderOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.GENDER)); - final List clientTypeOptions = new ArrayList( + final List clientTypeOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.CLIENT_TYPE)); - final List clientClassificationOptions = new ArrayList( + final List clientClassificationOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.CLIENT_CLASSIFICATION)); return ClientData.template(defaultOfficeId, new LocalDate(), offices, staffOptions, null, genderOptions, savingsProductDatas, @@ -645,7 +645,7 @@ public class ClientReadPlatformServiceImpl implements ClientReadPlatformService @Override public ClientData retrieveAllClosureReasons(final String clientClosureReason) { - final List closureReasons = new ArrayList( + final List closureReasons = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(clientClosureReason)); final Collection clientTypeOptions = null; final Collection clientClassificationOptions = null; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientWritePlatformServiceJpaRepositoryImpl.java index a6832e786..50487b651 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/client/service/ClientWritePlatformServiceJpaRepositoryImpl.java @@ -400,7 +400,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP this.context.authenticatedUser(); - final Map actualChanges = new LinkedHashMap(5); + final Map actualChanges = new LinkedHashMap<>(5); this.fromApiJsonDeserializer.validateForUnassignStaff(command.json()); @@ -432,7 +432,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP this.context.authenticatedUser(); - final Map actualChanges = new LinkedHashMap(5); + final Map actualChanges = new LinkedHashMap<>(5); this.fromApiJsonDeserializer.validateForAssignStaff(command.json()); @@ -536,7 +536,7 @@ public class ClientWritePlatformServiceJpaRepositoryImpl implements ClientWriteP this.context.authenticatedUser(); - final Map actualChanges = new LinkedHashMap(5); + final Map actualChanges = new LinkedHashMap<>(5); this.fromApiJsonDeserializer.validateForSavingsAccount(command.json()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/api/CollateralApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/api/CollateralApiConstants.java index 797b5fca5..83b55f084 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/api/CollateralApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/api/CollateralApiConstants.java @@ -24,7 +24,7 @@ public class CollateralApiConstants { this.value = value; } - private static final Set values = new HashSet(); + private static final Set values = new HashSet<>(); static { for (final COLLATERAL_JSON_INPUT_PARAMS type : COLLATERAL_JSON_INPUT_PARAMS.values()) { values.add(type.value); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/api/CollateralsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/api/CollateralsApiResource.java index 409465ad9..b098fe48a 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/api/CollateralsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/api/CollateralsApiResource.java @@ -44,7 +44,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class CollateralsApiResource { - private static final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "type", "value", "description", + private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "type", "value", "description", "allowedCollateralTypes", "currency")); private final String resourceNameForPermission = "COLLATERAL"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/command/CollateralCommand.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/command/CollateralCommand.java index 5c1f35fe4..93f814f7e 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/command/CollateralCommand.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/command/CollateralCommand.java @@ -42,7 +42,7 @@ public class CollateralCommand { } public void validateForCreate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("collateral"); @@ -58,7 +58,7 @@ public class CollateralCommand { } public void validateForUpdate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("collateral"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/domain/LoanCollateral.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/domain/LoanCollateral.java index 8e6eb8edf..662ab6963 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/domain/LoanCollateral.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/domain/LoanCollateral.java @@ -77,7 +77,7 @@ public class LoanCollateral extends AbstractPersistable { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(7); + final Map actualChanges = new LinkedHashMap<>(7); final String collateralTypeIdParamName = COLLATERAL_JSON_INPUT_PARAMS.COLLATERAL_TYPE_ID.getValue(); if (command.isChangeInLongParameterNamed(collateralTypeIdParamName, this.type.getId())) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/service/CollateralAssembler.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/service/CollateralAssembler.java index f3e39e194..d1c9b810b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/service/CollateralAssembler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collateral/service/CollateralAssembler.java @@ -40,7 +40,7 @@ public class CollateralAssembler { public Set fromParsedJson(final JsonElement element) { - final Set collateralItems = new HashSet(); + final Set collateralItems = new HashSet<>(); if (element.isJsonObject()) { final JsonObject topLevelJsonElement = element.getAsJsonObject(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/CollectionSheetConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/CollectionSheetConstants.java index b6616eb85..5dc4a3b4b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/CollectionSheetConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/CollectionSheetConstants.java @@ -33,7 +33,7 @@ public class CollectionSheetConstants { public static final String savingsIdParamName = "savingsId"; public static final String transactionAmountParamName = "transactionAmount"; - public static final Set COLLECTIONSHEET_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set COLLECTIONSHEET_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, transactionDateParamName, actualDisbursementDateParamName, bulkRepaymentTransactionsParamName, bulkDisbursementTransactionsParamName, noteParamName, calendarIdParamName, clientsAttendanceParamName, bulkSavingsDueTransactionsParamName)); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java index 63bcc46fc..4dadb63e8 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/data/CollectionSheetTransactionDataValidator.java @@ -60,7 +60,7 @@ public class CollectionSheetTransactionDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, COLLECTIONSHEET_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(COLLECTIONSHEET_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/serialization/CollectionSheetGenerateCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/serialization/CollectionSheetGenerateCommandFromApiJsonDeserializer.java index 8b95bdc30..ad68a62c5 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/serialization/CollectionSheetGenerateCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/serialization/CollectionSheetGenerateCommandFromApiJsonDeserializer.java @@ -37,7 +37,7 @@ public class CollectionSheetGenerateCommandFromApiJsonDeserializer { /** * The parameters supported for this command. */ - final Set supportedParameters = new HashSet(Arrays.asList(transactionDateParamName, localeParamName, + final Set supportedParameters = new HashSet<>(Arrays.asList(transactionDateParamName, localeParamName, dateFormatParamName, calendarIdParamName)); private final FromJsonHelper fromApiJsonHelper; @@ -55,7 +55,7 @@ public class CollectionSheetGenerateCommandFromApiJsonDeserializer { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("collectionsheet"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java index 1128b99de..0076a843e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetReadPlatformServiceImpl.java @@ -95,14 +95,14 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe Long prevGroupId = null; Long prevClientId = null; - final List jlgGroupsData = new ArrayList(); - List clientsData = new ArrayList(); - List loansDueData = new ArrayList(); + final List jlgGroupsData = new ArrayList<>(); + List clientsData = new ArrayList<>(); + List loansDueData = new ArrayList<>(); JLGCollectionSheetData jlgCollectionSheetData = null; JLGCollectionSheetFlatData prevCollectioSheetFlatData = null; JLGCollectionSheetFlatData corrCollectioSheetFlatData = null; - final Set loanProducts = new HashSet(); + final Set loanProducts = new HashSet<>(); if (jlgCollectionSheetFlatData != null) { for (final JLGCollectionSheetFlatData collectionSheetFlatData : jlgCollectionSheetFlatData) { @@ -122,7 +122,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe final JLGClientData clientData = prevCollectioSheetFlatData.getClientData(); clientData.setLoans(loansDueData); clientsData.add(clientData); - loansDueData = new ArrayList(); + loansDueData = new ArrayList<>(); if (collectionSheetFlatData.getLoanId() != null) { loansDueData.add(collectionSheetFlatData.getLoanDueData()); @@ -140,8 +140,8 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe jlgGroupsData.add(jlgGroupData); - loansDueData = new ArrayList(); - clientsData = new ArrayList(); + loansDueData = new ArrayList<>(); + clientsData = new ArrayList<>(); if (collectionSheetFlatData.getLoanId() != null) { loansDueData.add(collectionSheetFlatData.getLoanDueData()); @@ -368,7 +368,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe } private Collection retrieveSavingsProducts(Collection groupsWithSavingsData) { - List savingsProducts = new ArrayList(); + List savingsProducts = new ArrayList<>(); for (JLGGroupData groupSavingsData : groupsWithSavingsData) { Collection clientsSavingsData = groupSavingsData.getClients(); for (JLGClientData clientSavingsData : clientsSavingsData) { @@ -429,7 +429,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe private static final class MandatorySavingsCollectionsheetExtractor implements ResultSetExtractor> { - private GroupSavingsDataMapper groupSavingsDataMapper = new GroupSavingsDataMapper(); + private final GroupSavingsDataMapper groupSavingsDataMapper = new GroupSavingsDataMapper(); public String collectionSheetSchema(final boolean isCenterCollection) { @@ -482,7 +482,7 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe @Override public Collection extractData(ResultSet rs) throws SQLException, DataAccessException { - List groups = new ArrayList(); + List groups = new ArrayList<>(); JLGGroupData group = null; int groupIndex = 0; @@ -504,20 +504,20 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe private static final class GroupSavingsDataMapper implements RowMapper { - private ClientSavingsDataMapper clientSavingsDataMapper = new ClientSavingsDataMapper(); + private final ClientSavingsDataMapper clientSavingsDataMapper = new ClientSavingsDataMapper(); private GroupSavingsDataMapper() {} public JLGGroupData mapRowData(ResultSet rs, int rowNum) throws SQLException { - final List clients = new ArrayList(); + final List clients = new ArrayList<>(); final JLGGroupData group = this.mapRow(rs, rowNum); final Long previousGroupId = group.getGroupId(); - + // first client row of new group JLGClientData client = clientSavingsDataMapper.mapRowData(rs, rowNum); clients.add(client); - - //if its not after last row loop + + // if its not after last row loop while (!rs.isAfterLast()) { final Long groupId = JdbcSupport.getLong(rs, "groupId"); if (previousGroupId != null && groupId.compareTo(previousGroupId) != 0) { @@ -546,17 +546,17 @@ public class CollectionSheetReadPlatformServiceImpl implements CollectionSheetRe private static final class ClientSavingsDataMapper implements RowMapper { - private SavingsDueDataMapper savingsDueDataMapper = new SavingsDueDataMapper(); + private final SavingsDueDataMapper savingsDueDataMapper = new SavingsDueDataMapper(); private ClientSavingsDataMapper() {} public JLGClientData mapRowData(ResultSet rs, int rowNum) throws SQLException { - List savings = new ArrayList(); + List savings = new ArrayList<>(); JLGClientData client = this.mapRow(rs, rowNum); final Long previousClientId = client.getClientId(); - + // first savings row of new client record SavingsDueData saving = savingsDueDataMapper.mapRow(rs, rowNum); savings.add(saving); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetWritePlatformServiceJpaRepositoryImpl.java index 085b1d1c4..0ea08fa57 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/collectionsheet/service/CollectionSheetWritePlatformServiceJpaRepositoryImpl.java @@ -58,7 +58,7 @@ public class CollectionSheetWritePlatformServiceJpaRepositoryImpl implements Col this.transactionDataValidator.validateTransaction(command); - final Map changes = new HashMap(); + final Map changes = new HashMap<>(); changes.put("locale", command.locale()); changes.put("dateFormat", command.dateFormat()); @@ -83,7 +83,7 @@ public class CollectionSheetWritePlatformServiceJpaRepositoryImpl implements Col } private Map updateBulkReapayments(final JsonCommand command) { - final Map changes = new HashMap(); + final Map changes = new HashMap<>(); final CollectionSheetBulkRepaymentCommand bulkRepaymentCommand = this.bulkRepaymentCommandFromApiJsonDeserializer .commandFromApiJson(command.json()); changes.putAll(this.loanWritePlatformService.makeLoanBulkRepayment(bulkRepaymentCommand)); @@ -91,7 +91,7 @@ public class CollectionSheetWritePlatformServiceJpaRepositoryImpl implements Col } private Map updateBulkDisbursals(final JsonCommand command) { - final Map changes = new HashMap(); + final Map changes = new HashMap<>(); final CollectionSheetBulkDisbursalCommand bulkDisbursalCommand = this.bulkDisbursalCommandFromApiJsonDeserializer .commandFromApiJson(command.json()); changes.putAll(this.loanWritePlatformService.bulkLoanDisbursal(command, bulkDisbursalCommand, false)); @@ -99,7 +99,7 @@ public class CollectionSheetWritePlatformServiceJpaRepositoryImpl implements Col } private Map updateBulkMandatorySavingsDuePayments(final JsonCommand command) { - final Map changes = new HashMap(); + final Map changes = new HashMap<>(); final Collection savingsTransactions = this.accountAssembler.assembleBulkMandatorySavingsAccountTransactionDTOs(command); for (SavingsAccountTransactionDTO savingsAccountTransactionDTO : savingsTransactions) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/common/domain/ConditionType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/common/domain/ConditionType.java index a138641c0..8aed32d19 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/common/domain/ConditionType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/common/domain/ConditionType.java @@ -21,7 +21,7 @@ public enum ConditionType { private final Integer value; private final String code; - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); static { for (final ConditionType type : ConditionType.values()) { intToEnumMap.put(type.value, type); @@ -72,7 +72,7 @@ public enum ConditionType { } public static Object[] integerValues() { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final ConditionType enumType : values()) { if (!enumType.isInvalid()) { values.add(enumType.getValue()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/common/domain/PeriodFrequencyType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/common/domain/PeriodFrequencyType.java index 16f90c397..70a160022 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/common/domain/PeriodFrequencyType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/common/domain/PeriodFrequencyType.java @@ -66,7 +66,7 @@ public enum PeriodFrequencyType { } public static Object[] integerValues() { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final PeriodFrequencyType enumType : values()) { if (!enumType.isInvalid()) { values.add(enumType.getValue()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/common/service/CommonEnumerations.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/common/service/CommonEnumerations.java index f75d362ad..4e84134b2 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/common/service/CommonEnumerations.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/common/service/CommonEnumerations.java @@ -71,7 +71,7 @@ public class CommonEnumerations { } public static List conditionType(final ConditionType[] conditionTypes, final String codePrefix) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final ConditionType conditionType : conditionTypes) { if (!conditionType.isInvalid()) { optionDatas.add(conditionType(conditionType, codePrefix)); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/api/FundsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/api/FundsApiResource.java index 504fee687..84dc62c7f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/api/FundsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/api/FundsApiResource.java @@ -44,7 +44,7 @@ public class FundsApiResource { /** * The set of parameters that are supported in response for {@link CodeData} */ - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "name", "externalId")); + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "externalId")); private final String resourceNameForPermissions = "FUND"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/domain/Fund.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/domain/Fund.java index f7964bd04..2b42ab55d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/domain/Fund.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/domain/Fund.java @@ -50,7 +50,7 @@ public class Fund extends AbstractPersistable { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(7); + final Map actualChanges = new LinkedHashMap<>(7); final String nameParamName = "name"; if (command.isChangeInStringParameterNamed(nameParamName, this.name)) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/serialization/FundCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/serialization/FundCommandFromApiJsonDeserializer.java index 63c72116f..1de6bc9df 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/serialization/FundCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/fund/serialization/FundCommandFromApiJsonDeserializer.java @@ -31,7 +31,7 @@ public final class FundCommandFromApiJsonDeserializer { /** * The parameters supported for this command. */ - private final Set supportedParameters = new HashSet(Arrays.asList("name", "externalId")); + private final Set supportedParameters = new HashSet<>(Arrays.asList("name", "externalId")); private final FromJsonHelper fromApiJsonHelper; @@ -46,7 +46,7 @@ public final class FundCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("fund"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -66,7 +66,7 @@ public final class FundCommandFromApiJsonDeserializer { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("fund"); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/CentersApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/CentersApiResource.java index 57cb48b92..26eea0a9c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/CentersApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/CentersApiResource.java @@ -300,7 +300,7 @@ public class CentersApiResource { final AccountSummaryCollectionData groupAccount = this.accountDetailsReadPlatformService.retrieveGroupAccountDetails(centerId); - final Set GROUP_ACCOUNTS_DATA_PARAMETERS = new HashSet(Arrays.asList("loanAccounts", "savingsAccounts", + final Set GROUP_ACCOUNTS_DATA_PARAMETERS = new HashSet<>(Arrays.asList("loanAccounts", "savingsAccounts", "memberLoanAccounts", "memberSavingsAccounts")); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/GroupingTypesApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/GroupingTypesApiConstants.java index 844a55dd2..23d4050f3 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/GroupingTypesApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/GroupingTypesApiConstants.java @@ -67,15 +67,15 @@ public class GroupingTypesApiConstants { // staff centres parameters public static final String meetingFallCenters = "meetingFallCenters"; - public static final Set CENTER_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set CENTER_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, idParamName, nameParamName, externalIdParamName, officeIdParamName, staffIdParamName, activeParamName, activationDateParamName, groupMembersParamName, submittedOnDateParamName)); - public static final Set GROUP_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, dateFormatParamName, + public static final Set GROUP_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, idParamName, nameParamName, externalIdParamName, centerIdParamName, officeIdParamName, staffIdParamName, activeParamName, activationDateParamName, clientMembersParamName, collectionMeetingCalendar, submittedOnDateParamName)); - public static final Set GROUP_ROLES_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(roleParamName, + public static final Set GROUP_ROLES_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(roleParamName, clientIdParamName)); /** @@ -83,29 +83,29 @@ public class GroupingTypesApiConstants { * {@link CenterData}. Where possible, we try to get response parameters to * match those of request parameters. */ - public static final Set CENTER_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName, nameParamName, + public static final Set CENTER_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, nameParamName, externalIdParamName, officeIdParamName, officeNameParamName, staffIdParamName, staffNameParamName, hierarchyParamName, officeOptionsParamName, staffOptionsParamName, statusParamName, activeParamName, activationDateParamName, timeLine, groupMembersParamName, collectionMeetingCalendar, closureReasons)); - public static final Set CENTER_GROUP_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName, nameParamName, + public static final Set CENTER_GROUP_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, nameParamName, externalIdParamName, officeIdParamName, officeNameParamName, staffIdParamName, staffNameParamName, hierarchyParamName, officeOptionsParamName, staffOptionsParamName, clientOptionsParamName)); - public static final Set GROUP_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName, nameParamName, + public static final Set GROUP_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, nameParamName, externalIdParamName, officeIdParamName, officeNameParamName, "parentId", "parentName", staffIdParamName, staffNameParamName, hierarchyParamName, officeOptionsParamName, statusParamName, activeParamName, activationDateParamName, staffOptionsParamName, clientOptionsParamName, timeLine)); - public static final Set ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, activationDateParamName)); - public static final Set COLLECTIONSHEET_DATA_PARAMETERS = new HashSet( + public static final Set COLLECTIONSHEET_DATA_PARAMETERS = new HashSet<>( Arrays.asList("dueDate", "loanProducts", "groups")); - public static final Set GROUP_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set GROUP_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, closureDateParamName, closureReasonIdParamName)); - public static final Set STAFF_CENTER_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(staffIdParamName, + public static final Set STAFF_CENTER_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(staffIdParamName, staffNameParamName, meetingFallCenters)); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/GroupsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/GroupsApiResource.java index 12ccce137..cf0d032e7 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/GroupsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/GroupsApiResource.java @@ -400,7 +400,7 @@ public class GroupsApiResource { final AccountSummaryCollectionData groupAccount = this.accountDetailsReadPlatformService.retrieveGroupAccountDetails(groupId); - final Set GROUP_ACCOUNTS_DATA_PARAMETERS = new HashSet(Arrays.asList("loanAccounts", "savingsAccounts", + final Set GROUP_ACCOUNTS_DATA_PARAMETERS = new HashSet<>(Arrays.asList("loanAccounts", "savingsAccounts", "memberLoanAccounts", "memberSavingsAccounts")); final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/GroupsLevelApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/GroupsLevelApiResource.java index faa9999a5..0998ffe87 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/GroupsLevelApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/api/GroupsLevelApiResource.java @@ -33,7 +33,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class GroupsLevelApiResource { - private static final Set GROUPLEVEL_DATA_PARAMETERS = new HashSet(Arrays.asList("levelId", "levelName", + private static final Set GROUPLEVEL_DATA_PARAMETERS = new HashSet<>(Arrays.asList("levelId", "levelName", "parentLevelId", "parentLevelName", "childLevelId", "childLevelName", "superParent", "recursable", "canHaveClients")); private final PlatformSecurityContext context; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/Group.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/Group.java index 4b94deeee..e3b5ce583 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/Group.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/Group.java @@ -95,7 +95,7 @@ public final class Group extends AbstractPersistable { @OneToMany(fetch = FetchType.EAGER) @JoinColumn(name = "parent_id") - private final List groupMembers = new LinkedList(); + private final List groupMembers = new LinkedList<>(); @ManyToMany @JoinTable(name = "m_group_client", joinColumns = @JoinColumn(name = "group_id"), inverseJoinColumns = @JoinColumn(name = "client_id")) @@ -124,7 +124,7 @@ public final class Group extends AbstractPersistable { public Group() { this.name = null; this.externalId = null; - this.clientMembers = new HashSet(); + this.clientMembers = new HashSet<>(); } public static Group newGroup(final Office office, final Staff staff, final Group parent, final GroupLevel groupLevel, @@ -184,7 +184,7 @@ public final class Group extends AbstractPersistable { } private void validate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); validateActivationDate(dataValidationErrors); if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException(dataValidationErrors); } } @@ -235,7 +235,7 @@ public final class Group extends AbstractPersistable { final ApiParameterError error = ApiParameterError.parameterError("error.msg.group.already.active", defaultUserMessage, "activationDate", activationLocalDate.toString(formatter)); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); dataValidationErrors.add(error); throw new PlatformApiDataValidationException(dataValidationErrors); @@ -273,7 +273,7 @@ public final class Group extends AbstractPersistable { } public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(9); + final Map actualChanges = new LinkedHashMap<>(9); if (command.isChangeInIntegerParameterNamed(GroupingTypesApiConstants.statusParamName, this.status)) { final Integer newValue = command.integerValueOfParameterNamed(GroupingTypesApiConstants.statusParamName); @@ -380,7 +380,7 @@ public final class Group extends AbstractPersistable { } public List updateClientMembersIfDifferent(final Set clientMembersSet) { - List differences = new ArrayList(); + List differences = new ArrayList<>(); if (!clientMembersSet.equals(this.clientMembers)) { final Set diffClients = Sets.symmetricDifference(clientMembersSet, this.clientMembers); final String[] diffClientsIds = getClientIds(diffClients); @@ -394,7 +394,7 @@ public final class Group extends AbstractPersistable { } public List associateClients(final Set clientMembersSet) { - final List differences = new ArrayList(); + final List differences = new ArrayList<>(); for (final Client client : clientMembersSet) { if (hasClientAsMember(client)) { throw new ClientExistInGroupException(client.getId(), getId()); } this.clientMembers.add(client); @@ -405,7 +405,7 @@ public final class Group extends AbstractPersistable { } public List disassociateClients(final Set clientMembersSet) { - final List differences = new ArrayList(); + final List differences = new ArrayList<>(); for (final Client client : clientMembersSet) { if (hasClientAsMember(client)) { this.clientMembers.remove(client); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/GroupRole.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/GroupRole.java index 045d52570..92fe3d071 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/GroupRole.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/GroupRole.java @@ -47,7 +47,7 @@ public class GroupRole extends AbstractPersistable { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(2); + final Map actualChanges = new LinkedHashMap<>(2); if (command.isChangeInLongParameterNamed(GroupingTypesApiConstants.clientIdParamName, this.client.getId())) { final Long newValue = command.longValueOfParameterNamed(GroupingTypesApiConstants.clientIdParamName); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/GroupTypes.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/GroupTypes.java index 06e64891a..572440e0c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/GroupTypes.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/domain/GroupTypes.java @@ -24,7 +24,7 @@ public enum GroupTypes { this.value = value; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); private static long minValue; private static long maxValue; static { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/serialization/GroupRolesDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/serialization/GroupRolesDataValidator.java index fdaa183a7..815138b1f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/serialization/GroupRolesDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/serialization/GroupRolesDataValidator.java @@ -43,7 +43,7 @@ public class GroupRolesDataValidator { this.fromApiJsonHelper .checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_ROLES_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(GroupingTypesApiConstants.GROUP_ROLE_RESOURCE_NAME); @@ -68,7 +68,7 @@ public class GroupRolesDataValidator { this.fromApiJsonHelper .checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_ROLES_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(GroupingTypesApiConstants.GROUP_ROLE_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/serialization/GroupingTypesDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/serialization/GroupingTypesDataValidator.java index 62891ea8b..aa3df65da 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/serialization/GroupingTypesDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/serialization/GroupingTypesDataValidator.java @@ -55,7 +55,7 @@ public final class GroupingTypesDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.CENTER_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(GroupingTypesApiConstants.CENTER_RESOURCE_NAME); @@ -115,7 +115,7 @@ public final class GroupingTypesDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(GroupingTypesApiConstants.GROUP_RESOURCE_NAME); @@ -178,7 +178,7 @@ public final class GroupingTypesDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(GroupingTypesApiConstants.GROUP_RESOURCE_NAME); @@ -238,7 +238,7 @@ public final class GroupingTypesDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.CENTER_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(GroupingTypesApiConstants.CENTER_RESOURCE_NAME); @@ -284,7 +284,7 @@ public final class GroupingTypesDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(GroupingTypesApiConstants.GROUP_RESOURCE_NAME); @@ -330,7 +330,7 @@ public final class GroupingTypesDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.ACTIVATION_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(resourceName); final JsonElement element = command.parsedJson(); @@ -347,12 +347,12 @@ public final class GroupingTypesDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); - final Set supportedParametersUnassignStaff = new HashSet(Arrays.asList("staffId")); + final Set supportedParametersUnassignStaff = new HashSet<>(Arrays.asList("staffId")); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParametersUnassignStaff); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("group"); @@ -368,12 +368,12 @@ public final class GroupingTypesDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); - final Set supportedParametersAssignStaff = new HashSet(Arrays.asList(GroupingTypesApiConstants.staffIdParamName)); + final Set supportedParametersAssignStaff = new HashSet<>(Arrays.asList(GroupingTypesApiConstants.staffIdParamName)); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParametersAssignStaff); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(GroupingTypesApiConstants.GROUP_RESOURCE_NAME); @@ -391,12 +391,12 @@ public final class GroupingTypesDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); - final Set supportedParameters = new HashSet(Arrays.asList(GroupingTypesApiConstants.clientMembersParamName)); + final Set supportedParameters = new HashSet<>(Arrays.asList(GroupingTypesApiConstants.clientMembersParamName)); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("group"); final String[] clients = this.fromApiJsonHelper.extractArrayNamed(GroupingTypesApiConstants.clientMembersParamName, element); @@ -411,12 +411,12 @@ public final class GroupingTypesDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); - final Set supportedParameters = new HashSet(Arrays.asList(GroupingTypesApiConstants.clientMembersParamName)); + final Set supportedParameters = new HashSet<>(Arrays.asList(GroupingTypesApiConstants.clientMembersParamName)); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("group"); final String[] clients = this.fromApiJsonHelper.extractArrayNamed(GroupingTypesApiConstants.clientMembersParamName, element); @@ -434,7 +434,7 @@ public final class GroupingTypesDataValidator { this.fromApiJsonHelper .checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_CLOSE_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(GroupingTypesApiConstants.GROUP_RESOURCE_NAME); @@ -460,7 +460,7 @@ public final class GroupingTypesDataValidator { this.fromApiJsonHelper .checkForUnsupportedParameters(typeOfMap, json, GroupingTypesApiConstants.GROUP_CLOSE_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(GroupingTypesApiConstants.CENTER_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/CenterReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/CenterReadPlatformServiceImpl.java index d13d49cc4..0fa2b5ea7 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/CenterReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/CenterReadPlatformServiceImpl.java @@ -73,9 +73,9 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService private final CenterDataMapper centerMapper = new CenterDataMapper(); private final GroupDataMapper groupDataMapper = new GroupDataMapper(); - private final PaginationHelper paginationHelper = new PaginationHelper(); + private final PaginationHelper paginationHelper = new PaginationHelper<>(); private final PaginationParametersDataValidator paginationParametersDataValidator; - private final static Set supportedOrderByValues = new HashSet(Arrays.asList("id", "name", "officeId", "officeName")); + private final static Set supportedOrderByValues = new HashSet<>(Arrays.asList("id", "name", "officeId", "officeName")); @Autowired public CenterReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource, @@ -129,12 +129,12 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService if (StringUtils.isNotBlank(extraCriteria.toString())) { extraCriteria.delete(0, 4); } - + final Long staffId = searchCriteria.getStaffId(); if (staffId != null) { extraCriteria.append(" and g.staff_id = ").append(staffId); } - + return extraCriteria.toString(); } @@ -502,7 +502,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService @Override public CenterData retrieveCenterWithClosureReasons() { - final List closureReasons = new ArrayList( + final List closureReasons = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(GroupingTypesApiConstants.GROUP_CLOSURE_REASON)); return CenterData.withClosureReasons(closureReasons); } @@ -521,12 +521,12 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService centerDataArray = this.jdbcTemplate.query(sql, centerCalendarMapper, new Object[] { officeId }); } - Collection staffCenterDataArray = new ArrayList(); + Collection staffCenterDataArray = new ArrayList<>(); Boolean flag = false; for (CenterData centerData : centerDataArray) { if (centerData.getCollectionMeetingCalendar().isValidRecurringDate(new LocalDate(meetingDate))) { if (staffCenterDataArray.size() <= 0) { - Collection meetingFallCenter = new ArrayList(); + Collection meetingFallCenter = new ArrayList<>(); meetingFallCenter.add(centerData); staffCenterDataArray.add(StaffCenterData.instance(centerData.staffId(), centerData.getStaffName(), meetingFallCenter)); } else { @@ -539,7 +539,7 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService } } if (!flag) { - Collection meetingFallCenter = new ArrayList(); + Collection meetingFallCenter = new ArrayList<>(); meetingFallCenter.add(centerData); staffCenterDataArray.add(StaffCenterData.instance(centerData.staffId(), centerData.getStaffName(), meetingFallCenter)); @@ -550,15 +550,15 @@ public class CenterReadPlatformServiceImpl implements CenterReadPlatformService } return staffCenterDataArray; } - + public void validateForGenerateCollectionSheet(final Long staffId) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("productivecollectionsheet"); baseDataValidator.reset().parameter("staffId").value(staffId).notNull(); - + if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", "Validation errors exist.", dataValidationErrors); } - + } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupReadPlatformServiceImpl.java index e43be67f9..005b70e17 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupReadPlatformServiceImpl.java @@ -56,10 +56,10 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService { private final CodeValueReadPlatformService codeValueReadPlatformService; private final AllGroupTypesDataMapper allGroupTypesDataMapper = new AllGroupTypesDataMapper(); - private final PaginationHelper paginationHelper = new PaginationHelper(); + private final PaginationHelper paginationHelper = new PaginationHelper<>(); private final PaginationParametersDataValidator paginationParametersDataValidator; - private final static Set supportedOrderByValues = new HashSet(Arrays.asList("id", "name", "officeId", "officeName")); + private final static Set supportedOrderByValues = new HashSet<>(Arrays.asList("id", "name", "officeId", "officeName")); @Autowired public GroupReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource, @@ -231,7 +231,7 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService { if (StringUtils.isNotBlank(extraCriteria.toString())) { extraCriteria.delete(0, 4); } - + final Long staffId = searchCriteria.getStaffId(); if (staffId != null) { extraCriteria.append(" and g.staff_id = ").append(staffId); @@ -279,7 +279,7 @@ public class GroupReadPlatformServiceImpl implements GroupReadPlatformService { @Override public GroupGeneralData retrieveGroupWithClosureReasons() { - final List closureReasons = new ArrayList( + final List closureReasons = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(GroupingTypesApiConstants.GROUP_CLOSURE_REASON)); return GroupGeneralData.withClosureReasons(closureReasons); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupingTypesWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupingTypesWritePlatformServiceJpaRepositoryImpl.java index ee983f700..85ea9519e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupingTypesWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/group/service/GroupingTypesWritePlatformServiceJpaRepositoryImpl.java @@ -159,7 +159,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group rollbackTransaction = this.commandProcessingService.validateCommand(commandWrapper, currentUser); } } - + if (!newGroup.isCenter() && newGroup.hasActiveClients()) { final CommandWrapper commandWrapper = new CommandWrapperBuilder().associateClientsToGroup(newGroup.getId()).build(); rollbackTransaction = this.commandProcessingService.validateCommand(commandWrapper, currentUser); @@ -367,7 +367,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group this.context.authenticatedUser(); - final Map actualChanges = new LinkedHashMap(9); + final Map actualChanges = new LinkedHashMap<>(9); this.fromApiJsonDeserializer.validateForUnassignStaff(command.json()); @@ -400,7 +400,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group this.context.authenticatedUser(); - final Map actualChanges = new LinkedHashMap(5); + final Map actualChanges = new LinkedHashMap<>(5); this.fromApiJsonDeserializer.validateForAssignStaff(command.json()); @@ -547,7 +547,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group private Set assembleSetOfClients(final Long groupOfficeId, final JsonCommand command) { - final Set clientMembers = new HashSet(); + final Set clientMembers = new HashSet<>(); final String[] clientMembersArray = command.arrayValueOfParameterNamed(GroupingTypesApiConstants.clientMembersParamName); if (!ObjectUtils.isEmpty(clientMembersArray)) { @@ -567,7 +567,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group private Set assembleSetOfChildGroups(final Long officeId, final JsonCommand command) { - final Set childGroups = new HashSet(); + final Set childGroups = new HashSet<>(); final String[] childGroupsArray = command.arrayValueOfParameterNamed(GroupingTypesApiConstants.groupMembersParamName); if (!ObjectUtils.isEmpty(childGroupsArray)) { @@ -637,7 +637,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group final Group groupForUpdate = this.groupRepository.findOneWithNotFoundDetection(groupId); final Set clientMembers = assembleSetOfClients(groupForUpdate.officeId(), command); - final Map actualChanges = new HashMap(); + final Map actualChanges = new HashMap<>(); final List changes = groupForUpdate.associateClients(clientMembers); if (!changes.isEmpty()) { @@ -666,7 +666,7 @@ public class GroupingTypesWritePlatformServiceJpaRepositoryImpl implements Group // check if any client has got group loans validateForJLGLoan(groupForUpdate.getId(), clientMembers); validateForJLGSavings(groupForUpdate.getId(), clientMembers); - final Map actualChanges = new HashMap(); + final Map actualChanges = new HashMap<>(); final List changes = groupForUpdate.disassociateClients(clientMembers); if (!changes.isEmpty()) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/InterestIncentiveApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/InterestIncentiveApiConstants.java index ce93deaae..85f5bb0bd 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/InterestIncentiveApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/InterestIncentiveApiConstants.java @@ -17,15 +17,15 @@ public interface InterestIncentiveApiConstants { public static final String INCENTIVE_RESOURCE_NAME = "interest.rate.incentives"; - public static final Set INTERESTRATE_INCENTIVE_CREATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName, + public static final Set INTERESTRATE_INCENTIVE_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, entityTypeParamName, attributeNameParamName, conditionTypeParamName, attributeValueParamName, incentiveTypeparamName, amountParamName)); - public static final Set INTERESTRATE_INCENTIVE_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName, + public static final Set INTERESTRATE_INCENTIVE_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, entityTypeParamName, attributeNameParamName, conditionTypeParamName, attributeValueParamName, incentiveTypeparamName, amountParamName)); - public static final Set INTERESTRATE_INCENTIVE_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName, + public static final Set INTERESTRATE_INCENTIVE_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, entityTypeParamName, attributeNameParamName, conditionTypeParamName, attributeValueParamName, incentiveTypeparamName, amountParamName)); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/InterestRateChartApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/InterestRateChartApiConstants.java index 23b705329..2638468f9 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/InterestRateChartApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/InterestRateChartApiConstants.java @@ -49,14 +49,14 @@ public class InterestRateChartApiConstants { // to delete chart Slabs from chart public static final String deleteParamName = "delete"; - public static final Set INTERESTRATE_CHART_CREATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set INTERESTRATE_CHART_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, nameParamName, descriptionParamName, fromDateParamName, endDateParamName, productIdParamName, chartSlabs)); - public static final Set INTERESTRATE_CHART_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set INTERESTRATE_CHART_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, idParamName, nameParamName, descriptionParamName, fromDateParamName, endDateParamName, chartSlabs, deleteParamName)); - public static final Set INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set INTERESTRATE_CHART_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, idParamName, nameParamName, descriptionParamName, fromDateParamName, endDateParamName, chartSlabs)); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/InterestRateChartSlabApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/InterestRateChartSlabApiConstants.java index 7c31826ab..aa7ac5348 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/InterestRateChartSlabApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/InterestRateChartSlabApiConstants.java @@ -35,15 +35,15 @@ public class InterestRateChartSlabApiConstants { // associations - public static final Set INTERESTRATE_CHART_SLAB_CREATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList( + public static final Set INTERESTRATE_CHART_SLAB_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList( localeParamName, idParamName, descriptionParamName, periodTypeParamName, fromPeriodParamName, toPeriodParamName, amountRangeFromParamName, amountRangeToParamName, annualInterestRateParamName, currencyCodeParamName, incentivesParamName)); - public static final Set INTERESTRATE_CHART_SLAB_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList( + public static final Set INTERESTRATE_CHART_SLAB_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList( localeParamName, idParamName, descriptionParamName, periodTypeParamName, fromPeriodParamName, toPeriodParamName, amountRangeFromParamName, amountRangeToParamName, annualInterestRateParamName, currencyCodeParamName, incentivesParamName)); - public static final Set INTERESTRATE_CHART_SLAB_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set INTERESTRATE_CHART_SLAB_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, idParamName, descriptionParamName, periodTypeParamName, fromPeriodParamName, toPeriodParamName, amountRangeFromParamName, amountRangeToParamName, annualInterestRateParamName, currencyCodeParamName, incentivesParamName)); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestIncentiveDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestIncentiveDataValidator.java index 12128f5a1..fd4bba82d 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestIncentiveDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestIncentiveDataValidator.java @@ -56,7 +56,7 @@ public class InterestIncentiveDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, INTERESTRATE_INCENTIVE_CREATE_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(INCENTIVE_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -99,7 +99,7 @@ public class InterestIncentiveDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, INTERESTRATE_INCENTIVE_UPDATE_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(INCENTIVE_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartData.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartData.java index 02799f43e..9a553b465 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartData.java @@ -30,7 +30,7 @@ public class InterestRateChartData { private Set chartSlabs; // template - private Collection periodTypes; + private final Collection periodTypes; private final Collection entityTypeOptions; private final Collection attributeNameOptions; private final Collection conditionTypeOptions; @@ -120,7 +120,7 @@ public class InterestRateChartData { public void addChartSlab(final InterestRateChartSlabData chartSlab) { if (this.chartSlabs == null) { - this.chartSlabs = new HashSet(); + this.chartSlabs = new HashSet<>(); } this.chartSlabs.add(chartSlab); @@ -153,7 +153,7 @@ public class InterestRateChartData { public Collection periodTypes() { return this.periodTypes; } - + public Collection entityTypeOptions() { return this.entityTypeOptions; } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartDataValidator.java index d4eb3a83c..d81a64382 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartDataValidator.java @@ -53,7 +53,7 @@ public class InterestRateChartDataValidator { public void validateForCreate(final String json) { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(INTERESTRATE_CHART_RESOURCE_NAME); @@ -99,7 +99,7 @@ public class InterestRateChartDataValidator { public void validateUpdate(final String json) { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(INTERESTRATE_CHART_RESOURCE_NAME); this.validateForUpdate(json, baseDataValidator); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartSlabData.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartSlabData.java index 8142f544c..15635125c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartSlabData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartSlabData.java @@ -155,7 +155,7 @@ public class InterestRateChartSlabData { public void addIncentives(final InterestIncentiveData incentiveData) { if (this.incentives == null) { - this.incentives = new HashSet(); + this.incentives = new HashSet<>(); } this.incentives.add(incentiveData); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartSlabDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartSlabDataValidator.java index 1a39e8bfa..b9e2d71a6 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartSlabDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/data/InterestRateChartSlabDataValidator.java @@ -60,7 +60,7 @@ public class InterestRateChartSlabDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, INTERESTRATE_CHART_SLAB_CREATE_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(INTERESTRATE_CHART_SLAB_RESOURCE_NAME); @@ -132,7 +132,7 @@ public class InterestRateChartSlabDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, INTERESTRATE_CHART_SLAB_UPDATE_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(INTERESTRATE_CHART_SLAB_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/domain/InterestRateChart.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/domain/InterestRateChart.java index aa6c49c2f..a4efb89b3 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/domain/InterestRateChart.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/domain/InterestRateChart.java @@ -53,7 +53,7 @@ public class InterestRateChart extends AbstractPersistable { private InterestRateChartFields chartFields; @OneToMany(mappedBy = "interestRateChart", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY) - private Set chartSlabs = new HashSet(); + private Set chartSlabs = new HashSet<>(); protected InterestRateChart() { // @@ -61,12 +61,12 @@ public class InterestRateChart extends AbstractPersistable { public static InterestRateChart createNew(InterestRateChartFields chartFields, Collection interestRateChartSlabs) { - return new InterestRateChart(chartFields, new HashSet(interestRateChartSlabs)); + return new InterestRateChart(chartFields, new HashSet<>(interestRateChartSlabs)); } private InterestRateChart(InterestRateChartFields chartFields, Set interestRateChartSlabs) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(INTERESTRATE_CHART_RESOURCE_NAME); @@ -83,7 +83,7 @@ public class InterestRateChart extends AbstractPersistable { Collection chartSlabs = this.setOfChartSlabs(); Integer tmpPeriodType = null; - List chartSlabsList = new ArrayList(chartSlabs); + List chartSlabsList = new ArrayList<>(chartSlabs); for (int i = 0; i < chartSlabsList.size(); i++) { InterestRateChartSlab iSlabs = chartSlabsList.get(i); @@ -119,13 +119,13 @@ public class InterestRateChart extends AbstractPersistable { public Set setOfChartSlabs() { if (this.chartSlabs == null) { - this.chartSlabs = new HashSet(); + this.chartSlabs = new HashSet<>(); } return this.chartSlabs; } public void update(JsonCommand command, final Map actualChanges) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(INTERESTRATE_CHART_RESOURCE_NAME); @@ -164,8 +164,8 @@ public class InterestRateChart extends AbstractPersistable { public void updateChartSlabs(JsonCommand command, final Map actualChanges, final DataValidatorBuilder baseDataValidator, String currencyCode) { - final Map deleteChartSlabs = new HashMap(); - final Map chartSlabsChanges = new HashMap(); + final Map deleteChartSlabs = new HashMap<>(); + final Map chartSlabsChanges = new HashMap<>(); final Locale locale = command.extractLocale(); if (command.hasParameter(InterestRateChartApiConstants.chartSlabs)) { final JsonArray array = command.arrayOfParameterNamed(InterestRateChartApiConstants.chartSlabs); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/domain/InterestRateChartSlab.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/domain/InterestRateChartSlab.java index f025d46d0..e0c36d3d8 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/domain/InterestRateChartSlab.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/domain/InterestRateChartSlab.java @@ -56,7 +56,7 @@ public class InterestRateChartSlab extends AbstractPersistable { private InterestRateChart interestRateChart; @OneToMany(mappedBy = "interestRateChartSlab", cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.LAZY) - private Set interestIncentives = new HashSet(); + private Set interestIncentives = new HashSet<>(); protected InterestRateChartSlab() { // @@ -67,7 +67,7 @@ public class InterestRateChartSlab extends AbstractPersistable { } public void update(JsonCommand command, final Map actualChanges, final Locale locale) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(INTERESTRATE_CHART_SLAB_RESOURCE_NAME); this.update(command, actualChanges, baseDataValidator, locale); @@ -77,7 +77,7 @@ public class InterestRateChartSlab extends AbstractPersistable { public void update(JsonCommand command, final Map actualChanges, final DataValidatorBuilder baseDataValidator, final Locale locale) { - this.slabFields.update(command, actualChanges, baseDataValidator,locale); + this.slabFields.update(command, actualChanges, baseDataValidator, locale); updateIncentives(command, actualChanges, baseDataValidator, this, locale); } @@ -104,7 +104,7 @@ public class InterestRateChartSlab extends AbstractPersistable { public Set setOfInterestIncentives() { if (this.interestIncentives == null) { - this.interestIncentives = new HashSet(); + this.interestIncentives = new HashSet<>(); } return this.interestIncentives; } @@ -130,8 +130,8 @@ public class InterestRateChartSlab extends AbstractPersistable { public void updateIncentives(JsonCommand command, final Map actualChanges, final DataValidatorBuilder baseDataValidator, final InterestRateChartSlab chartSlab, final Locale locale) { - final Map deleteIncentives = new HashMap(); - final Map IncentiveChanges = new HashMap(); + final Map deleteIncentives = new HashMap<>(); + final Map IncentiveChanges = new HashMap<>(); if (command.hasParameter(InterestRateChartSlabApiConstants.incentivesParamName)) { final JsonArray array = command.arrayOfParameterNamed(InterestRateChartSlabApiConstants.incentivesParamName); if (array != null) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/incentive/InterestIncentiveAttributeName.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/incentive/InterestIncentiveAttributeName.java index 2079413ce..d34865587 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/incentive/InterestIncentiveAttributeName.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/incentive/InterestIncentiveAttributeName.java @@ -21,7 +21,7 @@ public enum InterestIncentiveAttributeName { private final Integer value; private final String code; - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); static { for (final InterestIncentiveAttributeName type : InterestIncentiveAttributeName.values()) { intToEnumMap.put(type.value, type); @@ -86,7 +86,7 @@ public enum InterestIncentiveAttributeName { } public static Object[] integerValues() { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final InterestIncentiveAttributeName enumType : values()) { if (!enumType.isInvalid()) { values.add(enumType.getValue()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/incentive/InterestIncentiveEntityType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/incentive/InterestIncentiveEntityType.java index 4dcbe2761..6a53181bf 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/incentive/InterestIncentiveEntityType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/incentive/InterestIncentiveEntityType.java @@ -19,7 +19,7 @@ public enum InterestIncentiveEntityType { private final Integer value; private final String code; - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); static { for (final InterestIncentiveEntityType type : InterestIncentiveEntityType.values()) { intToEnumMap.put(type.value, type); @@ -58,7 +58,7 @@ public enum InterestIncentiveEntityType { } public static Object[] integerValues() { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final InterestIncentiveEntityType enumType : values()) { if (!enumType.isInvalid()) { values.add(enumType.getValue()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/incentive/InterestIncentiveType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/incentive/InterestIncentiveType.java index 55e1422e5..8d9832502 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/incentive/InterestIncentiveType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/incentive/InterestIncentiveType.java @@ -19,7 +19,7 @@ public enum InterestIncentiveType { private final Integer value; private final String code; - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); static { for (final InterestIncentiveType type : InterestIncentiveType.values()) { intToEnumMap.put(type.value, type); @@ -62,7 +62,7 @@ public enum InterestIncentiveType { } public static Object[] integerValues() { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final InterestIncentiveType enumType : values()) { if (!enumType.isInvalid()) { values.add(enumType.getValue()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestIncentiveAssembler.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestIncentiveAssembler.java index 8b6318825..0dee89a19 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestIncentiveAssembler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestIncentiveAssembler.java @@ -42,7 +42,7 @@ public class InterestIncentiveAssembler { public Collection assembleIncentivesFrom(final JsonElement element, InterestRateChartSlab interestRateChartSlab, final Locale locale) { - final Collection interestIncentivesSet = new HashSet(); + final Collection interestIncentivesSet = new HashSet<>(); if (element.isJsonObject()) { final JsonObject topLevelJsonElement = element.getAsJsonObject(); @@ -61,7 +61,7 @@ public class InterestIncentiveAssembler { private InterestIncentives assembleFrom(final JsonElement element, final InterestRateChartSlab interestRateChartSlab, final Locale locale) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(INCENTIVE_RESOURCE_NAME); InterestIncentivesFields incentivesFields = createInterestIncentiveFields(element, baseDataValidator, locale); throwExceptionIfValidationWarningsExist(dataValidationErrors); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestIncentivesEnumerations.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestIncentivesEnumerations.java index 9bc905500..92270d3a6 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestIncentivesEnumerations.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestIncentivesEnumerations.java @@ -48,7 +48,7 @@ public class InterestIncentivesEnumerations { } public static List attributeName(final InterestIncentiveAttributeName[] attributeNames) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final InterestIncentiveAttributeName attributeName : attributeNames) { if (!attributeName.isInvalid()) { optionDatas.add(attributeName(attributeName)); @@ -82,7 +82,7 @@ public class InterestIncentivesEnumerations { } public static List entityType(final InterestIncentiveEntityType[] entityTypes) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final InterestIncentiveEntityType entityType : entityTypes) { if (!entityType.isInvalid()) { optionDatas.add(entityType(entityType)); @@ -116,7 +116,7 @@ public class InterestIncentivesEnumerations { } public static List incentiveType(final InterestIncentiveType[] incentiveTypes) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final InterestIncentiveType incentiveType : incentiveTypes) { if (!incentiveType.isInvalid()) { optionDatas.add(incentiveType(incentiveType)); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartAssembler.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartAssembler.java index 2f6ce3ba1..a9c7662be 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartAssembler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartAssembler.java @@ -54,7 +54,7 @@ public class InterestRateChartAssembler { public InterestRateChart assembleFrom(final JsonCommand command) { final JsonElement element = command.parsedJson(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); @SuppressWarnings("unused") final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(INTERESTRATE_CHART_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartEnumerations.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartEnumerations.java index 0733602fa..0a05d6f3a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartEnumerations.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartEnumerations.java @@ -46,7 +46,7 @@ public class InterestRateChartEnumerations { } public static List periodType(final PeriodFrequencyType[] periodTypes) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final PeriodFrequencyType periodType : periodTypes) { if (!periodType.isInvalid()) { optionDatas.add(periodType(periodType)); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartReadPlatformServiceImpl.java index d46456cfc..9f6a8cbd3 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartReadPlatformServiceImpl.java @@ -79,7 +79,7 @@ public class InterestRateChartReadPlatformServiceImpl implements InterestRateCha @Override public Collection retrieveAllWithSlabsWithTemplate(Long productId) { - Collection chartDatas = new ArrayList(); + Collection chartDatas = new ArrayList<>(); for (InterestRateChartData chartData : retrieveAllWithSlabs(productId)) { chartDatas.add(retrieveWithTemplate(chartData)); @@ -107,13 +107,13 @@ public class InterestRateChartReadPlatformServiceImpl implements InterestRateCha @Override public InterestRateChartData retrieveWithTemplate(InterestRateChartData chartData) { - final List genderOptions = new ArrayList( + final List genderOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.GENDER)); - final List clientTypeOptions = new ArrayList( + final List clientTypeOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.CLIENT_TYPE)); - final List clientClassificationOptions = new ArrayList( + final List clientClassificationOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.CLIENT_CLASSIFICATION)); return InterestRateChartData.withTemplate(chartData, this.chartDropdownReadPlatformService.retrievePeriodTypeOptions(), this.interestIncentiveDropdownReadPlatformService.retrieveEntityTypeOptions(), @@ -131,13 +131,13 @@ public class InterestRateChartReadPlatformServiceImpl implements InterestRateCha @Override public InterestRateChartData template() { - final List genderOptions = new ArrayList( + final List genderOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.GENDER)); - final List clientTypeOptions = new ArrayList( + final List clientTypeOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.CLIENT_TYPE)); - final List clientClassificationOptions = new ArrayList( + final List clientClassificationOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.CLIENT_CLASSIFICATION)); return InterestRateChartData.template(this.chartDropdownReadPlatformService.retrievePeriodTypeOptions(), this.interestIncentiveDropdownReadPlatformService.retrieveEntityTypeOptions(), @@ -187,7 +187,7 @@ public class InterestRateChartReadPlatformServiceImpl implements InterestRateCha @Override public Collection extractData(ResultSet rs) throws SQLException, DataAccessException { - List chartDataList = new ArrayList(); + List chartDataList = new ArrayList<>(); InterestRateChartData chartData = null; Long interestRateChartId = null; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartSlabAssembler.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartSlabAssembler.java index c8fa9138c..af495dc48 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartSlabAssembler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartSlabAssembler.java @@ -71,7 +71,7 @@ public class InterestRateChartSlabAssembler { final InterestRateChart chart = this.interestRateChartRepositoryWrapper.findOneWithNotFoundDetection(chartId); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(INTERESTRATE_CHART_SLAB_RESOURCE_NAME); @@ -113,7 +113,7 @@ public class InterestRateChartSlabAssembler { } public Collection assembleChartSlabsFrom(final JsonElement element, String currencyCode) { - final Collection interestRateChartSlabsSet = new HashSet(); + final Collection interestRateChartSlabsSet = new HashSet<>(); if (element.isJsonObject()) { final JsonObject topLevelJsonElement = element.getAsJsonObject(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartSlabReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartSlabReadPlatformServiceImpl.java index 45d600e12..248d7bf10 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartSlabReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartSlabReadPlatformServiceImpl.java @@ -74,13 +74,13 @@ public class InterestRateChartSlabReadPlatformServiceImpl implements InterestRat @Override public InterestRateChartSlabData retrieveWithTemplate(InterestRateChartSlabData chartSlab) { - final List genderOptions = new ArrayList( + final List genderOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.GENDER)); - final List clientTypeOptions = new ArrayList( + final List clientTypeOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.CLIENT_TYPE)); - final List clientClassificationOptions = new ArrayList( + final List clientClassificationOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.CLIENT_CLASSIFICATION)); return InterestRateChartSlabData.withTemplate(chartSlab, this.chartDropdownReadPlatformService.retrievePeriodTypeOptions(), @@ -93,13 +93,13 @@ public class InterestRateChartSlabReadPlatformServiceImpl implements InterestRat @Override public InterestRateChartSlabData retrieveTemplate() { - final List genderOptions = new ArrayList( + final List genderOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.GENDER)); - final List clientTypeOptions = new ArrayList( + final List clientTypeOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.CLIENT_TYPE)); - final List clientClassificationOptions = new ArrayList( + final List clientClassificationOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.CLIENT_CLASSIFICATION)); return InterestRateChartSlabData.template(this.chartDropdownReadPlatformService.retrievePeriodTypeOptions(), this.interestIncentiveDropdownReadPlatformService.retrieveEntityTypeOptions(), @@ -128,8 +128,8 @@ public class InterestRateChartSlabReadPlatformServiceImpl implements InterestRat .append("curr.display_symbol as currencyDisplaySymbol, curr.decimal_places as currencyDigits, curr.currency_multiplesof as inMultiplesOf, ") .append("iri.id as iriId, ").append(" iri.entiry_type as entityType, iri.attribute_name as attributeName ,") .append(" iri.condition_type as conditionType, iri.attribute_value as attributeValue, ") - .append(" iri.incentive_type as incentiveType, iri.amount as amount, ").append("code.code_value as attributeValueDesc ") - .append("from ").append("m_interest_rate_slab ircd ") + .append(" iri.incentive_type as incentiveType, iri.amount as amount, ") + .append("code.code_value as attributeValueDesc ").append("from ").append("m_interest_rate_slab ircd ") .append(" left join m_interest_incentives iri on iri.interest_rate_slab_id = ircd.id ") .append(" left join m_code_value code on code.id = iri.attribute_value ") .append("left join m_currency curr on ircd.currency_code= curr.code "); @@ -187,7 +187,7 @@ public class InterestRateChartSlabReadPlatformServiceImpl implements InterestRat @Override public Collection extractData(ResultSet rs) throws SQLException, DataAccessException { - List chartDataList = new ArrayList(); + List chartDataList = new ArrayList<>(); InterestRateChartSlabData chartSlabData = null; Long interestRateChartSlabId = null; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartSlabWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartSlabWritePlatformServiceJpaRepositoryImpl.java index b7a2caa68..6f2af59a1 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartSlabWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartSlabWritePlatformServiceJpaRepositoryImpl.java @@ -78,7 +78,7 @@ public class InterestRateChartSlabWritePlatformServiceJpaRepositoryImpl implemen @Transactional public CommandProcessingResult update(Long chartSlabId, Long interestRateChartId, JsonCommand command) { this.interestRateChartSlabDataValidator.validateUpdate(command.json()); - final Map changes = new LinkedHashMap(20); + final Map changes = new LinkedHashMap<>(20); final InterestRateChartSlab updateChartSlabs = this.interestRateChartSlabAssembler.assembleFrom(chartSlabId, interestRateChartId); final Locale locale = command.extractLocale(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartWritePlatformServiceJpaRepositoryImpl.java index 22f70bbab..190faf29f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/interestratechart/service/InterestRateChartWritePlatformServiceJpaRepositoryImpl.java @@ -64,7 +64,7 @@ public class InterestRateChartWritePlatformServiceJpaRepositoryImpl implements I @Transactional public CommandProcessingResult update(Long interestRateChartId, JsonCommand command) { this.interestRateChartDataValidator.validateUpdate(command.json()); - final Map changes = new LinkedHashMap(20); + final Map changes = new LinkedHashMap<>(20); final InterestRateChart interestRateChart = this.interestRateChartAssembler.assembleFrom(interestRateChartId); interestRateChart.update(command, changes); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/BulkLoansApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/BulkLoansApiResource.java index 2a022d392..bac9f4277 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/BulkLoansApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/BulkLoansApiResource.java @@ -45,7 +45,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class BulkLoansApiResource { - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("officeId", "fromLoanOfficerId", + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("officeId", "fromLoanOfficerId", "assignmentDate", "officeOptions", "loanOfficerOptions", "accountSummaryCollection")); private final String resourceNameForPermissions = "LOAN"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanChargesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanChargesApiResource.java index 665f134f9..589f2c1ee 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanChargesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanChargesApiResource.java @@ -48,7 +48,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class LoanChargesApiResource { - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "chargeId", "name", "penalty", + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "chargeId", "name", "penalty", "chargeTimeType", "dueAsOfDate", "chargeCalculationType", "percentage", "amountPercentageAppliedTo", "currency", "amountWaived", "amountWrittenOff", "amountOutstanding", "amountOrPercentage", "amount", "amountPaid", "chargeOptions", "installmentChargeData")); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanDisbursementDetailApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanDisbursementDetailApiResource.java index acdce7225..fbf30f885 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanDisbursementDetailApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanDisbursementDetailApiResource.java @@ -38,7 +38,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class LoanDisbursementDetailApiResource { - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "expectedDisbursementDate", + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "expectedDisbursementDate", "actualDisbursementDate", "principal", "approvedPrincipal")); private final String resourceNameForPermissions = "LOAN"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanTransactionsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanTransactionsApiResource.java index b5eaff264..39eb09d34 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanTransactionsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoanTransactionsApiResource.java @@ -38,7 +38,7 @@ import java.util.Set; @Scope("singleton") public class LoanTransactionsApiResource { - private final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "type", "date", "currency", "amount", + private final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "type", "date", "currency", "amount", "externalId")); private final String resourceNameForPermissions = "LOAN"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java index 34ceb0435..e876dacce 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/api/LoansApiResource.java @@ -99,8 +99,8 @@ import com.google.gson.JsonElement; @Scope("singleton") public class LoansApiResource { - private final Set LOAN_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "accountNo", "status", "externalId", - "clientId", "group", "loanProductId", "loanProductName", "loanProductDescription", "fundId", "fundName", "loanPurposeId", + private final Set LOAN_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "accountNo", "status", "externalId", "clientId", + "group", "loanProductId", "loanProductName", "loanProductDescription", "fundId", "fundName", "loanPurposeId", "loanPurposeName", "loanOfficerId", "loanOfficerName", "currency", "principal", "totalOverpaid", "inArrearsTolerance", "termFrequency", "termPeriodFrequencyType", "numberOfRepayments", "repaymentEvery", "interestRatePerPeriod", "annualInterestRate", "repaymentFrequencyType", "transactionProcessingStrategyId", "transactionProcessingStrategyName", @@ -241,7 +241,7 @@ public class LoansApiResource { newLoanAccount = newLoanAccount == null ? loanAccountGroupData : LoanAccountData.populateGroupDefaults(newLoanAccount, loanAccountGroupData); if (productId != null) { - Map memberLoanCycle = new HashMap(); + Map memberLoanCycle = new HashMap<>(); Collection members = loanAccountGroupData.groupData().clientMembers(); for (ClientData clientData : members) { Integer loanCounter = this.loanReadPlatformService.retriveLoanCounter(clientData.id(), productId); @@ -303,7 +303,7 @@ public class LoansApiResource { Collection disbursementData = null; Collection emiAmountVariations = null; - final Set mandatoryResponseParameters = new HashSet(); + final Set mandatoryResponseParameters = new HashSet<>(); final Set associationParameters = ApiParameterHelper.extractAssociationsForResponseIfProvided(uriInfo.getQueryParameters()); if (!associationParameters.isEmpty()) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/command/LoanUpdateCommand.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/command/LoanUpdateCommand.java index 265b13766..81b790a74 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/command/LoanUpdateCommand.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/command/LoanUpdateCommand.java @@ -26,7 +26,7 @@ public class LoanUpdateCommand { public void validate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan.transaction"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/command/UpdateLoanOfficerCommand.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/command/UpdateLoanOfficerCommand.java index ed36f6668..809ac9eb9 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/command/UpdateLoanOfficerCommand.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/command/UpdateLoanOfficerCommand.java @@ -41,7 +41,7 @@ public class UpdateLoanOfficerCommand { } public void validateForBulkLoanReassignment() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loans.reassignment"); @@ -58,7 +58,7 @@ public class UpdateLoanOfficerCommand { } public void validateForLoanReassignment() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loans.reassignment"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/ChangedTransactionDetail.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/ChangedTransactionDetail.java index 0523c6217..02599a05b 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/ChangedTransactionDetail.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/ChangedTransactionDetail.java @@ -16,7 +16,7 @@ import java.util.Map; */ public class ChangedTransactionDetail { - private final Map newTransactionMappings = new HashMap(); + private final Map newTransactionMappings = new HashMap<>(); public Map getNewTransactionMappings() { return this.newTransactionMappings; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java index 3bf2a4935..52b53168e 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/Loan.java @@ -246,7 +246,7 @@ public class Loan extends AbstractPersistable { @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = true) - private Set charges = new HashSet(); + private Set charges = new HashSet<>(); @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = true) @@ -260,14 +260,14 @@ public class Loan extends AbstractPersistable { // http://stackoverflow.com/questions/4334970/hibernate-cannot-simultaneously-fetch-multiple-bags @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = true) - private final List repaymentScheduleInstallments = new ArrayList(); + private final List repaymentScheduleInstallments = new ArrayList<>(); // see // http://stackoverflow.com/questions/4334970/hibernate-cannot-simultaneously-fetch-multiple-bags @OrderBy(value = "dateOf, id") @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = true) - private final List loanTransactions = new ArrayList(); + private final List loanTransactions = new ArrayList<>(); @Embedded private LoanSummary summary; @@ -296,12 +296,12 @@ public class Loan extends AbstractPersistable { @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = true) - private Set disbursementDetails = new HashSet(); + private Set disbursementDetails = new HashSet<>(); @OrderBy(value = "termApplicableFrom, id") @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "loan", orphanRemoval = true) - private final Set loanTermVariations = new HashSet(); + private final Set loanTermVariations = new HashSet<>(); @Column(name = "total_recovered_derived", scale = 6, precision = 19) private BigDecimal totalRecovered; @@ -576,7 +576,7 @@ public class Loan extends AbstractPersistable { final LoanRepaymentScheduleTransactionProcessor loanRepaymentScheduleTransactionProcessor = this.transactionProcessorFactory .determineProcessor(this.transactionProcessingStrategy); - final List chargePaymentInstallments = new ArrayList(); + final List chargePaymentInstallments = new ArrayList<>(); LocalDate startDate = getDisbursementDate(); for (final LoanRepaymentScheduleInstallment installment : this.repaymentScheduleInstallments) { if (installmentNumber == null && charge.isDueForCollectionFromAndUpToAndIncluding(startDate, installment.getDueDate())) { @@ -588,7 +588,7 @@ public class Loan extends AbstractPersistable { } startDate = installment.getDueDate(); } - final Set loanCharges = new HashSet(1); + final Set loanCharges = new HashSet<>(1); loanCharges.add(charge); loanRepaymentScheduleTransactionProcessor.handleTransaction(chargesPayment, getCurrency(), chargePaymentInstallments, loanCharges); updateLoanSummaryDerivedFields(); @@ -691,7 +691,7 @@ public class Loan extends AbstractPersistable { public Map updateLoanCharge(final LoanCharge loanCharge, final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(3); + final Map actualChanges = new LinkedHashMap<>(3); validateLoanIsNotClosed(loanCharge); if (charges().contains(loanCharge)) { @@ -948,7 +948,7 @@ public class Loan extends AbstractPersistable { public void updateLoanCollateral(final Set loanCollateral) { if (this.collateral == null) { - this.collateral = new HashSet(); + this.collateral = new HashSet<>(); } this.collateral.clear(); this.collateral.addAll(associateWithThisLoan(loanCollateral)); @@ -1375,7 +1375,7 @@ public class Loan extends AbstractPersistable { } private List fetchDisbursementIds() { - List list = new ArrayList(); + List list = new ArrayList<>(); for (LoanDisbursementDetails disbursementDetails : this.disbursementDetails) { list.add(disbursementDetails.getId()); } @@ -1386,7 +1386,7 @@ public class Loan extends AbstractPersistable { CollateralData[] existingLoanCollateral = null; - final List loanCollateralList = new ArrayList(); + final List loanCollateralList = new ArrayList<>(); for (final LoanCollateral loanCollateral : setOfLoanCollateral) { final CollateralData data = loanCollateral.toData(); @@ -1403,7 +1403,7 @@ public class Loan extends AbstractPersistable { LoanChargeCommand[] existingLoanCharges = null; - final List loanChargesList = new ArrayList(); + final List loanChargesList = new ArrayList<>(); for (final LoanCharge loanCharge : setOfLoanCharges) { loanChargesList.add(loanCharge.toCommand()); } @@ -1494,7 +1494,7 @@ public class Loan extends AbstractPersistable { validateAccountStatus(LoanEvent.LOAN_REJECTED); - final Map actualChanges = new LinkedHashMap(); + final Map actualChanges = new LinkedHashMap<>(); final LoanStatus statusEnum = loanLifecycleStateMachine.transition(LoanEvent.LOAN_REJECTED, LoanStatus.fromInt(this.loanStatus)); if (!statusEnum.hasStateOf(LoanStatus.fromInt(this.loanStatus))) { @@ -1540,7 +1540,7 @@ public class Loan extends AbstractPersistable { public Map loanApplicationWithdrawnByApplicant(final AppUser currentUser, final JsonCommand command, final LoanLifecycleStateMachine loanLifecycleStateMachine) { - final Map actualChanges = new LinkedHashMap(); + final Map actualChanges = new LinkedHashMap<>(); final LoanStatus statusEnum = loanLifecycleStateMachine.transition(LoanEvent.LOAN_WITHDRAWN, LoanStatus.fromInt(this.loanStatus)); if (!statusEnum.hasStateOf(LoanStatus.fromInt(this.loanStatus))) { @@ -1591,7 +1591,7 @@ public class Loan extends AbstractPersistable { validateAccountStatus(LoanEvent.LOAN_APPROVED); - final Map actualChanges = new LinkedHashMap(); + final Map actualChanges = new LinkedHashMap<>(); final LoanStatus statusEnum = loanLifecycleStateMachine.transition(LoanEvent.LOAN_APPROVED, LoanStatus.fromInt(this.loanStatus)); if (!statusEnum.hasStateOf(LoanStatus.fromInt(this.loanStatus))) { @@ -1640,7 +1640,7 @@ public class Loan extends AbstractPersistable { public Map undoApproval(final LoanLifecycleStateMachine loanLifecycleStateMachine) { validateAccountStatus(LoanEvent.LOAN_APPROVAL_UNDO); - final Map actualChanges = new LinkedHashMap(); + final Map actualChanges = new LinkedHashMap<>(); final LoanStatus currentStatus = LoanStatus.fromInt(this.loanStatus); final LoanStatus statusEnum = loanLifecycleStateMachine.transition(LoanEvent.LOAN_APPROVAL_UNDO, currentStatus); @@ -1660,7 +1660,7 @@ public class Loan extends AbstractPersistable { public Collection findExistingTransactionIds() { - final Collection ids = new ArrayList(); + final Collection ids = new ArrayList<>(); for (final LoanTransaction transaction : this.loanTransactions) { ids.add(transaction.getId()); @@ -1671,7 +1671,7 @@ public class Loan extends AbstractPersistable { public Collection findExistingReversedTransactionIds() { - final Collection ids = new ArrayList(); + final Collection ids = new ArrayList<>(); for (final LoanTransaction transaction : this.loanTransactions) { if (transaction.isReversed()) { @@ -1841,7 +1841,7 @@ public class Loan extends AbstractPersistable { } private Collection fetchUndisbursedDetail() { - Collection disbursementDetails = new ArrayList(); + Collection disbursementDetails = new ArrayList<>(); Date date = null; for (LoanDisbursementDetails disbursementDetail : this.disbursementDetails) { if (disbursementDetail.actualDisbursementDate() == null) { @@ -1885,7 +1885,7 @@ public class Loan extends AbstractPersistable { } private void removeDisbursementDetail() { - Set details = new HashSet(this.disbursementDetails); + Set details = new HashSet<>(this.disbursementDetails); for (LoanDisbursementDetails disbursementDetail : details) { if (disbursementDetail.actualDisbursementDate() == null) { this.disbursementDetails.remove(disbursementDetail); @@ -1938,11 +1938,11 @@ public class Loan extends AbstractPersistable { final Integer loanTermFrequency = this.termFrequency; final PeriodFrequencyType loanTermPeriodFrequencyType = PeriodFrequencyType.fromInt(this.termPeriodFrequencyType); - final List disbursementData = new ArrayList(); + final List disbursementData = new ArrayList<>(); for (LoanDisbursementDetails disbursementDetails : this.disbursementDetails) { disbursementData.add(disbursementDetails.toData()); } - final List loanVariationTermsData = new ArrayList(); + final List loanVariationTermsData = new ArrayList<>(); boolean isDefaultEmiAmountReq = true; for (LoanTermVariations variationTerms : this.loanTermVariations) { if (variationTerms.getTermType().isEMIAmountVariation()) { @@ -2069,7 +2069,7 @@ public class Loan extends AbstractPersistable { validateAccountStatus(LoanEvent.LOAN_DISBURSAL_UNDO); - final Map actualChanges = new LinkedHashMap(); + final Map actualChanges = new LinkedHashMap<>(); final LoanStatus currentStatus = LoanStatus.fromInt(this.loanStatus); final LoanStatus statusEnum = this.loanLifecycleStateMachine.transition(LoanEvent.LOAN_DISBURSAL_UNDO, currentStatus); validateActivityNotBeforeClientOrGroupTransferDate(LoanEvent.LOAN_DISBURSAL_UNDO, getDisbursementDate()); @@ -2097,7 +2097,7 @@ public class Loan extends AbstractPersistable { regenerateRepaymentSchedule(loanScheduleFactory, applicationCurrency, calculatedRepaymentsStartingFromDate, isHolidayEnabled, holidays, workingDays); - if(isDisbueseAmtChanged){ + if (isDisbueseAmtChanged) { Set charges = charges(); for (LoanCharge loanCharge : charges) { recalculateLoanCharge(loanCharge); @@ -2348,7 +2348,7 @@ public class Loan extends AbstractPersistable { } private List retreiveListOfTransactionsPostDisbursement() { - final List repaymentsOrWaivers = new ArrayList(); + final List repaymentsOrWaivers = new ArrayList<>(); for (final LoanTransaction transaction : this.loanTransactions) { if (!transaction.isDisbursement() && transaction.isNotReversed()) { repaymentsOrWaivers.add(transaction); @@ -3316,7 +3316,7 @@ public class Loan extends AbstractPersistable { public Map deriveAccountingBridgeData(final CurrencyData currencyData, final List existingTransactionIds, final List existingReversedTransactionIds, boolean isAccountTransfer) { - final Map accountingBridgeData = new LinkedHashMap(); + final Map accountingBridgeData = new LinkedHashMap<>(); accountingBridgeData.put("loanId", getId()); accountingBridgeData.put("loanProductId", productId()); accountingBridgeData.put("officeId", getOfficeId()); @@ -3327,7 +3327,7 @@ public class Loan extends AbstractPersistable { accountingBridgeData.put("periodicAccrualBasedAccountingEnabled", isPeriodicAccrualAccountingEnabledOnLoanProduct()); accountingBridgeData.put("isAccountTransfer", isAccountTransfer); - final List> newLoanTransactions = new ArrayList>(); + final List> newLoanTransactions = new ArrayList<>(); for (final LoanTransaction transaction : this.loanTransactions) { if (transaction.isReversed() && !existingReversedTransactionIds.contains(transaction.getId())) { newLoanTransactions.add(transaction.toMapData(currencyData)); @@ -3614,7 +3614,7 @@ public class Loan extends AbstractPersistable { } public Set charges() { - Set loanCharges = new HashSet(); + Set loanCharges = new HashSet<>(); if (this.charges != null) { for (LoanCharge charge : this.charges) { if (charge.isActive()) { @@ -3626,7 +3626,7 @@ public class Loan extends AbstractPersistable { } public Set generateInstallmentLoanCharges(final LoanCharge loanCharge) { - final Set loanChargePerInstallments = new HashSet(); + final Set loanChargePerInstallments = new HashSet<>(); if (loanCharge.isInstalmentFee()) { for (final LoanRepaymentScheduleInstallment installment : this.repaymentScheduleInstallments) { BigDecimal amount = BigDecimal.ZERO; @@ -3645,7 +3645,7 @@ public class Loan extends AbstractPersistable { public void validateAccountStatus(final LoanEvent event) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); switch (event) { case LOAN_CREATED: @@ -3777,7 +3777,7 @@ public class Loan extends AbstractPersistable { } private List fetchAllLoanChargeIds() { - List list = new ArrayList(); + List list = new ArrayList<>(); for (LoanCharge loanCharge : this.charges) { list.add(loanCharge.getId()); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java index 687073017..89c506954 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanAccountDomainServiceJpa.java @@ -99,8 +99,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { * calendarInstance); } */ - final List existingTransactionIds = new ArrayList(); - final List existingReversedTransactionIds = new ArrayList(); + final List existingTransactionIds = new ArrayList<>(); + final List existingReversedTransactionIds = new ArrayList<>(); final Money repaymentAmount = Money.of(loan.getCurrency(), transactionAmount); LoanTransaction newRepaymentTransaction = null; @@ -126,7 +126,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { this.loanTransactionRepository.save(newRepaymentTransaction); } catch (DataIntegrityViolationException e) { final Throwable realCause = e.getCause(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan.transaction"); if (realCause.getMessage().toLowerCase().contains("external_id_unique")) { baseDataValidator.reset().parameter("externalId").value(newRepaymentTransaction.getExternalId()) @@ -179,8 +179,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { boolean isAccountTransfer = true; checkClientOrGroupActive(loan); - final List existingTransactionIds = new ArrayList(); - final List existingReversedTransactionIds = new ArrayList(); + final List existingTransactionIds = new ArrayList<>(); + final List existingReversedTransactionIds = new ArrayList<>(); final Money paymentAmout = Money.of(loan.getCurrency(), transactionAmount); final LoanTransactionType loanTransactionType = LoanTransactionType.fromInt(transactionType); @@ -246,8 +246,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { final Loan loan = this.loanAccountAssembler.assembleFrom(accountId); checkClientOrGroupActive(loan); - final List existingTransactionIds = new ArrayList(); - final List existingReversedTransactionIds = new ArrayList(); + final List existingTransactionIds = new ArrayList<>(); + final List existingReversedTransactionIds = new ArrayList<>(); final Money refundAmount = Money.of(loan.getCurrency(), transactionAmount); final LoanTransaction newRefundTransaction = LoanTransaction.refund(loan.getOffice(), refundAmount, paymentDetail, transactionDate, @@ -286,8 +286,8 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { final Loan loan = this.loanAccountAssembler.assembleFrom(loanId); checkClientOrGroupActive(loan); boolean isAccountTransfer = true; - final List existingTransactionIds = new ArrayList(); - final List existingReversedTransactionIds = new ArrayList(); + final List existingTransactionIds = new ArrayList<>(); + final List existingReversedTransactionIds = new ArrayList<>(); final Money amount = Money.of(loan.getCurrency(), transactionAmount); LoanTransaction disbursementTransaction = LoanTransaction.disbursement(loan.getOffice(), amount, paymentDetail, transactionDate, txnExternalId); @@ -297,7 +297,7 @@ public class LoanAccountDomainServiceJpa implements LoanAccountDomainService { this.loanTransactionRepository.save(disbursementTransaction); } catch (DataIntegrityViolationException e) { final Throwable realCause = e.getCause(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan.transaction"); if (realCause.getMessage().toLowerCase().contains("external_id_unique")) { baseDataValidator.reset().parameter("externalId").value(disbursementTransaction.getExternalId()) diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanCharge.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanCharge.java index f24d74367..fc5b70bac 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanCharge.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanCharge.java @@ -109,7 +109,7 @@ public class LoanCharge extends AbstractPersistable { @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "loancharge", orphanRemoval = true) - private final Set loanInstallmentCharge = new HashSet(); + private final Set loanInstallmentCharge = new HashSet<>(); @Column(name = "is_active", nullable = false) private boolean active = true; @@ -420,7 +420,7 @@ public class LoanCharge extends AbstractPersistable { public Map update(final JsonCommand command, final BigDecimal amount) { - final Map actualChanges = new LinkedHashMap(7); + final Map actualChanges = new LinkedHashMap<>(7); final String dateFormatAsInput = command.dateFormat(); final String localeAsInput = command.locale(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanTransaction.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanTransaction.java index 0d8f16514..766f0cab0 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanTransaction.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/LoanTransaction.java @@ -93,7 +93,7 @@ public final class LoanTransaction extends AbstractPersistable { @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "loanTransaction", orphanRemoval = true) - private Set loanChargesPaid = new HashSet(); + private Set loanChargesPaid = new HashSet<>(); protected LoanTransaction() { this.loan = null; @@ -465,7 +465,7 @@ public final class LoanTransaction extends AbstractPersistable { } public Map toMapData(final CurrencyData currencyData) { - final Map thisTransactionData = new LinkedHashMap(); + final Map thisTransactionData = new LinkedHashMap<>(); final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(this.typeOf); @@ -487,9 +487,9 @@ public final class LoanTransaction extends AbstractPersistable { } if (!this.loanChargesPaid.isEmpty()) { - final List> loanChargesPaidData = new ArrayList>(); + final List> loanChargesPaidData = new ArrayList<>(); for (final LoanChargePaidBy chargePaidBy : this.loanChargesPaid) { - final Map loanChargePaidData = new LinkedHashMap(); + final Map loanChargePaidData = new LinkedHashMap<>(); loanChargePaidData.put("chargeId", chargePaidBy.getLoanCharge().getCharge().getId()); loanChargePaidData.put("isPenalty", chargePaidBy.getLoanCharge().getCharge().isPenalty()); loanChargePaidData.put("loanChargeId", chargePaidBy.getLoanCharge().getId()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java index 35149ed3c..04f7ac051 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/domain/transactionprocessor/AbstractLoanRepaymentScheduleTransactionProcessor.java @@ -66,12 +66,12 @@ public abstract class AbstractLoanRepaymentScheduleTransactionProcessor implemen wrapper.reprocess(currency, disbursementDate, installments, charges); final ChangedTransactionDetail changedTransactionDetail = new ChangedTransactionDetail(); - final List transactionstoBeProcessed = new ArrayList(); + final List transactionstoBeProcessed = new ArrayList<>(); for (final LoanTransaction loanTransaction : transactionsPostDisbursement) { if (loanTransaction.isChargePayment()) { - final List chargePaymentInstallments = new ArrayList(); + final List chargePaymentInstallments = new ArrayList<>(); final Set chargePaidBies = loanTransaction.getLoanChargesPaid(); - final Set transferCharges = new HashSet(); + final Set transferCharges = new HashSet<>(); for (final LoanChargePaidBy chargePaidBy : chargePaidBies) { LoanCharge loanCharge = chargePaidBy.getLoanCharge(); transferCharges.add(loanCharge); @@ -209,7 +209,7 @@ public abstract class AbstractLoanRepaymentScheduleTransactionProcessor implemen } private Set extractFeeCharges(final Set loanCharges) { - final Set feeCharges = new HashSet(); + final Set feeCharges = new HashSet<>(); for (final LoanCharge loanCharge : loanCharges) { if (loanCharge.isFeeCharge()) { feeCharges.add(loanCharge); @@ -219,7 +219,7 @@ public abstract class AbstractLoanRepaymentScheduleTransactionProcessor implemen } private Set extractPenaltyCharges(final Set loanCharges) { - final Set penaltyCharges = new HashSet(); + final Set penaltyCharges = new HashSet<>(); for (final LoanCharge loanCharge : loanCharges) { if (loanCharge.isPenaltyCharge()) { penaltyCharges.add(loanCharge); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/GuarantorConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/GuarantorConstants.java index 93588397d..acc73e2d1 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/GuarantorConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/GuarantorConstants.java @@ -27,7 +27,7 @@ public class GuarantorConstants { this.value = value; } - private static final Set values = new HashSet(); + private static final Set values = new HashSet<>(); static { for (final GUARANTOR_JSON_INPUT_PARAMS type : GUARANTOR_JSON_INPUT_PARAMS.values()) { values.add(type.value); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java index b99cc90dd..8678365df 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/api/GuarantorsApiResource.java @@ -48,7 +48,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class GuarantorsApiResource { - private static final Set RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "loanId", "clientRelationshipType", + private static final Set RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "loanId", "clientRelationshipType", "guarantorType", "firstname", "lastname", "entityId", "externalId", "officeName", "joinedDate", "addressLine1", "addressLine2", "city", "state", "zip", "country", "mobileNumber", "housePhoneNumber", "comment", "dob", "guarantorTypeOptions", "allowedClientRelationshipTypes")); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/command/GuarantorCommand.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/command/GuarantorCommand.java index 3243316bd..768b617af 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/command/GuarantorCommand.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/command/GuarantorCommand.java @@ -78,7 +78,7 @@ public class GuarantorCommand { public void validateForCreate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = getDataValidator(dataValidationErrors); @@ -106,7 +106,7 @@ public class GuarantorCommand { } public void validateForUpdate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = getDataValidator(dataValidationErrors); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/domain/Guarantor.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/domain/Guarantor.java index 925bfa482..b49adbfb6 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/domain/Guarantor.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/domain/Guarantor.java @@ -143,7 +143,7 @@ public class Guarantor extends AbstractPersistable { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(); + final Map actualChanges = new LinkedHashMap<>(); handlePropertyUpdate(command, actualChanges, GUARANTOR_JSON_INPUT_PARAMS.GUARANTOR_TYPE_ID.getValue(), this.gurantorType, true); handlePropertyUpdate(command, actualChanges, GUARANTOR_JSON_INPUT_PARAMS.CLIENT_RELATIONSHIP_TYPE_ID.getValue(), 0, true); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/domain/GuarantorType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/domain/GuarantorType.java index cd1c214c0..ce0f4dd24 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/domain/GuarantorType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/domain/GuarantorType.java @@ -27,7 +27,7 @@ public enum GuarantorType { return this.code; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); private static int minValue; private static int maxValue; static { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/service/GuarantorEnumerations.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/service/GuarantorEnumerations.java index 5867ac79a..3fa074591 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/service/GuarantorEnumerations.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/service/GuarantorEnumerations.java @@ -24,7 +24,7 @@ public class GuarantorEnumerations { } public static List guarantorType(final GuarantorType[] guarantorTypes) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final GuarantorType guarantorType : guarantorTypes) { optionDatas.add(guarantorType(guarantorType)); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/service/GuarantorReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/service/GuarantorReadPlatformServiceImpl.java index 6e859100d..2eb37e87c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/service/GuarantorReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/guarantor/service/GuarantorReadPlatformServiceImpl.java @@ -103,7 +103,7 @@ public class GuarantorReadPlatformServiceImpl implements GuarantorReadPlatformSe sql += " where loan_id = ?"; final List guarantorDatas = this.jdbcTemplate.query(sql, rm, new Object[] { loanId }); - final List mergedGuarantorDatas = new ArrayList(); + final List mergedGuarantorDatas = new ArrayList<>(); for (final GuarantorData guarantorData : guarantorDatas) { mergedGuarantorDatas.add(mergeDetailsForClientOrStaffGuarantor(guarantorData)); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java index 2c90a3ff2..bb1649369 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/AbstractLoanScheduleGenerator.java @@ -265,9 +265,9 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener Collection periods = null; if (loanApplicationTerms.isMultiDisburseLoan()) { - periods = new ArrayList(numberOfRepayments + loanApplicationTerms.getDisbursementDatas().size()); + periods = new ArrayList<>(numberOfRepayments + loanApplicationTerms.getDisbursementDatas().size()); } else { - periods = new ArrayList(numberOfRepayments + 1); + periods = new ArrayList<>(numberOfRepayments + 1); final LoanScheduleModelDisbursementPeriod disbursementPeriod = LoanScheduleModelDisbursementPeriod.disbursement( loanApplicationTerms, chargesDueAtTimeOfDisbursement); periods.add(disbursementPeriod); @@ -354,7 +354,7 @@ public abstract class AbstractLoanScheduleGenerator implements LoanScheduleGener && loanCharge.isDueForCollectionFromAndUpToAndIncluding(periodStart, periodEnd) && loanCharge.getChargeCalculation().isPercentageBased()) { cumulative = cumulative.plus(loanCharge.chargeAmount()); - }else if (loanCharge.isDueForCollectionFromAndUpToAndIncluding(periodStart, periodEnd) + } else if (loanCharge.isDueForCollectionFromAndUpToAndIncluding(periodStart, periodEnd) && loanCharge.getChargeCalculation().isPercentageBased()) { BigDecimal amount = BigDecimal.ZERO; if (loanCharge.getChargeCalculation().isPercentageOfAmountAndInterest()) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/LoanScheduleModel.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/LoanScheduleModel.java index 98b796534..6b4b25f39 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/LoanScheduleModel.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/domain/LoanScheduleModel.java @@ -65,7 +65,7 @@ public final class LoanScheduleModel { final Integer inMultiplesOf = this.totalPrincipalDisbursed.getCurrencyInMultiplesOf(); final CurrencyData currency = this.applicationCurrency.toData(decimalPlaces, inMultiplesOf); - final Collection periodsData = new ArrayList(); + final Collection periodsData = new ArrayList<>(); for (final LoanScheduleModelPeriod modelPeriod : this.periods) { periodsData.add(modelPeriod.toData()); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java index df4a8257d..5bb1e0c7b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/service/LoanScheduleAssembler.java @@ -195,8 +195,9 @@ public class LoanScheduleAssembler { final Integer graceOnInterestPayment = this.fromApiJsonHelper.extractIntegerWithLocaleNamed("graceOnInterestPayment", element); final Integer graceOnInterestCharged = this.fromApiJsonHelper.extractIntegerWithLocaleNamed("graceOnInterestCharged", element); final LocalDate interestChargedFromDate = this.fromApiJsonHelper.extractLocalDateNamed("interestChargedFromDate", element); - - final Integer graceOnArrearsAgeing = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(LoanProductConstants.graceOnArrearsAgeingParameterName, element); + + final Integer graceOnArrearsAgeing = this.fromApiJsonHelper.extractIntegerWithLocaleNamed( + LoanProductConstants.graceOnArrearsAgeingParameterName, element); // other final BigDecimal inArrearsTolerance = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed("inArrearsTolerance", element); @@ -209,7 +210,7 @@ public class LoanScheduleAssembler { final List disbursementDatas = fetchDisbursementData(element.getAsJsonObject()); - final List loanVariationTermsData = new ArrayList(); + final List loanVariationTermsData = new ArrayList<>(); LoanTermVariationsData data = new LoanTermVariationsData(null, LoanEnumerations.loanvariationType(LoanTermVariationType.EMI_AMOUNT), expectedDisbursementDate, emiAmount); loanVariationTermsData.add(data); @@ -219,13 +220,14 @@ public class LoanScheduleAssembler { interestRatePeriodFrequencyType, annualNominalInterestRate, interestCalculationPeriodMethod, principalMoney, expectedDisbursementDate, repaymentsStartingFromDate, calculatedRepaymentsStartingFromDate, graceOnPrincipalPayment, graceOnInterestPayment, graceOnInterestCharged, interestChargedFromDate, inArrearsToleranceMoney, - loanProduct.isMultiDisburseLoan(), emiAmount, disbursementDatas, maxOutstandingBalance, loanVariationTermsData,graceOnArrearsAgeing); + loanProduct.isMultiDisburseLoan(), emiAmount, disbursementDatas, maxOutstandingBalance, loanVariationTermsData, + graceOnArrearsAgeing); } private List fetchDisbursementData(final JsonObject command) { final Locale locale = this.fromApiJsonHelper.extractLocaleParameter(command); final String dateFormat = this.fromApiJsonHelper.extractDateFormatParameter(command); - List disbursementDatas = new ArrayList(); + List disbursementDatas = new ArrayList<>(); if (command.has(LoanApiConstants.disbursementDataParameterName)) { final JsonArray disbursementDataArray = command.getAsJsonArray(LoanApiConstants.disbursementDataParameterName); if (disbursementDataArray != null && disbursementDataArray.size() > 0) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java index 8d7d1692a..425748dbd 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/loanschedule/service/LoanScheduleCalculationPlatformServiceImpl.java @@ -58,7 +58,7 @@ public class LoanScheduleCalculationPlatformServiceImpl implements LoanScheduleC } this.fromApiJsonDeserializer.validate(query.json()); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan"); final Long productId = this.fromJsonHelper.extractLongNamed("productId", query.parsedJson()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/CalculateLoanScheduleQueryFromApiJsonHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/CalculateLoanScheduleQueryFromApiJsonHelper.java index 054928e32..d5c56cbb9 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/CalculateLoanScheduleQueryFromApiJsonHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/CalculateLoanScheduleQueryFromApiJsonHelper.java @@ -33,7 +33,7 @@ public final class CalculateLoanScheduleQueryFromApiJsonHelper { /** * The parameters supported for this command. */ - final Set supportedParameters = new HashSet(Arrays.asList("id", "clientId", "groupId", "loanType", "calendarId", + final Set supportedParameters = new HashSet<>(Arrays.asList("id", "clientId", "groupId", "loanType", "calendarId", "productId", "accountNo", "externalId", "fundId", "loanOfficerId", "loanPurposeId", "transactionProcessingStrategyId", "principal", "inArrearsTolerance", "interestRatePerPeriod", "repaymentEvery", "numberOfRepayments", "loanTermFrequency", "loanTermFrequencyType", "repaymentFrequencyType", "amortizationType", "interestType", @@ -56,7 +56,7 @@ public final class CalculateLoanScheduleQueryFromApiJsonHelper { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java index 5fb30ae56..b3aefac04 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanApplicationCommandFromApiJsonHelper.java @@ -43,8 +43,8 @@ public final class LoanApplicationCommandFromApiJsonHelper { /** * The parameters supported for this command. */ - final Set supportedParameters = new HashSet(Arrays.asList("dateFormat", "locale", "id", "clientId", "groupId", - "loanType", "productId", "principal", "loanTermFrequency", "loanTermFrequencyType", "numberOfRepayments", "repaymentEvery", + final Set supportedParameters = new HashSet<>(Arrays.asList("dateFormat", "locale", "id", "clientId", "groupId", "loanType", + "productId", "principal", "loanTermFrequency", "loanTermFrequencyType", "numberOfRepayments", "repaymentEvery", "repaymentFrequencyType", "interestRatePerPeriod", "amortizationType", "interestType", "interestCalculationPeriodType", "expectedDisbursementDate", "repaymentsStartingFromDate", "graceOnPrincipalPayment", "graceOnInterestPayment", "graceOnInterestCharged", @@ -77,7 +77,7 @@ public final class LoanApplicationCommandFromApiJsonHelper { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -266,7 +266,7 @@ public final class LoanApplicationCommandFromApiJsonHelper { if (topLevelJsonElement.get(chargesParameterName).isJsonArray()) { final Type arrayObjectParameterTypeOfMap = new TypeToken>() {}.getType(); - final Set supportedParameters = new HashSet(Arrays.asList("id", "chargeId", "amount", "chargeTimeType", + final Set supportedParameters = new HashSet<>(Arrays.asList("id", "chargeId", "amount", "chargeTimeType", "chargeCalculationType", "dueDate")); final JsonArray array = topLevelJsonElement.get("charges").getAsJsonArray(); @@ -298,7 +298,7 @@ public final class LoanApplicationCommandFromApiJsonHelper { if (topLevelJsonElement.get("collateral").isJsonArray()) { final Type collateralParameterTypeOfMap = new TypeToken>() {}.getType(); - final Set supportedParameters = new HashSet(Arrays.asList("id", "type", "value", "description")); + final Set supportedParameters = new HashSet<>(Arrays.asList("id", "type", "value", "description")); final JsonArray array = topLevelJsonElement.get("collateral").getAsJsonArray(); for (int i = 1; i <= array.size(); i++) { final JsonObject collateralItemElement = array.get(i - 1).getAsJsonObject(); @@ -366,7 +366,7 @@ public final class LoanApplicationCommandFromApiJsonHelper { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan"); final JsonElement element = this.fromApiJsonHelper.parse(json); boolean atLeastOneParameterPassedForUpdate = false; @@ -603,7 +603,7 @@ public final class LoanApplicationCommandFromApiJsonHelper { if (topLevelJsonElement.get(chargesParameterName).isJsonArray()) { final Type arrayObjectParameterTypeOfMap = new TypeToken>() {}.getType(); - final Set supportedParameters = new HashSet(Arrays.asList("id", "chargeId", "amount", "chargeTimeType", + final Set supportedParameters = new HashSet<>(Arrays.asList("id", "chargeId", "amount", "chargeTimeType", "chargeCalculationType", "dueDate")); final JsonArray array = topLevelJsonElement.get("charges").getAsJsonArray(); @@ -635,7 +635,7 @@ public final class LoanApplicationCommandFromApiJsonHelper { if (topLevelJsonElement.get("collateral").isJsonArray()) { final Type collateralParameterTypeOfMap = new TypeToken>() {}.getType(); - final Set supportedParameters = new HashSet(Arrays.asList("id", "type", "value", "description")); + final Set supportedParameters = new HashSet<>(Arrays.asList("id", "type", "value", "description")); final JsonArray array = topLevelJsonElement.get("collateral").getAsJsonArray(); for (int i = 1; i <= array.size(); i++) { final JsonObject collateralItemElement = array.get(i - 1).getAsJsonObject(); @@ -708,11 +708,11 @@ public final class LoanApplicationCommandFromApiJsonHelper { public void validateForUndo(final String json) { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set undoSupportedParameters = new HashSet(Arrays.asList("note")); + final Set undoSupportedParameters = new HashSet<>(Arrays.asList("note")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, undoSupportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanapplication.undo"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -727,7 +727,7 @@ public final class LoanApplicationCommandFromApiJsonHelper { public void validateMinMaxConstraintValues(final JsonElement element, final LoanProduct loanProduct) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan"); final BigDecimal minPrincipal = loanProduct.getMinPrincipalAmount().getAmount(); @@ -746,7 +746,7 @@ public final class LoanApplicationCommandFromApiJsonHelper { public void validateLoanTermAndRepaidEveryValues(final Integer loanTermFrequency, final Integer loanTermFrequencyType, final Integer numberOfRepayments, final Integer repaymentEvery, final Integer repaymentEveryType) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); this.apiJsonHelper.validateSelectedPeriodFrequencyTypeIsTheSame(dataValidationErrors, loanTermFrequency, loanTermFrequencyType, numberOfRepayments, repaymentEvery, repaymentEveryType); if (!dataValidationErrors.isEmpty()) { throw new PlatformApiDataValidationException("validation.msg.validation.errors.exist", @@ -754,7 +754,7 @@ public final class LoanApplicationCommandFromApiJsonHelper { } public void validatelinkedSavingsAccount(final SavingsAccount savingsAccount, final Loan loanApplication) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); if (savingsAccount.isNotActive()) { final ApiParameterError error = ApiParameterError.parameterError("validation.msg.loan.linked.savings.account.is.not.active", "Linked Savings account with id:" + savingsAccount.getId() + " is not in active state", "linkAccountId", @@ -781,7 +781,7 @@ public final class LoanApplicationCommandFromApiJsonHelper { boolean isFirstinstallmentOnExpectedDisbursementDate = false; final JsonArray variationArray = this.fromApiJsonHelper.extractJsonArrayNamed(LoanApiConstants.disbursementDataParameterName, element); - List expectedDisbursementDates = new ArrayList(); + List expectedDisbursementDates = new ArrayList<>(); if (variationArray != null && variationArray.size() > 0) { int i = 0; do { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanApplicationTransitionApiJsonValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanApplicationTransitionApiJsonValidator.java index 6d3053b25..f0e1ea8c6 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanApplicationTransitionApiJsonValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanApplicationTransitionApiJsonValidator.java @@ -45,12 +45,12 @@ public final class LoanApplicationTransitionApiJsonValidator { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set disbursementParameters = new HashSet(Arrays.asList("approvedOnDate", "note", "locale", "dateFormat")); + final Set disbursementParameters = new HashSet<>(Arrays.asList("approvedOnDate", "note", "locale", "dateFormat")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, disbursementParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanapplication"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -67,12 +67,12 @@ public final class LoanApplicationTransitionApiJsonValidator { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set disbursementParameters = new HashSet(Arrays.asList("rejectedOnDate", "note", "locale", "dateFormat")); + final Set disbursementParameters = new HashSet<>(Arrays.asList("rejectedOnDate", "note", "locale", "dateFormat")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, disbursementParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanapplication"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -89,12 +89,12 @@ public final class LoanApplicationTransitionApiJsonValidator { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set disbursementParameters = new HashSet(Arrays.asList("withdrawnOnDate", "note", "locale", "dateFormat")); + final Set disbursementParameters = new HashSet<>(Arrays.asList("withdrawnOnDate", "note", "locale", "dateFormat")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, disbursementParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanapplication"); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanEventApiJsonValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanEventApiJsonValidator.java index 86bf85663..c0d595446 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanEventApiJsonValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanEventApiJsonValidator.java @@ -55,10 +55,10 @@ public final class LoanEventApiJsonValidator { Set disbursementParameters = null; if (isAccountTransfer) { - disbursementParameters = new HashSet(Arrays.asList("actualDisbursementDate", "externalId", "note", "locale", + disbursementParameters = new HashSet<>(Arrays.asList("actualDisbursementDate", "externalId", "note", "locale", "dateFormat", LoanApiConstants.principalDisbursedParameterName, LoanApiConstants.emiAmountParameterName)); } else { - disbursementParameters = new HashSet(Arrays.asList("actualDisbursementDate", "externalId", "note", "locale", + disbursementParameters = new HashSet<>(Arrays.asList("actualDisbursementDate", "externalId", "note", "locale", "dateFormat", "paymentTypeId", "accountNumber", "checkNumber", "routingCode", "receiptNumber", "bankNumber", LoanApiConstants.principalDisbursedParameterName, LoanApiConstants.emiAmountParameterName)); } @@ -66,7 +66,7 @@ public final class LoanEventApiJsonValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, disbursementParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan.disbursement"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -108,14 +108,14 @@ public final class LoanEventApiJsonValidator { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set transactionParameters = new HashSet(Arrays.asList("transactionDate", "transactionAmount", "externalId", + final Set transactionParameters = new HashSet<>(Arrays.asList("transactionDate", "transactionAmount", "externalId", "note", "locale", "dateFormat", "paymentTypeId", "accountNumber", "checkNumber", "routingCode", "receiptNumber", "bankNumber")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, transactionParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan.transaction"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -136,14 +136,14 @@ public final class LoanEventApiJsonValidator { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set transactionParameters = new HashSet(Arrays.asList("transactionDate", "transactionAmount", "externalId", + final Set transactionParameters = new HashSet<>(Arrays.asList("transactionDate", "transactionAmount", "externalId", "note", "locale", "dateFormat", "paymentTypeId", "accountNumber", "checkNumber", "routingCode", "receiptNumber", "bankNumber")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, transactionParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan.transaction"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -179,7 +179,7 @@ public final class LoanEventApiJsonValidator { // Validate all string payment detail fields for max length final Integer paymentTypeId = this.fromApiJsonHelper.extractIntegerWithLocaleNamed("paymentTypeId", element); baseDataValidator.reset().parameter("paymentTypeId").value(paymentTypeId).ignoreIfNull().integerGreaterThanZero(); - final Set paymentDetailParameters = new HashSet(Arrays.asList("accountNumber", "checkNumber", "routingCode", + final Set paymentDetailParameters = new HashSet<>(Arrays.asList("accountNumber", "checkNumber", "routingCode", "receiptNumber", "bankNumber")); for (final String paymentDetailParameterName : paymentDetailParameters) { final String paymentDetailParameterValue = this.fromApiJsonHelper.extractStringNamed(paymentDetailParameterName, element); @@ -191,12 +191,12 @@ public final class LoanEventApiJsonValidator { public void validateTransactionWithNoAmount(final String json) { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set disbursementParameters = new HashSet(Arrays.asList("transactionDate", "note", "locale", "dateFormat")); + final Set disbursementParameters = new HashSet<>(Arrays.asList("transactionDate", "note", "locale", "dateFormat")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, disbursementParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan.transaction"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -212,13 +212,13 @@ public final class LoanEventApiJsonValidator { public void validateAddLoanCharge(final String json) { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set disbursementParameters = new HashSet(Arrays.asList("chargeId", "amount", "dueDate", "locale", + final Set disbursementParameters = new HashSet<>(Arrays.asList("chargeId", "amount", "dueDate", "locale", "dateFormat")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, disbursementParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanCharge"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -238,12 +238,12 @@ public final class LoanEventApiJsonValidator { public void validateUpdateOfLoanCharge(final String json) { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set disbursementParameters = new HashSet(Arrays.asList("amount", "dueDate", "locale", "dateFormat")); + final Set disbursementParameters = new HashSet<>(Arrays.asList("amount", "dueDate", "locale", "dateFormat")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, disbursementParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanCharge"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -261,13 +261,13 @@ public final class LoanEventApiJsonValidator { public void validateUpdateOfLoanOfficer(final String json) { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set disbursementParameters = new HashSet(Arrays.asList("assignmentDate", "fromLoanOfficerId", + final Set disbursementParameters = new HashSet<>(Arrays.asList("assignmentDate", "fromLoanOfficerId", "toLoanOfficerId", "locale", "dateFormat")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, disbursementParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanOfficer"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -289,13 +289,13 @@ public final class LoanEventApiJsonValidator { public void validateForBulkLoanReassignment(final String json) { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set supportedParameters = new HashSet(Arrays.asList("assignmentDate", "fromLoanOfficerId", "toLoanOfficerId", + final Set supportedParameters = new HashSet<>(Arrays.asList("assignmentDate", "fromLoanOfficerId", "toLoanOfficerId", "loans", "locale", "dateFormat")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanOfficer"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -317,17 +317,17 @@ public final class LoanEventApiJsonValidator { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } Set transactionParameters = null; if (isChargeIdIncluded) { - transactionParameters = new HashSet(Arrays.asList("transactionDate", "locale", "dateFormat", "chargeId", "dueDate", + transactionParameters = new HashSet<>(Arrays.asList("transactionDate", "locale", "dateFormat", "chargeId", "dueDate", "installmentNumber")); } else { - transactionParameters = new HashSet(Arrays.asList("transactionDate", "locale", "dateFormat", "dueDate", + transactionParameters = new HashSet<>(Arrays.asList("transactionDate", "locale", "dateFormat", "dueDate", "installmentNumber")); } final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, transactionParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource("loan.charge.payment.transaction"); @@ -347,12 +347,12 @@ public final class LoanEventApiJsonValidator { public void validateInstallmentChargeTransaction(final String json) { if (StringUtils.isBlank(json)) { return; } - Set transactionParameters = new HashSet(Arrays.asList("dueDate", "locale", "dateFormat", "installmentNumber")); + Set transactionParameters = new HashSet<>(Arrays.asList("dueDate", "locale", "dateFormat", "installmentNumber")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, transactionParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource("loan.charge.waive.transaction"); @@ -367,13 +367,13 @@ public final class LoanEventApiJsonValidator { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set disbursementParameters = new HashSet(Arrays.asList(LoanApiConstants.disbursementDateParameterName, + final Set disbursementParameters = new HashSet<>(Arrays.asList(LoanApiConstants.disbursementDateParameterName, "locale", "dateFormat")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, disbursementParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan.update.disbursement"); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanUpdateCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanUpdateCommandFromApiJsonDeserializer.java index 423d77c02..50355faea 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanUpdateCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/serialization/LoanUpdateCommandFromApiJsonDeserializer.java @@ -29,7 +29,7 @@ public final class LoanUpdateCommandFromApiJsonDeserializer extends AbstractFrom /** * The parameters supported for this command. */ - final Set supportedParameters = new HashSet(Arrays.asList("unassignedDate", "locale", "dateFormat")); + final Set supportedParameters = new HashSet<>(Arrays.asList("unassignedDate", "locale", "dateFormat")); private final FromJsonHelper fromApiJsonHelper; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanAccrualWritePlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanAccrualWritePlatformServiceImpl.java index 14a26d25d..176c99753 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanAccrualWritePlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanAccrualWritePlatformServiceImpl.java @@ -139,7 +139,7 @@ public class LoanAccrualWritePlatformServiceImpl implements LoanAccrualWritePlat public Map deriveAccountingBridgeData(final LoanScheduleAccrualData loanScheduleAccrualData, final Map transactionMap) { - final Map accountingBridgeData = new LinkedHashMap(); + final Map accountingBridgeData = new LinkedHashMap<>(); accountingBridgeData.put("loanId", loanScheduleAccrualData.getLoanId()); accountingBridgeData.put("loanProductId", loanScheduleAccrualData.getLoanProductId()); accountingBridgeData.put("officeId", loanScheduleAccrualData.getOfficeId()); @@ -149,7 +149,7 @@ public class LoanAccrualWritePlatformServiceImpl implements LoanAccrualWritePlat accountingBridgeData.put("periodicAccrualBasedAccountingEnabled", true); accountingBridgeData.put("isAccountTransfer", false); - final List> newLoanTransactions = new ArrayList>(); + final List> newLoanTransactions = new ArrayList<>(); newLoanTransactions.add(transactionMap); accountingBridgeData.put("newLoanTransactions", newLoanTransactions); @@ -158,7 +158,7 @@ public class LoanAccrualWritePlatformServiceImpl implements LoanAccrualWritePlat public Map toMapData(final Long id, final BigDecimal amount, final BigDecimal interestportion, final BigDecimal feeportion, final BigDecimal penaltyportion, final LoanScheduleAccrualData loanScheduleAccrualData) { - final Map thisTransactionData = new LinkedHashMap(); + final Map thisTransactionData = new LinkedHashMap<>(); final LoanTransactionEnumData transactionType = LoanEnumerations.transactionType(LoanTransactionType.ACCRUAL); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java index bc8dbc445..e73128d95 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanApplicationWritePlatformServiceJpaRepositoryImpl.java @@ -171,7 +171,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa this.fromApiJsonDeserializer.validateForCreate(command.json()); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan"); final Long productId = this.fromJsonHelper.extractLongNamed("productId", command.parsedJson()); @@ -272,7 +272,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa loanId); } final Set existingCharges = existingLoanApplication.charges(); - Map chargesMap = new HashMap(); + Map chargesMap = new HashMap<>(); for (LoanCharge charge : existingCharges) { LoanChargeData chargeData = new LoanChargeData(charge.getId(), charge.getDueLocalDate(), charge.amountOrPercentage()); chargesMap.put(charge.getId(), chargeData); @@ -348,7 +348,7 @@ public class LoanApplicationWritePlatformServiceJpaRepositoryImpl implements Loa if (!changes.containsKey("interestRateFrequencyType")) { existingLoanApplication.updateInterestRateFrequencyType(); } - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan"); if (loanProduct.useBorrowerCycle()) { final Long clientId = this.fromJsonHelper.extractLongNamed("clientId", command.parsedJson()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanAssembler.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanAssembler.java index 2a29bfd85..ef62039e1 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanAssembler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanAssembler.java @@ -279,7 +279,7 @@ public class LoanAssembler { private Set fetchDisbursementData(final JsonObject command) { final Locale locale = this.fromApiJsonHelper.extractLocaleParameter(command); final String dateFormat = this.fromApiJsonHelper.extractDateFormatParameter(command); - Set disbursementDatas = new HashSet(); + Set disbursementDatas = new HashSet<>(); if (command.has(LoanApiConstants.disbursementDataParameterName)) { final JsonArray disbursementDataArray = command.getAsJsonArray(LoanApiConstants.disbursementDataParameterName); if (disbursementDataArray != null && disbursementDataArray.size() > 0) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanChargeAssembler.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanChargeAssembler.java index bbf46ae5e..3b95294a6 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanChargeAssembler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanChargeAssembler.java @@ -45,7 +45,7 @@ public class LoanChargeAssembler { public Set fromParsedJson(final JsonElement element) { - final Set loanCharges = new HashSet(); + final Set loanCharges = new HashSet<>(); final BigDecimal principal = this.fromApiJsonHelper.extractBigDecimalWithLocaleNamed("principal", element); final Integer numberOfRepayments = this.fromApiJsonHelper.extractIntegerWithLocaleNamed("numberOfRepayments", element); @@ -76,8 +76,8 @@ public class LoanChargeAssembler { if (chargeDefinition.isOverdueInstallment()) { final String defaultUserMessage = "Installment charge cannot be added to the loan."; - throw new LoanChargeCannotBeAddedException("loanCharge", "overdue.charge", - defaultUserMessage, null, chargeDefinition.getName()); + throw new LoanChargeCannotBeAddedException("loanCharge", "overdue.charge", defaultUserMessage, null, + chargeDefinition.getName()); } ChargeTimeType chargeTime = null; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java index 503303718..2ba837de1 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanReadPlatformServiceImpl.java @@ -108,7 +108,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService { private final CodeValueReadPlatformService codeValueReadPlatformService; private final CalendarReadPlatformService calendarReadPlatformService; private final StaffReadPlatformService staffReadPlatformService; - private final PaginationHelper paginationHelper = new PaginationHelper(); + private final PaginationHelper paginationHelper = new PaginationHelper<>(); private final LoanMapper loaanLoanMapper = new LoanMapper(); @Autowired @@ -219,7 +219,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService { sqlBuilder.append(" where ( o.hierarchy like ? or transferToOffice.hierarchy like ?)"); int arrayPos = 2; - List extraCriterias = new ArrayList(); + List extraCriterias = new ArrayList<>(); extraCriterias.add(hierarchySearchString); extraCriterias.add(hierarchySearchString); @@ -811,7 +811,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService { this.disbursement.disbursementDate(), this.disbursement.amount(), this.totalFeeChargesDueAtDisbursement, this.disbursement.isDisbursed()); - final Collection periods = new ArrayList(); + final Collection periods = new ArrayList<>(); final MonetaryCurrency monCurrency = new MonetaryCurrency(this.currency.code(), this.currency.decimalPlaces(), this.currency.currencyInMultiplesOf()); BigDecimal totalPrincipalDisbursed = BigDecimal.ZERO; @@ -1198,7 +1198,7 @@ public class LoanReadPlatformServiceImpl implements LoanReadPlatformService { @Override public Collection retrieveCalendars(final Long groupId) { - Collection calendarsData = new ArrayList(); + Collection calendarsData = new ArrayList<>(); calendarsData.addAll(this.calendarReadPlatformService.retrieveParentCalendarsByEntity(groupId, CalendarEntityType.GROUPS.getValue(), null)); calendarsData diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java index f0201fffb..3366c5fca 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanaccount/service/LoanWritePlatformServiceJpaRepositoryImpl.java @@ -243,10 +243,10 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final MonetaryCurrency currency = loan.getCurrency(); final ApplicationCurrency applicationCurrency = this.applicationCurrencyRepository.findOneWithNotFoundDetection(currency); - final List existingTransactionIds = new ArrayList(); - final List existingReversedTransactionIds = new ArrayList(); + final List existingTransactionIds = new ArrayList<>(); + final List existingReversedTransactionIds = new ArrayList<>(); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes); @@ -308,7 +308,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf } final Set loanCharges = loan.charges(); - final Map disBuLoanCharges = new HashMap(); + final Map disBuLoanCharges = new HashMap<>(); for (final LoanCharge loanCharge : loanCharges) { if (loanCharge.isDueAtDisbursement() && loanCharge.getChargePaymentMode().isPaymentModeAccountTransfer() && loanCharge.isNotFullyPaid() && !loanCharge.isWaived()) { @@ -345,7 +345,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf this.loanRepository.saveAndFlush(loan); } catch (final DataIntegrityViolationException e) { final Throwable realCause = e.getCause(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loan.transaction"); if (realCause.getMessage().toLowerCase().contains("external_id_unique")) { baseDataValidator.reset().parameter("externalId").failWithCode("value.must.be.unique"); @@ -395,7 +395,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final AppUser currentUser = this.context.authenticatedUser(); final SingleDisbursalCommand[] disbursalCommand = bulkDisbursalCommand.getDisburseTransactions(); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); if (disbursalCommand == null) { return changes; } for (int i = 0; i < disbursalCommand.length; i++) { @@ -406,8 +406,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final MonetaryCurrency currency = loan.getCurrency(); final ApplicationCurrency applicationCurrency = this.applicationCurrencyRepository.findOneWithNotFoundDetection(currency); - final List existingTransactionIds = new ArrayList(); - final List existingReversedTransactionIds = new ArrayList(); + final List existingTransactionIds = new ArrayList<>(); + final List existingReversedTransactionIds = new ArrayList<>(); final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes); @@ -450,7 +450,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf this.loanRepository.save(loan); } catch (final DataIntegrityViolationException e) { final Throwable realCause = e.getCause(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource("loan.transaction"); if (realCause.getMessage().toLowerCase().contains("external_id_unique")) { @@ -482,7 +482,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf postJournalEntries(loan, existingTransactionIds, existingReversedTransactionIds); } final Set loanCharges = loan.charges(); - final Map disBuLoanCharges = new HashMap(); + final Map disBuLoanCharges = new HashMap<>(); for (final LoanCharge loanCharge : loanCharges) { if (loanCharge.isDueAtDisbursement() && loanCharge.getChargePaymentMode().isPaymentModeAccountTransfer() && loanCharge.isNotFullyPaid() && !loanCharge.isWaived()) { @@ -530,8 +530,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf actualDisbursementDate.toDate()); final WorkingDays workingDays = this.workingDaysRepository.findOne(); - final List existingTransactionIds = new ArrayList(); - final List existingReversedTransactionIds = new ArrayList(); + final List existingTransactionIds = new ArrayList<>(); + final List existingReversedTransactionIds = new ArrayList<>(); final Map changes = loan.undoDisbursal(this.loanScheduleFactory, applicationCurrency, existingTransactionIds, existingReversedTransactionIds, calculatedRepaymentsStartingFromDate, isHolidayEnabled, holidays, workingDays); @@ -576,7 +576,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final BigDecimal transactionAmount = command.bigDecimalValueOfParameterNamed("transactionAmount"); final String txnExternalId = command.stringValueOfParameterNamedAllowingNull("externalId"); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); changes.put("transactionDate", command.stringValueOfParameterNamed("transactionDate")); changes.put("transactionAmount", command.stringValueOfParameterNamed("transactionAmount")); changes.put("locale", command.locale()); @@ -607,7 +607,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf this.context.authenticatedUser(); final SingleRepaymentCommand[] repaymentCommand = bulkRepaymentCommand.getLoanTransactions(); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); final boolean isRecoveryRepayment = false; if (repaymentCommand == null) { return changes; } @@ -653,15 +653,15 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final BigDecimal transactionAmount = command.bigDecimalValueOfParameterNamed("transactionAmount"); final String txnExternalId = command.stringValueOfParameterNamedAllowingNull("externalId"); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); changes.put("transactionDate", command.stringValueOfParameterNamed("transactionDate")); changes.put("transactionAmount", command.stringValueOfParameterNamed("transactionAmount")); changes.put("locale", command.locale()); changes.put("dateFormat", command.dateFormat()); changes.put("paymentTypeId", command.stringValueOfParameterNamed("paymentTypeId")); - final List existingTransactionIds = new ArrayList(); - final List existingReversedTransactionIds = new ArrayList(); + final List existingTransactionIds = new ArrayList<>(); + final List existingReversedTransactionIds = new ArrayList<>(); final Money transactionAmountAsMoney = Money.of(loan.getCurrency(), transactionAmount); final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createPaymentDetail(command, changes); @@ -743,7 +743,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf this.loanEventApiJsonValidator.validateTransaction(command.json()); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); changes.put("transactionDate", command.stringValueOfParameterNamed("transactionDate")); changes.put("transactionAmount", command.stringValueOfParameterNamed("transactionAmount")); changes.put("locale", command.locale()); @@ -754,8 +754,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Loan loan = this.loanAssembler.assembleFrom(loanId); checkClientOrGroupActive(loan); - final List existingTransactionIds = new ArrayList(); - final List existingReversedTransactionIds = new ArrayList(); + final List existingTransactionIds = new ArrayList<>(); + final List existingReversedTransactionIds = new ArrayList<>(); final Money transactionAmountAsMoney = Money.of(loan.getCurrency(), transactionAmount); final LoanTransaction waiveInterestTransaction = LoanTransaction.waiver(loan.getOffice(), loan, transactionAmountAsMoney, @@ -810,7 +810,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf this.loanEventApiJsonValidator.validateTransactionWithNoAmount(command.json()); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); changes.put("transactionDate", command.stringValueOfParameterNamed("transactionDate")); changes.put("locale", command.locale()); changes.put("dateFormat", command.dateFormat()); @@ -819,8 +819,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf checkClientOrGroupActive(loan); removeLoanCycle(loan); - final List existingTransactionIds = new ArrayList(); - final List existingReversedTransactionIds = new ArrayList(); + final List existingTransactionIds = new ArrayList<>(); + final List existingReversedTransactionIds = new ArrayList<>(); final CalendarInstance calendarInstance = this.calendarInstanceRepository.findCalendarInstaneByLoanId(loan.getId(), CalendarEntityType.LOANS.getValue()); @@ -876,13 +876,13 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Loan loan = this.loanAssembler.assembleFrom(loanId); checkClientOrGroupActive(loan); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); changes.put("transactionDate", command.stringValueOfParameterNamed("transactionDate")); changes.put("locale", command.locale()); changes.put("dateFormat", command.dateFormat()); - final List existingTransactionIds = new ArrayList(); - final List existingReversedTransactionIds = new ArrayList(); + final List existingTransactionIds = new ArrayList<>(); + final List existingReversedTransactionIds = new ArrayList<>(); final CalendarInstance calendarInstance = this.calendarInstanceRepository.findCalendarInstaneByLoanId(loan.getId(), CalendarEntityType.LOANS.getValue()); @@ -959,7 +959,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf checkClientOrGroupActive(loan); removeLoanCycle(loan); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); changes.put("transactionDate", command.stringValueOfParameterNamed("transactionDate")); changes.put("locale", command.locale()); changes.put("dateFormat", command.dateFormat()); @@ -1036,8 +1036,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf } } - final List existingTransactionIds = new ArrayList(); - final List existingReversedTransactionIds = new ArrayList(); + final List existingTransactionIds = new ArrayList<>(); + final List existingReversedTransactionIds = new ArrayList<>(); this.loanChargeRepository.save(loanCharge); final ChangedTransactionDetail changedTransactionDetail = loan.addLoanCharge(loanCharge, existingTransactionIds, @@ -1151,10 +1151,10 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf loanInstallmentNumber = chargePerInstallment.getRepaymentInstallment().getInstallmentNumber(); } - final Map changes = new LinkedHashMap(3); + final Map changes = new LinkedHashMap<>(3); - final List existingTransactionIds = new ArrayList(); - final List existingReversedTransactionIds = new ArrayList(); + final List existingTransactionIds = new ArrayList<>(); + final List existingReversedTransactionIds = new ArrayList<>(); final LoanTransaction waiveTransaction = loan.waiveLoanCharge(loanCharge, defaultLoanLifecycleStateMachine(), changes, existingTransactionIds, existingReversedTransactionIds, loanInstallmentNumber); @@ -1296,7 +1296,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final AccountTransferDTO accountTransferDTO = new AccountTransferDTO(transactionDate, amount.getAmount(), PortfolioAccountType.LOAN, PortfolioAccountType.SAVINGS, loan.getId(), portfolioAccountData.accountId(), "Loan Disbursement", locale, fmt, paymentDetail, LoanTransactionType.DISBURSEMENT.getValue(), null, null, null, - AccountTransferType.ACCOUNT_TRANSFER.getValue(), null, null, txnExternalId, loan, null, fromSavingsAccount, isRegularTransaction); + AccountTransferType.ACCOUNT_TRANSFER.getValue(), null, null, txnExternalId, loan, null, fromSavingsAccount, + isRegularTransaction); this.accountTransfersWritePlatformService.transferFunds(accountTransferDTO); } @@ -1379,8 +1380,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Loan loan = this.loanAssembler.assembleFrom(accountId); checkClientOrGroupActive(loan); - final List existingTransactionIds = new ArrayList(loan.findExistingTransactionIds()); - final List existingReversedTransactionIds = new ArrayList(loan.findExistingReversedTransactionIds()); + final List existingTransactionIds = new ArrayList<>(loan.findExistingTransactionIds()); + final List existingReversedTransactionIds = new ArrayList<>(loan.findExistingReversedTransactionIds()); final LoanTransaction newTransferTransaction = LoanTransaction.initiateTransfer(loan.getOffice(), loan, transferDate); loan.getLoanTransactions().add(newTransferTransaction); @@ -1401,8 +1402,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final Loan loan = this.loanAssembler.assembleFrom(accountId); - final List existingTransactionIds = new ArrayList(loan.findExistingTransactionIds()); - final List existingReversedTransactionIds = new ArrayList(loan.findExistingReversedTransactionIds()); + final List existingTransactionIds = new ArrayList<>(loan.findExistingTransactionIds()); + final List existingReversedTransactionIds = new ArrayList<>(loan.findExistingReversedTransactionIds()); final LoanTransaction newTransferAcceptanceTransaction = LoanTransaction.approveTransfer(acceptedInOffice, loan, transferDate); loan.getLoanTransactions().add(newTransferAcceptanceTransaction); @@ -1424,8 +1425,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf public LoanTransaction withdrawLoanTransfer(final Long accountId, final LocalDate transferDate) { final Loan loan = this.loanAssembler.assembleFrom(accountId); - final List existingTransactionIds = new ArrayList(loan.findExistingTransactionIds()); - final List existingReversedTransactionIds = new ArrayList(loan.findExistingReversedTransactionIds()); + final List existingTransactionIds = new ArrayList<>(loan.findExistingTransactionIds()); + final List existingReversedTransactionIds = new ArrayList<>(loan.findExistingReversedTransactionIds()); final LoanTransaction newTransferAcceptanceTransaction = LoanTransaction.withdrawTransfer(loan.getOffice(), loan, transferDate); loan.getLoanTransactions().add(newTransferAcceptanceTransaction); @@ -1562,11 +1563,10 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final boolean isHolidayEnabled = this.configurationDomainService.isRescheduleRepaymentsOnHolidaysEnabled(); final WorkingDays workingDays = this.workingDaysRepository.findOne(); - final Collection loanStatuses = new ArrayList(Arrays.asList(LoanStatus.SUBMITTED_AND_PENDING_APPROVAL.getValue(), + final Collection loanStatuses = new ArrayList<>(Arrays.asList(LoanStatus.SUBMITTED_AND_PENDING_APPROVAL.getValue(), LoanStatus.APPROVED.getValue(), LoanStatus.ACTIVE.getValue())); - final Collection loanTypes = new ArrayList( - Arrays.asList(AccountType.GROUP.getValue(), AccountType.JLG.getValue())); - final Collection loanIds = new ArrayList(loanCalendarInstances.size()); + final Collection loanTypes = new ArrayList<>(Arrays.asList(AccountType.GROUP.getValue(), AccountType.JLG.getValue())); + final Collection loanIds = new ArrayList<>(loanCalendarInstances.size()); // loop through loanCalendarInstances to get loan ids for (final CalendarInstance calendarInstance : loanCalendarInstances) { loanIds.add(calendarInstance.getEntityId()); @@ -1741,7 +1741,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf if (!isHolidayEnabled) { return; } - final Collection loanStatuses = new ArrayList(Arrays.asList(LoanStatus.SUBMITTED_AND_PENDING_APPROVAL.getValue(), + final Collection loanStatuses = new ArrayList<>(Arrays.asList(LoanStatus.SUBMITTED_AND_PENDING_APPROVAL.getValue(), LoanStatus.APPROVED.getValue(), LoanStatus.ACTIVE.getValue())); // Get all Holidays which are active and not processed final List holidays = this.holidayRepository.findUnprocessed(); @@ -1750,13 +1750,13 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf for (final Holiday holiday : holidays) { // All offices to which holiday is applied final Set offices = holiday.getOffices(); - final Collection officeIds = new ArrayList(offices.size()); + final Collection officeIds = new ArrayList<>(offices.size()); for (final Office office : offices) { officeIds.add(office.getId()); } // get all loans - final List loans = new ArrayList(); + final List loans = new ArrayList<>(); // get all individual and jlg loans loans.addAll(this.loanRepository.findByClientOfficeIdsAndLoanStatus(officeIds, loanStatuses)); // FIXME: AA optimize to get all client and group loans belongs to a @@ -1872,7 +1872,7 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf Integer feeFrequency = chargeDefinition.feeFrequency(); final ScheduledDateGenerator scheduledDateGenerator = new DefaultScheduledDateGenerator(); - Map scheduleDates = new HashMap(); + Map scheduleDates = new HashMap<>(); final Long penaltyWaitPeriodValue = this.configurationDomainService.retrievePenaltyWaitPeriod(); final Long penaltyPostingWaitPeriodValue = this.configurationDomainService.retrieveGraceOnPenaltyPostingPeriod(); final LocalDate dueDate = command.localDateValueOfParameterNamed("dueDate"); @@ -1922,8 +1922,8 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf public CommandProcessingResult undoWriteOff(Long loanId) { final Loan loan = this.loanAssembler.assembleFrom(loanId); checkClientOrGroupActive(loan); - final List existingTransactionIds = new ArrayList(); - final List existingReversedTransactionIds = new ArrayList(); + final List existingTransactionIds = new ArrayList<>(); + final List existingReversedTransactionIds = new ArrayList<>(); if (!loan.isClosedWrittenOff()) { throw new PlatformServiceUnavailableException( "error.msg.loan.status.not.written.off.update.not.allowed", "Loan :" + loanId + " update not allowed as loan status is not written off", loanId); } @@ -1964,9 +1964,9 @@ public class LoanWritePlatformServiceJpaRepositoryImpl implements LoanWritePlatf final MonetaryCurrency currency = loan.getCurrency(); final ApplicationCurrency applicationCurrency = this.applicationCurrencyRepository.findOneWithNotFoundDetection(currency); - final List existingTransactionIds = new ArrayList(); - final List existingReversedTransactionIds = new ArrayList(); - final Map changes = new LinkedHashMap(); + final List existingTransactionIds = new ArrayList<>(); + final List existingReversedTransactionIds = new ArrayList<>(); + final Map changes = new LinkedHashMap<>(); final ChangedTransactionDetail changedTransactionDetail = loan.updateDisbursementDateForTranche(loanDisbursementDetails, command, existingTransactionIds, existingReversedTransactionIds, changes, this.loanScheduleFactory, applicationCurrency, calculatedRepaymentsStartingFromDate, isHolidayEnabled, holidays, workingDays); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/api/LoanProductsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/api/LoanProductsApiResource.java index 1fcf984bb..6a65d6b21 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/api/LoanProductsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/api/LoanProductsApiResource.java @@ -63,7 +63,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class LoanProductsApiResource { - private final Set LOAN_PRODUCT_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "name", "shortName", "description", + private final Set LOAN_PRODUCT_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "name", "shortName", "description", "fundId", "fundName", "includeInBorrowerCycle", "currency", "principal", "minPrincipal", "maxPrincipal", "numberOfRepayments", "minNumberOfRepayments", "maxNumberOfRepayments", "repaymentEvery", "repaymentFrequencyType", "graceOnPrincipalPayment", "graceOnInterestPayment", "graceOnInterestCharged", "interestRatePerPeriod", "minInterestRatePerPeriod", @@ -75,7 +75,7 @@ public class LoanProductsApiResource { "transactionProcessingStrategyOptions", "chargeOptions", "accountingOptions", "accountingRuleOptions", "accountingMappingOptions")); - private final Set PRODUCT_MIX_DATA_PARAMETERS = new HashSet(Arrays.asList("productId", "productName", + private final Set PRODUCT_MIX_DATA_PARAMETERS = new HashSet<>(Arrays.asList("productId", "productName", "restrictedProducts", "allowedProducts", "productOptions")); private final String resourceNameForPermissions = "LOANPRODUCT"; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductData.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductData.java index 829f3883e..859ab526d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/data/LoanProductData.java @@ -147,12 +147,9 @@ public class LoanProductData { final Integer graceOnArrearsAgeing = null; final Integer overdueDaysForNPA = null; final Collection charges = null; - final Collection principalVariations = new ArrayList( - 1); - final Collection interestRateVariations = new ArrayList( - 1); - final Collection numberOfRepaymentVariations = new ArrayList( - 1); + final Collection principalVariations = new ArrayList<>(1); + final Collection interestRateVariations = new ArrayList<>(1); + final Collection numberOfRepaymentVariations = new ArrayList<>(1); final EnumOptionData accountingType = null; final boolean includeInBorrowerCycle = false; final boolean useBorrowerCycle = false; @@ -212,12 +209,9 @@ public class LoanProductData { final String status = null; final String externalId = null; - final Collection principalVariations = new ArrayList( - 1); - final Collection interestRateVariations = new ArrayList( - 1); - final Collection numberOfRepaymentVariations = new ArrayList( - 1); + final Collection principalVariations = new ArrayList<>(1); + final Collection interestRateVariations = new ArrayList<>(1); + final Collection numberOfRepaymentVariations = new ArrayList<>(1); final Boolean multiDisburseLoan = null; final Integer maxTrancheCount = null; final BigDecimal outstandingLoanBalance = null; @@ -269,12 +263,9 @@ public class LoanProductData { final Integer overdueDaysForNPA = null; final Collection charges = null; - final Collection principalVariationsForBorrowerCycle = new ArrayList( - 1); - final Collection interestRateVariationsForBorrowerCycle = new ArrayList( - 1); - final Collection numberOfRepaymentVariationsForBorrowerCycle = new ArrayList( - 1); + final Collection principalVariationsForBorrowerCycle = new ArrayList<>(1); + final Collection interestRateVariationsForBorrowerCycle = new ArrayList<>(1); + final Collection numberOfRepaymentVariationsForBorrowerCycle = new ArrayList<>(1); final EnumOptionData accountingType = AccountingEnumerations.accountingRuleType(AccountingRuleType.NONE); final boolean includeInBorrowerCycle = false; @@ -445,8 +436,7 @@ public class LoanProductData { this.fundOptions = fundOptions; this.transactionProcessingStrategyOptions = transactionStrategyOptions; if (this.transactionProcessingStrategyOptions != null && this.transactionProcessingStrategyOptions.size() == 1) { - final List listOfOptions = new ArrayList( - this.transactionProcessingStrategyOptions); + final List listOfOptions = new ArrayList<>(this.transactionProcessingStrategyOptions); this.transactionProcessingStrategyId = listOfOptions.get(0).id(); this.transactionProcessingStrategyName = listOfOptions.get(0).name(); @@ -487,7 +477,7 @@ public class LoanProductData { } public Collection charges() { - Collection chargesLocal = new ArrayList(); + Collection chargesLocal = new ArrayList<>(); if (this.charges != null) { chargesLocal = this.charges; } @@ -666,7 +656,7 @@ public class LoanProductData { } public Collection overdueFeeCharges() { - Collection overdueFeeCharges = new ArrayList(); + Collection overdueFeeCharges = new ArrayList<>(); Collection charges = charges(); for (ChargeData chargeData : charges) { if (chargeData.isOverdueInstallmentCharge()) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LendingStrategy.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LendingStrategy.java index 3121ddf62..3fe9f013b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LendingStrategy.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LendingStrategy.java @@ -35,7 +35,7 @@ public enum LendingStrategy { this.value = value; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); private static int minValue; private static int maxValue; static { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProduct.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProduct.java index da35cbde5..ccfe46446 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProduct.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProduct.java @@ -114,7 +114,7 @@ public class LoanProduct extends AbstractPersistable { @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "loanProduct", orphanRemoval = true) - private Set borrowerCycleVariations = new HashSet(); + private Set borrowerCycleVariations = new HashSet<>(); @Column(name = "overdue_days_for_npa", nullable = true) private Integer overdueDaysForNPA; @@ -166,7 +166,7 @@ public class LoanProduct extends AbstractPersistable { final String externalId = command.stringValueOfParameterNamedAllowingNull("externalId"); final boolean useBorrowerCycle = command.booleanPrimitiveValueOfParameterNamed(LoanProductConstants.useBorrowerCycleParameterName); - final Set loanProductBorrowerCycleVariations = new HashSet(); + final Set loanProductBorrowerCycleVariations = new HashSet<>(); if (useBorrowerCycle) { populateBorrowerCyclevariations(command, loanProductBorrowerCycleVariations); @@ -285,7 +285,7 @@ public class LoanProduct extends AbstractPersistable { } private Map updateBorrowerCycleVariations(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(20); + final Map actualChanges = new LinkedHashMap<>(20); List variationIds = fetchAllVariationIds(); updateBorrowerCycleVaritions(command, LoanProductParamType.PRINCIPAL.getValue(), LoanProductConstants.principalVariationsForBorrowerCycleParameterName, actualChanges, variationIds); @@ -300,7 +300,7 @@ public class LoanProduct extends AbstractPersistable { } private List fetchAllVariationIds() { - List list = new ArrayList(); + List list = new ArrayList<>(); for (LoanProductBorrowerCycleVariations cycleVariation : this.borrowerCycleVariations) { list.add(cycleVariation.getId()); } @@ -372,7 +372,7 @@ public class LoanProduct extends AbstractPersistable { if (clearAll) { this.borrowerCycleVariations.clear(); } else { - Set remove = new HashSet(); + Set remove = new HashSet<>(); for (LoanProductBorrowerCycleVariations borrowerCycleVariations : this.borrowerCycleVariations) { if (paramType.equals(borrowerCycleVariations.getParamType())) { remove.add(borrowerCycleVariations); @@ -472,8 +472,8 @@ public class LoanProduct extends AbstractPersistable { boolean updated = false; if (this.charges != null) { - final Set currentSetOfCharges = new HashSet(this.charges); - final Set newSetOfCharges = new HashSet(newProductCharges); + final Set currentSetOfCharges = new HashSet<>(this.charges); + final Set newSetOfCharges = new HashSet<>(newProductCharges); if (!currentSetOfCharges.equals(newSetOfCharges)) { updated = true; @@ -748,7 +748,7 @@ public class LoanProduct extends AbstractPersistable { } public Map fetchBorrowerCycleVariationsForCycleNumber(final Integer cycleNumber) { - Map borrowerCycleVariations = new HashMap(); + Map borrowerCycleVariations = new HashMap<>(); borrowerCycleVariations.put(LoanProductConstants.principal, this.loanProductRelatedDetail.getPrincipal().getAmount()); borrowerCycleVariations.put(LoanProductConstants.interestRatePerPeriod, this.loanProductRelatedDetail.getNominalInterestRatePerPeriod()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProductMinMaxConstraints.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProductMinMaxConstraints.java index 81dd77bdf..fe089dee6 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProductMinMaxConstraints.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProductMinMaxConstraints.java @@ -64,7 +64,7 @@ public class LoanProductMinMaxConstraints { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(20); + final Map actualChanges = new LinkedHashMap<>(20); final String localeAsInput = command.locale(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProductRelatedDetail.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProductRelatedDetail.java index 4d0ac2d75..ad21feb91 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProductRelatedDetail.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/domain/LoanProductRelatedDetail.java @@ -222,7 +222,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche public Map update(final JsonCommand command, final AprCalculator aprCalculator) { - final Map actualChanges = new LinkedHashMap(20); + final Map actualChanges = new LinkedHashMap<>(20); final String localeAsInput = command.locale(); @@ -263,7 +263,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche } public Map updateLoanApplicationAttributes(final JsonCommand command, final AprCalculator aprCalculator) { - final Map actualChanges = new LinkedHashMap(20); + final Map actualChanges = new LinkedHashMap<>(20); final String localeAsInput = command.locale(); @@ -387,7 +387,7 @@ public class LoanProductRelatedDetail implements LoanProductMinimumRepaymentSche } public void validateRepaymentPeriodWithGraceSettings() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanproduct"); if (this.numberOfRepayments <= defaultToZeroIfNull(this.graceOnPrincipalPayment)) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/api/ProductMixApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/api/ProductMixApiResource.java index 6edbff9dc..41f939fb7 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/api/ProductMixApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/api/ProductMixApiResource.java @@ -45,7 +45,7 @@ public class ProductMixApiResource { private final String resourceNameForPermissions = "PRODUCTMIX"; - private final Set PRODUCT_MIX_DATA_PARAMETERS = new HashSet(Arrays.asList("productId", "productName", + private final Set PRODUCT_MIX_DATA_PARAMETERS = new HashSet<>(Arrays.asList("productId", "productName", "restrictedProducts", "allowedProducts", "productOptions")); private final PlatformSecurityContext context; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/serialization/ProductMixDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/serialization/ProductMixDataValidator.java index 300524848..7ac5dc60b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/serialization/ProductMixDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/serialization/ProductMixDataValidator.java @@ -26,7 +26,7 @@ public final class ProductMixDataValidator { /** * The parameters supported for this command. */ - private final Set supportedParameters = new HashSet(Arrays.asList("restrictedProducts")); + private final Set supportedParameters = new HashSet<>(Arrays.asList("restrictedProducts")); private final FromJsonHelper fromApiJsonHelper; @@ -41,7 +41,7 @@ public final class ProductMixDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("productmix"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -73,7 +73,7 @@ public final class ProductMixDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("productmix"); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/service/ProductMixReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/service/ProductMixReadPlatformServiceImpl.java index f03c561ad..787d73755 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/service/ProductMixReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/service/ProductMixReadPlatformServiceImpl.java @@ -83,7 +83,7 @@ public class ProductMixReadPlatformServiceImpl implements ProductMixReadPlatform @Override public Map extractData(final ResultSet rs) throws SQLException, DataAccessException { - final Map extractedData = new HashMap(); + final Map extractedData = new HashMap<>(); if (!rs.next()) { final Collection restrictedProducts = this.loanProductReadPlatformService diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/service/ProductMixWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/service/ProductMixWritePlatformServiceJpaRepositoryImpl.java index 1cb9c7240..c21b20f0c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/service/ProductMixWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/productmix/service/ProductMixWritePlatformServiceJpaRepositoryImpl.java @@ -58,19 +58,19 @@ public class ProductMixWritePlatformServiceJpaRepositoryImpl implements ProductM this.fromApiJsonDeserializer.validateForCreate(command.json()); - final Set restrictedIds = new HashSet(Arrays.asList(command.arrayValueOfParameterNamed("restrictedProducts"))); + final Set restrictedIds = new HashSet<>(Arrays.asList(command.arrayValueOfParameterNamed("restrictedProducts"))); // remove the existed restriction if it is not exists in // restrictedIds. final List removedRestrictions = updateRestrictionsForProduct(productId, restrictedIds); final Map restrictedProductsAsMap = getRestrictedProducts(restrictedIds); - final List productMixes = new ArrayList(); + final List productMixes = new ArrayList<>(); createNewProductMix(restrictedProductsAsMap, productId, productMixes); this.productMixRepository.save(productMixes); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); changes.put("restrictedProductsForMix", restrictedProductsAsMap.keySet()); changes.put("removedProductsForMix", removedRestrictions); return new CommandProcessingResultBuilder().withProductId(productId).with(changes).withCommandId(command.commandId()).build(); @@ -83,8 +83,8 @@ public class ProductMixWritePlatformServiceJpaRepositoryImpl implements ProductM private List updateRestrictionsForProduct(final Long productId, final Set restrictedIds) { - final List removedRestrictions = new ArrayList(); - final List mixesToRemove = new ArrayList(); + final List removedRestrictions = new ArrayList<>(); + final List mixesToRemove = new ArrayList<>(); final List existedProductMixes = this.productMixRepository.findRestrictedProducts(productId); for (final ProductMix productMix : existedProductMixes) { @@ -115,11 +115,11 @@ public class ProductMixWritePlatformServiceJpaRepositoryImpl implements ProductM try { this.context.authenticatedUser(); this.fromApiJsonDeserializer.validateForUpdate(command.json()); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); final List existedProductMixes = this.productMixRepository.findByProductId(productId); if (CollectionUtils.isEmpty(existedProductMixes)) { throw new ProductMixNotFoundException(productId); } - final Set restrictedIds = new HashSet(Arrays.asList(command.arrayValueOfParameterNamed("restrictedProducts"))); + final Set restrictedIds = new HashSet<>(Arrays.asList(command.arrayValueOfParameterNamed("restrictedProducts"))); // updating with empty array means deleting the existed records. if (restrictedIds.isEmpty()) { @@ -162,7 +162,7 @@ public class ProductMixWritePlatformServiceJpaRepositoryImpl implements ProductM private Map getRestrictedProducts(final Set restrictedIds) { - final Map restricrtedProducts = new HashMap(); + final Map restricrtedProducts = new HashMap<>(); for (final String restrictedId : restrictedIds) { final Long restrictedIdAsLong = Long.valueOf(restrictedId); @@ -184,7 +184,7 @@ public class ProductMixWritePlatformServiceJpaRepositoryImpl implements ProductM private List updateRestrictedIds(final Set restrictedIds, final List existedProductMixes) { - final List productMixesToRemove = new ArrayList(); + final List productMixesToRemove = new ArrayList<>(); for (final ProductMix productMix : existedProductMixes) { final String currentMixId = productMix.getRestrictedProductId().toString(); if (restrictedIds.contains(currentMixId)) { @@ -201,7 +201,7 @@ public class ProductMixWritePlatformServiceJpaRepositoryImpl implements ProductM public CommandProcessingResult deleteProductMix(final Long productId) { try { this.context.authenticatedUser(); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); final List existedProductMixes = this.productMixRepository.findByProductId(productId); if (CollectionUtils.isEmpty(existedProductMixes)) { throw new ProductMixNotFoundException(productId); } @@ -216,7 +216,7 @@ public class ProductMixWritePlatformServiceJpaRepositoryImpl implements ProductM } private List getProductIdsFromCollection(final List collection) { - final List productIds = new ArrayList(); + final List productIds = new ArrayList<>(); for (final ProductMix productMix : collection) { productIds.add(productMix.getRestrictedProductId()); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/serialization/LoanProductDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/serialization/LoanProductDataValidator.java index 01e667c48..c5ddddb84 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/serialization/LoanProductDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/serialization/LoanProductDataValidator.java @@ -41,7 +41,7 @@ public final class LoanProductDataValidator { /** * The parameters supported for this command. */ - private final Set supportedParameters = new HashSet(Arrays.asList("locale", "dateFormat", "name", "description", + private final Set supportedParameters = new HashSet<>(Arrays.asList("locale", "dateFormat", "name", "description", "fundId", "currencyCode", "digitsAfterDecimal", "inMultiplesOf", "principal", "minPrincipal", "maxPrincipal", "repaymentEvery", "numberOfRepayments", "minNumberOfRepayments", "maxNumberOfRepayments", "repaymentFrequencyType", "interestRatePerPeriod", "minInterestRatePerPeriod", "maxInterestRatePerPeriod", "interestRateFrequencyType", "amortizationType", "interestType", @@ -76,7 +76,7 @@ public final class LoanProductDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanproduct"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -385,7 +385,7 @@ public final class LoanProductDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("loanproduct"); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanDropdownReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanDropdownReadPlatformServiceImpl.java index 4453285e7..eed02f9c1 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanDropdownReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanDropdownReadPlatformServiceImpl.java @@ -9,9 +9,9 @@ import static org.mifosplatform.portfolio.loanproduct.service.LoanEnumerations.a import static org.mifosplatform.portfolio.loanproduct.service.LoanEnumerations.interestCalculationPeriodType; import static org.mifosplatform.portfolio.loanproduct.service.LoanEnumerations.interestRateFrequencyType; import static org.mifosplatform.portfolio.loanproduct.service.LoanEnumerations.interestType; +import static org.mifosplatform.portfolio.loanproduct.service.LoanEnumerations.loanCycleValueConditionType; import static org.mifosplatform.portfolio.loanproduct.service.LoanEnumerations.loanTermFrequencyType; import static org.mifosplatform.portfolio.loanproduct.service.LoanEnumerations.repaymentFrequencyType; -import static org.mifosplatform.portfolio.loanproduct.service.LoanEnumerations.loanCycleValueConditionType; import java.util.ArrayList; import java.util.Arrays; @@ -93,7 +93,7 @@ public class LoanDropdownReadPlatformServiceImpl implements LoanDropdownReadPlat @Override public Collection retreiveTransactionProcessingStrategies() { - final Collection strategyOptions = new ArrayList(); + final Collection strategyOptions = new ArrayList<>(); final List strategies = this.loanTransactionProcessingStrategyRepository.findAll(); for (final LoanTransactionProcessingStrategy strategy : strategies) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java index cd29ed3e4..2add0d0f0 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductReadPlatformServiceImpl.java @@ -201,9 +201,9 @@ public class LoanProductReadPlatformServiceImpl implements LoanProductReadPlatfo status = "loanProduct.active"; } final String externalId = rs.getString("externalId"); - final Collection principalVariationsForBorrowerCycle = new ArrayList(); - final Collection interestRateVariationsForBorrowerCycle = new ArrayList(); - final Collection numberOfRepaymentVariationsForBorrowerCycle = new ArrayList(); + final Collection principalVariationsForBorrowerCycle = new ArrayList<>(); + final Collection interestRateVariationsForBorrowerCycle = new ArrayList<>(); + final Collection numberOfRepaymentVariationsForBorrowerCycle = new ArrayList<>(); if (this.borrowerCycleVariationDatas != null) { for (final LoanProductBorrowerCycleVariationData borrowerCycleVariationData : this.borrowerCycleVariationDatas) { final LoanProductParamType loanProductParamType = borrowerCycleVariationData.getParamType(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java index 72306489c..7adfaaa6a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/loanproduct/service/LoanProductWritePlatformServiceJpaRepositoryImpl.java @@ -188,7 +188,7 @@ public class LoanProductWritePlatformServiceJpaRepositoryImpl implements LoanPro private List assembleListOfProductCharges(final JsonCommand command, final String currencyCode) { - final List charges = new ArrayList(); + final List charges = new ArrayList<>(); String loanProductCurrencyCode = command.stringValueOfParameterNamed("currencyCode"); if (loanProductCurrencyCode == null) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/MeetingApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/MeetingApiConstants.java index 8e5850057..297f55e82 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/MeetingApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/MeetingApiConstants.java @@ -35,10 +35,10 @@ public class MeetingApiConstants { public static final String calendarData = "calendarData"; public static final String attendanceTypeOptions = "attendanceTypeOptions"; - public static final Set MEETING_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(meetingDateParamName, + public static final Set MEETING_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(meetingDateParamName, localeParamName, dateFormatParamName, calendarIdParamName, clientsAttendanceParamName)); - public static final Set MEETING_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName, meetingDateParamName, + public static final Set MEETING_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, meetingDateParamName, clientsAttendance, clients, calendarData, attendanceTypeOptions)); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/attendance/service/AttendanceEnumerations.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/attendance/service/AttendanceEnumerations.java index 2aff82593..e317a24a0 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/attendance/service/AttendanceEnumerations.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/attendance/service/AttendanceEnumerations.java @@ -47,7 +47,7 @@ public class AttendanceEnumerations { } public static List attendanceType(final AttendanceType[] attendanceTypes) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final AttendanceType attendanceType : attendanceTypes) { if (attendanceType.getValue().equals(AttendanceType.INVALID.getValue())) { continue; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/data/MeetingDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/data/MeetingDataValidator.java index a5f6a2947..316ba70e4 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/data/MeetingDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/data/MeetingDataValidator.java @@ -51,7 +51,7 @@ public class MeetingDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, MEETING_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(MEETING_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -78,7 +78,7 @@ public class MeetingDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, MEETING_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(MEETING_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -109,7 +109,7 @@ public class MeetingDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, MEETING_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(MEETING_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/domain/Meeting.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/domain/Meeting.java index 9c2aa2afd..5fd212494 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/domain/Meeting.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/domain/Meeting.java @@ -78,11 +78,11 @@ public class Meeting extends AbstractPersistable { final String errorMessage = "Attendance cannot be in the future."; throw new MeetingDateException("cannot.be.a.future.date", errorMessage, getMeetingDateLocalDate()); } - this.clientsAttendance = new HashSet(clientsAttendance); + this.clientsAttendance = new HashSet<>(clientsAttendance); } public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(9); + final Map actualChanges = new LinkedHashMap<>(9); final String dateFormatAsInput = command.dateFormat(); final String localeAsInput = command.locale(); @@ -103,19 +103,19 @@ public class Meeting extends AbstractPersistable { } public Map updateAttendance(final Collection clientsAttendance) { - final Map actualChanges = new LinkedHashMap(1); - final Map clientAttendanceChanges = new LinkedHashMap(clientsAttendance.size()); + final Map actualChanges = new LinkedHashMap<>(1); + final Map clientAttendanceChanges = new LinkedHashMap<>(clientsAttendance.size()); updateAttendanceLoop: for (final ClientAttendance clientAttendance : clientsAttendance) { if (this.clientsAttendance == null) { - this.clientsAttendance = new HashSet(); + this.clientsAttendance = new HashSet<>(); } for (final ClientAttendance clientAttendanceOriginal : this.clientsAttendance) { if (clientAttendanceOriginal.clientId().equals(clientAttendance.clientId())) { final Integer newValue = clientAttendance.getAttendanceTypeId(); if (!newValue.equals(clientAttendanceOriginal.getAttendanceTypeId())) { clientAttendanceOriginal.updateAttendanceTypeId(newValue); - final Map clientAttendanceChange = new LinkedHashMap(2); + final Map clientAttendanceChange = new LinkedHashMap<>(2); clientAttendanceChange.put(clientIdParamName, clientAttendanceOriginal.clientId()); clientAttendanceChange.put(attendanceTypeParamName, newValue); clientAttendanceChanges.put(clientAttendanceOriginal.clientId().toString(), clientAttendanceChange); @@ -124,7 +124,7 @@ public class Meeting extends AbstractPersistable { } } - final Map clientAttendanceChange = new LinkedHashMap(); + final Map clientAttendanceChange = new LinkedHashMap<>(); clientAttendanceChange.put(clientIdParamName, clientAttendance.clientId()); clientAttendanceChange.put(attendanceTypeParamName, clientAttendance.getAttendanceTypeId()); clientAttendanceChanges.put(clientAttendance.clientId().toString(), clientAttendanceChange); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/service/MeetingWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/service/MeetingWritePlatformServiceJpaRepositoryImpl.java index 6106545fc..c3243da4d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/service/MeetingWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/meeting/service/MeetingWritePlatformServiceJpaRepositoryImpl.java @@ -147,7 +147,7 @@ public class MeetingWritePlatformServiceJpaRepositoryImpl implements MeetingWrit } private Collection getClientsAttendance(final Meeting meeting, final JsonCommand command) { - final Collection clientsAttendance = new ArrayList(); + final Collection clientsAttendance = new ArrayList<>(); Collection childGroups = null; if (meeting.isCenterEntity()) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/api/NotesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/api/NotesApiResource.java index 4c4c7230a..ca5c1701f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/api/NotesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/api/NotesApiResource.java @@ -43,7 +43,7 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class NotesApiResource { - private final Set NOTE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "clientId", "groupId", "loanId", + private final Set NOTE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "clientId", "groupId", "loanId", "loanTransactionId", "depositAccountId", "savingAccountId", "noteType", "note", "createdById", "createdByUsername", "createdOn", "updatedById", "updatedByUsername", "updatedOn")); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/Note.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/Note.java index cbdce2685..8beaa9a20 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/Note.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/Note.java @@ -121,7 +121,7 @@ public class Note extends AbstractAuditableCustom { } public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(7); + final Map actualChanges = new LinkedHashMap<>(7); final String noteParamName = "note"; if (command.isChangeInStringParameterNamed(noteParamName, this.note)) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/NoteType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/NoteType.java index f3ad9cc10..fcbe282b4 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/NoteType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/domain/NoteType.java @@ -38,7 +38,7 @@ public enum NoteType { return this.apiUrl; } - private static final Map intToEnumMap = new HashMap(); + private static final Map intToEnumMap = new HashMap<>(); private static int minValue; private static int maxValue; static { @@ -76,7 +76,7 @@ public enum NoteType { return name().toString(); } - private static final Map apiUrlToEnumMap = new HashMap(); + private static final Map apiUrlToEnumMap = new HashMap<>(); static { for (final NoteType type : NoteType.values()) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/serialization/NoteCommandFromApiJsonDeserializer.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/serialization/NoteCommandFromApiJsonDeserializer.java index 8dffbce48..0c1dd4d6e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/serialization/NoteCommandFromApiJsonDeserializer.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/note/serialization/NoteCommandFromApiJsonDeserializer.java @@ -37,7 +37,7 @@ public final class NoteCommandFromApiJsonDeserializer extends AbstractFromApiJso /** * The parameters supported for this command. */ - private final Set supportedParameters = new HashSet(Arrays.asList("note")); + private final Set supportedParameters = new HashSet<>(Arrays.asList("note")); private final FromJsonHelper fromApiJsonHelper; @@ -67,7 +67,7 @@ public final class NoteCommandFromApiJsonDeserializer extends AbstractFromApiJso this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, this.supportedParameters); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("note"); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/paymentdetail/PaymentDetailConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/paymentdetail/PaymentDetailConstants.java index ea4708069..b55cb7547 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/paymentdetail/PaymentDetailConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/paymentdetail/PaymentDetailConstants.java @@ -25,7 +25,7 @@ public class PaymentDetailConstants { // template related part of response public static final String officeOptionsParamName = "paymentTypeOptions"; - public static final Set PAYMENT_CREATE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(accountNumberParamName, + public static final Set PAYMENT_CREATE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(accountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName)); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/DepositAccountOnClosureType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/DepositAccountOnClosureType.java index 14ee6f92c..0108a56b4 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/DepositAccountOnClosureType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/DepositAccountOnClosureType.java @@ -74,7 +74,7 @@ public enum DepositAccountOnClosureType { } public static Object[] integerValues() { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final DepositAccountOnClosureType enumType : values()) { if (!enumType.isInvalid()) { values.add(enumType.getValue()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/DepositsApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/DepositsApiConstants.java index b2b3d4b82..ec7ce330a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/DepositsApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/DepositsApiConstants.java @@ -183,13 +183,13 @@ public class DepositsApiConstants { public static final String chartTemplate = "chartTemplate"; // allowed column names for sorting the query result - public final static Set supportedOrderByValues = new HashSet(Arrays.asList("id", "accountNumbr", "officeId", + public final static Set supportedOrderByValues = new HashSet<>(Arrays.asList("id", "accountNumbr", "officeId", "officeName")); /** * Deposit Product Parameters */ - private static final Set DEPOSIT_PRODUCT_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + private static final Set DEPOSIT_PRODUCT_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, monthDayFormatParamName, nameParamName, shortNameParamName, descriptionParamName, currencyCodeParamName, digitsAfterDecimalParamName, inMultiplesOfParamName, nominalAnnualInterestRateParamName, interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName, interestCalculationTypeParamName, @@ -203,31 +203,31 @@ public class DepositsApiConstants { SAVINGS_PRODUCT_ACCOUNTING_PARAMS.FEE_INCOME_ACCOUNT_MAPPING.getValue(), SAVINGS_PRODUCT_ACCOUNTING_PARAMS.PENALTY_INCOME_ACCOUNT_MAPPING.getValue(), chartsParamName)); - private static final Set PRECLOSURE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList( + private static final Set PRECLOSURE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList( preClosurePenalApplicableParamName, preClosurePenalInterestParamName, preClosurePenalInterestOnTypeIdParamName)); - private static final Set PRECLOSURE_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList( + private static final Set PRECLOSURE_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList( preClosurePenalApplicableParamName, preClosurePenalInterestParamName, preClosurePenalInterestOnType)); - private static final Set DEPOSIT_TERM_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(minDepositTermParamName, + private static final Set DEPOSIT_TERM_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(minDepositTermParamName, maxDepositTermParamName, minDepositTermTypeIdParamName, maxDepositTermTypeIdParamName, inMultiplesOfDepositTermParamName, inMultiplesOfDepositTermTypeIdParamName, depositAmountParamName, depositMinAmountParamName, depositMaxAmountParamName)); - private static final Set DEPOSIT_TERM_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(minDepositTermParamName, + private static final Set DEPOSIT_TERM_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(minDepositTermParamName, maxDepositTermParamName, minDepositTermType, maxDepositTermType, inMultiplesOfDepositTermParamName, inMultiplesOfDepositTermType, depositAmountParamName, depositMinAmountParamName, depositMaxAmountParamName)); - private static final Set RECURRING_DETAILS_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList( + private static final Set RECURRING_DETAILS_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList( mandatoryRecommendedDepositAmountParamName, isMandatoryDepositParamName, allowWithdrawalParamName, adjustAdvanceTowardsFuturePaymentsParamName, recurringFrequencyTypeParamName, recurringFrequencyParamName, isCalendarInheritedParamName)); - private static final Set RECURRING_DETAILS_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList( + private static final Set RECURRING_DETAILS_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList( mandatoryRecommendedDepositAmountParamName, isMandatoryDepositParamName, allowWithdrawalParamName, adjustAdvanceTowardsFuturePaymentsParamName, recurringFrequencyTypeParamName, recurringFrequencyParamName, isCalendarInheritedParamName)); - public static final Set DEPOSIT_PRECLOSURE_CALCULATION_REQUEST_DATA_PARAMETERS = new HashSet( + public static final Set DEPOSIT_PRECLOSURE_CALCULATION_REQUEST_DATA_PARAMETERS = new HashSet<>( Arrays.asList(preMatureCloseOnDateParamName)); public static final Set FIXED_DEPOSIT_PRODUCT_REQUEST_DATA_PARAMETERS = fixedDepositProductRequestData(); @@ -237,7 +237,7 @@ public class DepositsApiConstants { public static final Set RECURRING_DEPOSIT_PRODUCT_RESPONSE_DATA_PARAMETERS = recurringDepositProductResponseData(); private static Set fixedDepositProductRequestData() { - final Set fixedDepositRequestData = new HashSet(); + final Set fixedDepositRequestData = new HashSet<>(); fixedDepositRequestData.addAll(DEPOSIT_PRODUCT_REQUEST_DATA_PARAMETERS); fixedDepositRequestData.addAll(PRECLOSURE_REQUEST_DATA_PARAMETERS); fixedDepositRequestData.addAll(DEPOSIT_TERM_REQUEST_DATA_PARAMETERS); @@ -245,7 +245,7 @@ public class DepositsApiConstants { } private static Set fixedDepositProductResponseData() { - final Set fixedDepositRequestData = new HashSet(); + final Set fixedDepositRequestData = new HashSet<>(); fixedDepositRequestData.addAll(DEPOSIT_PRODUCT_REQUEST_DATA_PARAMETERS); fixedDepositRequestData.addAll(PRECLOSURE_RESPONSE_DATA_PARAMETERS); fixedDepositRequestData.addAll(DEPOSIT_TERM_RESPONSE_DATA_PARAMETERS); @@ -253,7 +253,7 @@ public class DepositsApiConstants { } private static Set recurringDepositProductRequestData() { - final Set recurringDepositRequestData = new HashSet(); + final Set recurringDepositRequestData = new HashSet<>(); recurringDepositRequestData.addAll(DEPOSIT_PRODUCT_REQUEST_DATA_PARAMETERS); recurringDepositRequestData.addAll(PRECLOSURE_REQUEST_DATA_PARAMETERS); recurringDepositRequestData.addAll(DEPOSIT_TERM_REQUEST_DATA_PARAMETERS); @@ -262,7 +262,7 @@ public class DepositsApiConstants { } private static Set recurringDepositProductResponseData() { - final Set recurringDepositRequestData = new HashSet(); + final Set recurringDepositRequestData = new HashSet<>(); recurringDepositRequestData.addAll(DEPOSIT_PRODUCT_REQUEST_DATA_PARAMETERS); recurringDepositRequestData.addAll(PRECLOSURE_RESPONSE_DATA_PARAMETERS); recurringDepositRequestData.addAll(DEPOSIT_TERM_RESPONSE_DATA_PARAMETERS); @@ -274,7 +274,7 @@ public class DepositsApiConstants { * Depost Account parameters */ - public static final Set DEPOSIT_ACCOUNT_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set DEPOSIT_ACCOUNT_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, monthDayFormatParamName, accountNoParamName, externalIdParamName, clientIdParamName, groupIdParamName, productIdParamName, fieldOfficerIdParamName, submittedOnDateParamName, nominalAnnualInterestRateParamName, interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName, interestCalculationTypeParamName, @@ -289,7 +289,7 @@ public class DepositsApiConstants { public static final Set RECURRING_DEPOSIT_ACCOUNT_RESPONSE_DATA_PARAMETERS = recurringDepositAccountResponseData(); private static Set fixedDepositAccountRequestData() { - final Set fixedDepositRequestData = new HashSet(); + final Set fixedDepositRequestData = new HashSet<>(); fixedDepositRequestData.addAll(DEPOSIT_ACCOUNT_REQUEST_DATA_PARAMETERS); fixedDepositRequestData.addAll(PRECLOSURE_REQUEST_DATA_PARAMETERS); fixedDepositRequestData.addAll(DEPOSIT_TERM_REQUEST_DATA_PARAMETERS); @@ -299,7 +299,7 @@ public class DepositsApiConstants { } private static Set fixedDepositAccountResponseData() { - final Set fixedDepositResponseData = new HashSet(); + final Set fixedDepositResponseData = new HashSet<>(); fixedDepositResponseData.addAll(DEPOSIT_ACCOUNT_REQUEST_DATA_PARAMETERS); fixedDepositResponseData.addAll(PRECLOSURE_RESPONSE_DATA_PARAMETERS); fixedDepositResponseData.addAll(DEPOSIT_TERM_RESPONSE_DATA_PARAMETERS); @@ -309,7 +309,7 @@ public class DepositsApiConstants { } private static Set recurringDepositAccountRequestData() { - final Set recurringDepositRequestData = new HashSet(); + final Set recurringDepositRequestData = new HashSet<>(); recurringDepositRequestData.addAll(DEPOSIT_ACCOUNT_REQUEST_DATA_PARAMETERS); recurringDepositRequestData.addAll(PRECLOSURE_REQUEST_DATA_PARAMETERS); recurringDepositRequestData.addAll(DEPOSIT_TERM_REQUEST_DATA_PARAMETERS); @@ -318,7 +318,7 @@ public class DepositsApiConstants { } private static Set recurringDepositAccountResponseData() { - final Set recurringDepositResponseData = new HashSet(); + final Set recurringDepositResponseData = new HashSet<>(); recurringDepositResponseData.addAll(DEPOSIT_ACCOUNT_REQUEST_DATA_PARAMETERS); recurringDepositResponseData.addAll(PRECLOSURE_RESPONSE_DATA_PARAMETERS); recurringDepositResponseData.addAll(DEPOSIT_TERM_RESPONSE_DATA_PARAMETERS); @@ -326,39 +326,39 @@ public class DepositsApiConstants { return recurringDepositResponseData; } - public static final Set DEPOSIT_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList( + public static final Set DEPOSIT_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList( localeParamName, dateFormatParamName, transactionDateParamName, transactionAmountParamName, paymentTypeIdParamName, transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName)); - public static final Set FIXED_DEPOSIT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName, + public static final Set FIXED_DEPOSIT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, "accountId", accountNoParamName, "currency", "amount", dateParamName, paymentDetailDataParamName, runningBalanceParamName, reversedParamName)); - public static final Set RECURRING_DEPOSIT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName, + public static final Set RECURRING_DEPOSIT_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, "accountId", accountNoParamName, "currency", "amount", dateParamName, paymentDetailDataParamName, runningBalanceParamName, reversedParamName)); - public static final Set SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, activatedOnDateParamName)); - public static final Set DEPOSIT_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set DEPOSIT_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, closedOnDateParamName, noteParamName, onAccountClosureIdParamName, paymentTypeIdParamName, transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName, transferDescriptionParamName, toSavingsAccountIdParamName)); - public static final Set DEPOSIT_ACCOUNT_PRE_MATURE_CALCULATION_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList( + public static final Set DEPOSIT_ACCOUNT_PRE_MATURE_CALCULATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList( localeParamName, dateFormatParamName, closedOnDateParamName)); - public static final Set SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(chargeIdParamName, + public static final Set SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(chargeIdParamName, savingsAccountChargeIdParamName, chargeNameParamName, penaltyParamName, chargeTimeTypeParamName, dueAsOfDateParamName, chargeCalculationTypeParamName, percentageParamName, amountPercentageAppliedToParamName, currencyParamName, amountWaivedParamName, amountWrittenOffParamName, amountOutstandingParamName, amountOrPercentageParamName, amountParamName, amountPaidParamName, chargeOptionsParamName)); - public static final Set SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList( + public static final Set SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList( chargeIdParamName, amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName, feeOnMonthDayParamName, monthDayFormatParamName, feeIntervalParamName)); - public static final Set SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList( + public static final Set SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList( amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName)); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/PreClosurePenalInterestOnType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/PreClosurePenalInterestOnType.java index 476f6dcfd..72fb29a62 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/PreClosurePenalInterestOnType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/PreClosurePenalInterestOnType.java @@ -50,7 +50,7 @@ public enum PreClosurePenalInterestOnType { } public static Object[] integerValues() { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final PreClosurePenalInterestOnType enumType : values()) { if (enumType.getValue() > 0) { values.add(enumType.getValue()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/RecurringDepositType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/RecurringDepositType.java index f4be109a7..b2af230f1 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/RecurringDepositType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/RecurringDepositType.java @@ -50,7 +50,7 @@ public enum RecurringDepositType { } public static Object[] integerValues() { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final RecurringDepositType enumType : values()) { if (enumType.getValue() > 0) { values.add(enumType.getValue()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsApiConstants.java index 38e604a5c..6158b683a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsApiConstants.java @@ -132,7 +132,7 @@ public class SavingsApiConstants { public static final String charges = "charges"; public static final String linkedAccount = "linkedAccount"; - public static final Set SAVINGS_PRODUCT_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set SAVINGS_PRODUCT_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, monthDayFormatParamName, nameParamName, shortNameParamName, descriptionParamName, currencyCodeParamName, digitsAfterDecimalParamName, inMultiplesOfParamName, nominalAnnualInterestRateParamName, interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName, interestCalculationTypeParamName, @@ -156,7 +156,7 @@ public class SavingsApiConstants { * {@link SavingsProductData}. Where possible, we try to get response * parameters to match those of request parameters. */ - public static final Set SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName, + public static final Set SAVINGS_PRODUCT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, nameParamName, shortNameParamName, descriptionParamName, "currency", digitsAfterDecimalParamName, inMultiplesOfParamName, nominalAnnualInterestRateParamName, interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName, interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName, minRequiredOpeningBalanceParamName, @@ -165,7 +165,7 @@ public class SavingsApiConstants { "interestCompoundingPeriodTypeOptions", "interestPostingPeriodTypeOptions", "interestCalculationTypeOptions", "interestCalculationDaysInYearTypeOptions", "lockinPeriodFrequencyTypeOptions", "withdrawalFeeTypeOptions")); - public static final Set SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, monthDayFormatParamName, accountNoParamName, externalIdParamName, clientIdParamName, groupIdParamName, productIdParamName, fieldOfficerIdParamName, submittedOnDateParamName, nominalAnnualInterestRateParamName, interestCompoundingPeriodTypeParamName, interestPostingPeriodTypeParamName, interestCalculationTypeParamName, @@ -180,7 +180,7 @@ public class SavingsApiConstants { * {@link SavingsAccountData}. Where possible, we try to get response * parameters to match those of request parameters. */ - public static final Set SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName, + public static final Set SAVINGS_ACCOUNT_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, accountNoParamName, externalIdParamName, statusParamName, activatedOnDateParamName, clientIdParamName, "clientName", groupIdParamName, "groupName", "savingsProductId", "savingsProductName", "currency", nominalAnnualInterestRateParamName, interestCompoundingPeriodTypeParamName, interestCalculationTypeParamName, interestCalculationDaysInYearTypeParamName, @@ -190,30 +190,30 @@ public class SavingsApiConstants { "interestPostingPeriodTypeOptions", "interestCalculationTypeOptions", "interestCalculationDaysInYearTypeOptions", "lockinPeriodFrequencyTypeOptions", "withdrawalFeeTypeOptions", "withdrawalFee", "annualFee")); - public static final Set SAVINGS_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList( + public static final Set SAVINGS_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList( localeParamName, dateFormatParamName, transactionDateParamName, transactionAmountParamName, paymentTypeIdParamName, transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName)); - public static final Set SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(idParamName, + public static final Set SAVINGS_TRANSACTION_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName, "accountId", accountNoParamName, "currency", "amount", dateParamName, paymentDetailDataParamName, runningBalanceParamName, reversedParamName)); - public static final Set SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, activatedOnDateParamName)); - public static final Set SAVINGS_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set SAVINGS_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, closedOnDateParamName, noteParamName)); - public static final Set SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS = new HashSet(Arrays.asList(chargeIdParamName, + public static final Set SAVINGS_ACCOUNT_CHARGES_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(chargeIdParamName, savingsAccountChargeIdParamName, chargeNameParamName, penaltyParamName, chargeTimeTypeParamName, dueAsOfDateParamName, chargeCalculationTypeParamName, percentageParamName, amountPercentageAppliedToParamName, currencyParamName, amountWaivedParamName, amountWrittenOffParamName, amountOutstandingParamName, amountOrPercentageParamName, amountParamName, amountPaidParamName, chargeOptionsParamName)); - public static final Set SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList( + public static final Set SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList( chargeIdParamName, amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName, feeOnMonthDayParamName, monthDayFormatParamName, feeIntervalParamName)); - public static final Set SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList( + public static final Set SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList( amountParamName, dueAsOfDateParamName, dateFormatParamName, localeParamName)); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsCompoundingInterestPeriodType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsCompoundingInterestPeriodType.java index 4a6ffa201..9dacefb83 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsCompoundingInterestPeriodType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsCompoundingInterestPeriodType.java @@ -22,9 +22,10 @@ public enum SavingsCompoundingInterestPeriodType { // BIWEEKLY(3, "savingsCompoundingInterestPeriodType.biweekly"), // MONTHLY(4, "savingsCompoundingInterestPeriodType.monthly"), - QUATERLY(5, "savingsCompoundingInterestPeriodType.quarterly"), // - BI_ANNUAL(6, "savingsCompoundingInterestPeriodType.biannual"), // - ANNUAL(7, "savingsCompoundingInterestPeriodType.annual"); // + QUATERLY(5, "savingsCompoundingInterestPeriodType.quarterly"), // + BI_ANNUAL(6, "savingsCompoundingInterestPeriodType.biannual"), // + ANNUAL(7, "savingsCompoundingInterestPeriodType.annual"); // + // NO_COMPOUNDING_SIMPLE_INTEREST(8, // "savingsCompoundingInterestPeriodType.nocompounding"); @@ -45,7 +46,7 @@ public enum SavingsCompoundingInterestPeriodType { } public static Object[] integerValues() { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final SavingsCompoundingInterestPeriodType enumType : values()) { if (enumType.getValue() > 0) { values.add(enumType.getValue()); @@ -74,16 +75,13 @@ public enum SavingsCompoundingInterestPeriodType { repaymentFrequencyType = SavingsCompoundingInterestPeriodType.MONTHLY; break; case 5: - repaymentFrequencyType = - SavingsCompoundingInterestPeriodType.QUATERLY; + repaymentFrequencyType = SavingsCompoundingInterestPeriodType.QUATERLY; break; case 6: - repaymentFrequencyType = - SavingsCompoundingInterestPeriodType.BI_ANNUAL; + repaymentFrequencyType = SavingsCompoundingInterestPeriodType.BI_ANNUAL; break; case 7: - repaymentFrequencyType = - SavingsCompoundingInterestPeriodType.ANNUAL; + repaymentFrequencyType = SavingsCompoundingInterestPeriodType.ANNUAL; break; case 8: // repaymentFrequencyType = diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsInterestCalculationDaysInYearType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsInterestCalculationDaysInYearType.java index 71ad54a12..bec309aa4 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsInterestCalculationDaysInYearType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsInterestCalculationDaysInYearType.java @@ -39,7 +39,7 @@ public enum SavingsInterestCalculationDaysInYearType { } public static Object[] integerValues() { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final SavingsInterestCalculationDaysInYearType enumType : values()) { if (enumType.getValue() > 0) { values.add(enumType.getValue()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsInterestCalculationType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsInterestCalculationType.java index 00c45dc38..f3d9ab0c8 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsInterestCalculationType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsInterestCalculationType.java @@ -53,7 +53,7 @@ public enum SavingsInterestCalculationType { } public static Object[] integerValues() { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final SavingsInterestCalculationType enumType : values()) { if (enumType.getValue() > 0) { values.add(enumType.getValue()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsPeriodFrequencyType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsPeriodFrequencyType.java index 61b6a5be2..59415f606 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsPeriodFrequencyType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsPeriodFrequencyType.java @@ -60,7 +60,7 @@ public enum SavingsPeriodFrequencyType { } public static Object[] integerValues() { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final SavingsPeriodFrequencyType enumType : values()) { if (!enumType.isInvalid()) { values.add(enumType.getValue()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsPostingInterestPeriodType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsPostingInterestPeriodType.java index 6bad21040..6504caba0 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsPostingInterestPeriodType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsPostingInterestPeriodType.java @@ -37,7 +37,7 @@ public enum SavingsPostingInterestPeriodType { } public static Object[] integerValues() { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final SavingsPostingInterestPeriodType enumType : values()) { if (enumType.getValue() > 0) { values.add(enumType.getValue()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsWithdrawalFeesType.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsWithdrawalFeesType.java index 808c1e37b..9d3e7c2bd 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsWithdrawalFeesType.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/SavingsWithdrawalFeesType.java @@ -31,7 +31,7 @@ public enum SavingsWithdrawalFeesType { } public static Object[] integerValues() { - final List values = new ArrayList(); + final List values = new ArrayList<>(); for (final SavingsWithdrawalFeesType enumType : values()) { if (enumType.getValue() > 0) { values.add(enumType.getValue()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/FixedDepositAccountsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/FixedDepositAccountsApiResource.java index 69a054c76..e1fc2e887 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/FixedDepositAccountsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/FixedDepositAccountsApiResource.java @@ -160,7 +160,7 @@ public class FixedDepositAccountsApiResource { final FixedDepositAccountData account = (FixedDepositAccountData) this.depositAccountReadPlatformService.retrieveOneWithChartSlabs( DepositAccountType.FIXED_DEPOSIT, accountId); - final Set mandatoryResponseParameters = new HashSet(); + final Set mandatoryResponseParameters = new HashSet<>(); final FixedDepositAccountData accountTemplate = populateTemplateAndAssociations(accountId, account, staffInSelectedOfficeOnly, uriInfo, mandatoryResponseParameters); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/FixedDepositProductsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/FixedDepositProductsApiResource.java index 92d404757..4a660e84f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/FixedDepositProductsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/FixedDepositProductsApiResource.java @@ -232,7 +232,7 @@ public class FixedDepositProductsApiResource { CurrencyData currency = CurrencyData.blank(); final Collection currencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies(); if (currencyOptions.size() == 1) { - currency = new ArrayList(currencyOptions).get(0); + currency = new ArrayList<>(currencyOptions).get(0); } final Collection interestCompoundingPeriodTypeOptions = this.savingsDropdownReadPlatformService diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/RecurringDepositAccountsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/RecurringDepositAccountsApiResource.java index 372ede8f8..23b792c5f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/RecurringDepositAccountsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/RecurringDepositAccountsApiResource.java @@ -157,7 +157,7 @@ public class RecurringDepositAccountsApiResource { final RecurringDepositAccountData account = (RecurringDepositAccountData) this.depositAccountReadPlatformService .retrieveOneWithChartSlabs(DepositAccountType.RECURRING_DEPOSIT, accountId); - final Set mandatoryResponseParameters = new HashSet(); + final Set mandatoryResponseParameters = new HashSet<>(); final RecurringDepositAccountData accountTemplate = populateTemplateAndAssociations(accountId, account, staffInSelectedOfficeOnly, uriInfo, mandatoryResponseParameters); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/RecurringDepositProductsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/RecurringDepositProductsApiResource.java index 97e2500e9..d457e1eff 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/RecurringDepositProductsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/RecurringDepositProductsApiResource.java @@ -233,7 +233,7 @@ public class RecurringDepositProductsApiResource { CurrencyData currency = CurrencyData.blank(); final Collection currencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies(); if (currencyOptions.size() == 1) { - currency = new ArrayList(currencyOptions).get(0); + currency = new ArrayList<>(currencyOptions).get(0); } final Collection interestCompoundingPeriodTypeOptions = this.savingsDropdownReadPlatformService diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsAccountsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsAccountsApiResource.java index e5e2d4441..bfd81382e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsAccountsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsAccountsApiResource.java @@ -136,7 +136,7 @@ public class SavingsAccountsApiResource { final SavingsAccountData savingsAccount = this.savingsAccountReadPlatformService.retrieveOne(accountId); - final Set mandatoryResponseParameters = new HashSet(); + final Set mandatoryResponseParameters = new HashSet<>(); final SavingsAccountData savingsAccountTemplate = populateTemplateAndAssociations(accountId, savingsAccount, staffInSelectedOfficeOnly, uriInfo, mandatoryResponseParameters); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsProductsApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsProductsApiResource.java index 3d416d574..161fb0f91 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsProductsApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/api/SavingsProductsApiResource.java @@ -209,7 +209,7 @@ public class SavingsProductsApiResource { CurrencyData currency = CurrencyData.blank(); final Collection currencyOptions = this.currencyReadPlatformService.retrieveAllowedCurrencies(); if (currencyOptions.size() == 1) { - currency = new ArrayList(currencyOptions).get(0); + currency = new ArrayList<>(currencyOptions).get(0); } final Collection interestCompoundingPeriodTypeOptions = this.dropdownReadPlatformService diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountDataValidator.java index 7c3746cce..7db49469d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountDataValidator.java @@ -99,7 +99,7 @@ public class DepositAccountDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, DepositsApiConstants.FIXED_DEPOSIT_ACCOUNT_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(DepositsApiConstants.FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -119,7 +119,7 @@ public class DepositAccountDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, DepositsApiConstants.FIXED_DEPOSIT_ACCOUNT_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(DepositsApiConstants.FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -139,7 +139,7 @@ public class DepositAccountDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -160,7 +160,7 @@ public class DepositAccountDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(DepositsApiConstants.RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -630,7 +630,7 @@ public class DepositAccountDataValidator { } public void validatelinkedSavingsAccount(final SavingsAccount linkedSavingsAccount, final SavingsAccount savingsAccount) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); if (linkedSavingsAccount.isNotActive()) { final ApiParameterError error = ApiParameterError.parameterError("validation.msg.deposit.linked.savings.account.is.not.active", "Linked Savings account with id:" + linkedSavingsAccount.getId() + " is not in active state", "linkAccountId", @@ -648,7 +648,7 @@ public class DepositAccountDataValidator { } public void throwLinkedAccountRequiredError() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final ApiParameterError error = ApiParameterError.parameterError( "validation.msg.fixeddepositaccount.linkAccountId.cannot.be.blank", "Linked Savings account required", "linkAccountId"); dataValidationErrors.add(error); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountInterestRateChartData.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountInterestRateChartData.java index ba156df5e..da19940e3 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountInterestRateChartData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountInterestRateChartData.java @@ -31,7 +31,7 @@ public class DepositAccountInterestRateChartData { private Set chartSlabs; // template - private Collection periodTypes; + private final Collection periodTypes; private final Collection entityTypeOptions; private final Collection attributeNameOptions; private final Collection conditionTypeOptions; @@ -60,7 +60,7 @@ public class DepositAccountInterestRateChartData { final Long id = null; final Long accountId = null; final String accountNumber = null; - Set fromProdChartSlabs = new HashSet(); + Set fromProdChartSlabs = new HashSet<>(); Set productChartSlabDatas = productChartData.chartSlabs(); if (productChartSlabDatas != null) { for (InterestRateChartSlabData productChartSlabData : productChartSlabDatas) { @@ -142,7 +142,7 @@ public class DepositAccountInterestRateChartData { public void addChartSlab(final DepositAccountInterestRateChartSlabData chartSlab) { if (this.chartSlabs == null) { - this.chartSlabs = new HashSet(); + this.chartSlabs = new HashSet<>(); } this.chartSlabs.add(chartSlab); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountInterestRateChartSlabData.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountInterestRateChartSlabData.java index d920a2947..e6930c819 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountInterestRateChartSlabData.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountInterestRateChartSlabData.java @@ -71,7 +71,7 @@ public class DepositAccountInterestRateChartSlabData { public static DepositAccountInterestRateChartSlabData from(final InterestRateChartSlabData chartSlabData) { final Long id = null; - Set fromProdIncentives = new HashSet(); + Set fromProdIncentives = new HashSet<>(); Set productIncentiveData = chartSlabData.incentives(); if (productIncentiveData != null) { for (InterestIncentiveData incentive : productIncentiveData) { @@ -126,7 +126,7 @@ public class DepositAccountInterestRateChartSlabData { public void addIncentives(final DepositAccountInterestIncentiveData incentive) { if (this.incentives == null) { - this.incentives = new HashSet(); + this.incentives = new HashSet<>(); } this.incentives.add(incentive); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountTransactionDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountTransactionDataValidator.java index ca0c17d1d..f16b707c3 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountTransactionDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositAccountTransactionDataValidator.java @@ -65,7 +65,7 @@ public class DepositAccountTransactionDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, DepositsApiConstants.DEPOSIT_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(depositAccountType.resourceName()); @@ -80,7 +80,7 @@ public class DepositAccountTransactionDataValidator { // Validate all string payment detail fields for max length final Integer paymentTypeId = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(paymentTypeIdParamName, element); baseDataValidator.reset().parameter(paymentTypeIdParamName).value(paymentTypeId).ignoreIfNull().integerGreaterThanZero(); - final Set paymentDetailParameters = new HashSet(Arrays.asList(transactionAccountNumberParamName, + final Set paymentDetailParameters = new HashSet<>(Arrays.asList(transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName)); for (final String paymentDetailParameterName : paymentDetailParameters) { final String paymentDetailParameterValue = this.fromApiJsonHelper.extractStringNamed(paymentDetailParameterName, element); @@ -100,7 +100,7 @@ public class DepositAccountTransactionDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SavingsApiConstants.SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -120,7 +120,7 @@ public class DepositAccountTransactionDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, DepositsApiConstants.DEPOSIT_ACCOUNT_PRE_MATURE_CALCULATION_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(depositAccountType .resourceName()); @@ -141,7 +141,7 @@ public class DepositAccountTransactionDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, DepositsApiConstants.DEPOSIT_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(depositAccountType .resourceName()); @@ -169,7 +169,7 @@ public class DepositAccountTransactionDataValidator { // Validate all string payment detail fields for max length final Integer paymentTypeId = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(paymentTypeIdParamName, element); baseDataValidator.reset().parameter(paymentTypeIdParamName).value(paymentTypeId).ignoreIfNull().integerGreaterThanZero(); - final Set paymentDetailParameters = new HashSet(Arrays.asList(transactionAccountNumberParamName, + final Set paymentDetailParameters = new HashSet<>(Arrays.asList(transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName)); for (final String paymentDetailParameterName : paymentDetailParameters) { final String paymentDetailParameterValue = this.fromApiJsonHelper.extractStringNamed(paymentDetailParameterName, element); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositProductDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositProductDataValidator.java index 7bb5319c2..592eb6270 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositProductDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/DepositProductDataValidator.java @@ -93,7 +93,7 @@ public class DepositProductDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, FIXED_DEPOSIT_PRODUCT_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(FIXED_DEPOSIT_PRODUCT_RESOURCE_NAME); @@ -118,7 +118,7 @@ public class DepositProductDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, FIXED_DEPOSIT_PRODUCT_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(FIXED_DEPOSIT_PRODUCT_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -142,7 +142,7 @@ public class DepositProductDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, RECURRING_DEPOSIT_PRODUCT_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(RECURRING_DEPOSIT_PRODUCT_RESOURCE_NAME); @@ -169,7 +169,7 @@ public class DepositProductDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, RECURRING_DEPOSIT_PRODUCT_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(RECURRING_DEPOSIT_PRODUCT_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountChargeDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountChargeDataValidator.java index a1ce10e9c..e411552e5 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountChargeDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountChargeDataValidator.java @@ -51,7 +51,7 @@ public class SavingsAccountChargeDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_CHARGE_RESOURCE_NAME); @@ -81,7 +81,7 @@ public class SavingsAccountChargeDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SAVINGS_ACCOUNT_CHARGES_ADD_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_CHARGE_RESOURCE_NAME); @@ -117,7 +117,7 @@ public class SavingsAccountChargeDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SAVINGS_ACCOUNT_CHARGES_PAY_CHARGE_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_CHARGE_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountDataValidator.java index 98eb3aa74..cfea4e7a4 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountDataValidator.java @@ -74,7 +74,7 @@ public class SavingsAccountDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SavingsApiConstants.SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -240,7 +240,7 @@ public class SavingsAccountDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SavingsApiConstants.SAVINGS_ACCOUNT_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountTransactionDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountTransactionDataValidator.java index 379e22011..7af82cd6d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountTransactionDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsAccountTransactionDataValidator.java @@ -60,7 +60,7 @@ public class SavingsAccountTransactionDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SavingsApiConstants.SAVINGS_ACCOUNT_TRANSACTION_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SavingsApiConstants.SAVINGS_ACCOUNT_TRANSACTION_RESOURCE_NAME); @@ -75,7 +75,7 @@ public class SavingsAccountTransactionDataValidator { // Validate all string payment detail fields for max length final Integer paymentTypeId = this.fromApiJsonHelper.extractIntegerWithLocaleNamed(paymentTypeIdParamName, element); baseDataValidator.reset().parameter(paymentTypeIdParamName).value(paymentTypeId).ignoreIfNull().integerGreaterThanZero(); - final Set paymentDetailParameters = new HashSet(Arrays.asList(transactionAccountNumberParamName, + final Set paymentDetailParameters = new HashSet<>(Arrays.asList(transactionAccountNumberParamName, checkNumberParamName, routingCodeParamName, receiptNumberParamName, bankNumberParamName)); for (final String paymentDetailParameterName : paymentDetailParameters) { final String paymentDetailParameterValue = this.fromApiJsonHelper.extractStringNamed(paymentDetailParameterName, element); @@ -95,7 +95,7 @@ public class SavingsAccountTransactionDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SavingsApiConstants.SAVINGS_ACCOUNT_ACTIVATION_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -116,7 +116,7 @@ public class SavingsAccountTransactionDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SavingsApiConstants.SAVINGS_ACCOUNT_CLOSE_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SavingsApiConstants.SAVINGS_ACCOUNT_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsProductDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsProductDataValidator.java index 059160dde..9189cdbb5 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsProductDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/data/SavingsProductDataValidator.java @@ -72,7 +72,7 @@ public class SavingsProductDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SAVINGS_PRODUCT_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_PRODUCT_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -282,7 +282,7 @@ public class SavingsProductDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, SAVINGS_PRODUCT_REQUEST_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_PRODUCT_RESOURCE_NAME); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountAssembler.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountAssembler.java index 679f206f9..2e15dd687 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountAssembler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountAssembler.java @@ -393,7 +393,7 @@ public class DepositAccountAssembler { final String json = command.json(); if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } final JsonElement element = this.fromApiJsonHelper.parse(json); - final Collection savingsAccountTransactions = new ArrayList(); + final Collection savingsAccountTransactions = new ArrayList<>(); final PaymentDetail paymentDetail = null; final LocalDate transactionDate = this.fromApiJsonHelper.extractLocalDateNamed(transactionDateParamName, element); final String dateFormat = this.fromApiJsonHelper.extractDateFormatParameter(element.getAsJsonObject()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountDomainServiceJpa.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountDomainServiceJpa.java index aaf47f779..0c358834c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountDomainServiceJpa.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountDomainServiceJpa.java @@ -114,8 +114,8 @@ public class DepositAccountDomainServiceJpa implements DepositAccountDomainServi boolean isRegularTransaction = false; boolean isAccountTransfer = false; final boolean isPreMatureClosure = false; - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); /* * <<<<<<< HEAD final SavingsAccountTransactionDTO transactionDTO = new @@ -179,8 +179,8 @@ public class DepositAccountDomainServiceJpa implements DepositAccountDomainServi boolean isRegularTransaction = false; boolean isAccountTransfer = false; final boolean isPreMatureClosure = false; - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); final MathContext mc = MathContext.DECIMAL64; @@ -255,8 +255,8 @@ public class DepositAccountDomainServiceJpa implements DepositAccountDomainServi boolean isAccountTransfer = false; boolean isRegularTransaction = false; final boolean isPreMatureClosure = true; - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); final LocalDate closedDate = command.localDateValueOfParameterNamed(SavingsApiConstants.closedOnDateParamName); @@ -301,8 +301,8 @@ public class DepositAccountDomainServiceJpa implements DepositAccountDomainServi boolean isAccountTransfer = false; final boolean isPreMatureClosure = true; boolean isRegularTransaction = false; - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); final LocalDate closedDate = command.localDateValueOfParameterNamed(SavingsApiConstants.closedOnDateParamName); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestIncentive.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestIncentive.java index a45533e96..c7d11e11c 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestIncentive.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestIncentive.java @@ -13,12 +13,10 @@ import org.springframework.data.jpa.domain.AbstractPersistable; @Table(name = "m_deposit_account_interest_incentives") public class DepositAccountInterestIncentive extends AbstractPersistable { - @SuppressWarnings("unused") @ManyToOne @JoinColumn(name = "deposit_account_interest_rate_slab_id", nullable = false) private DepositAccountInterestRateChartSlabs depositAccountInterestRateChartSlabs; - @SuppressWarnings("unused") @Embedded private InterestIncentivesFields interestIncentivesFields; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestIncentives.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestIncentives.java index 274dc26b3..89340ce95 100755 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestIncentives.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestIncentives.java @@ -13,7 +13,6 @@ import org.springframework.data.jpa.domain.AbstractPersistable; @Table(name = "m_savings_interest_incentives") public class DepositAccountInterestIncentives extends AbstractPersistable { - @SuppressWarnings("unused") @ManyToOne @JoinColumn(name = "deposit_account_interest_rate_slab_id", nullable = false) private DepositAccountInterestRateChartSlabs depositAccountInterestRateChartSlabs; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestRateChart.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestRateChart.java index b28b7fda7..64fb1a193 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestRateChart.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestRateChart.java @@ -42,7 +42,7 @@ public class DepositAccountInterestRateChart extends AbstractPersistable { @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(mappedBy = "depositAccountInterestRateChart", cascade = CascadeType.ALL, orphanRemoval = true) - private Set chartSlabs = new HashSet(); + private Set chartSlabs = new HashSet<>(); protected DepositAccountInterestRateChart() { // @@ -50,7 +50,7 @@ public class DepositAccountInterestRateChart extends AbstractPersistable { public static DepositAccountInterestRateChart from(InterestRateChart productChart) { final Set chartSlabs = productChart.setOfChartSlabs(); - final Set depostiChartSlabs = new HashSet(); + final Set depostiChartSlabs = new HashSet<>(); for (InterestRateChartSlab interestRateChartSlab : chartSlabs) { depostiChartSlabs.add(DepositAccountInterestRateChartSlabs.from(interestRateChartSlab, null)); } @@ -77,7 +77,7 @@ public class DepositAccountInterestRateChart extends AbstractPersistable { public Set setOfChartSlabs() { if (this.chartSlabs == null) { - this.chartSlabs = new HashSet(); + this.chartSlabs = new HashSet<>(); } return this.chartSlabs; } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestRateChartSlabs.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestRateChartSlabs.java index 4167a9c35..2deaeca3f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestRateChartSlabs.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountInterestRateChartSlabs.java @@ -36,7 +36,7 @@ public class DepositAccountInterestRateChartSlabs extends AbstractPersistable interestIncentives = new HashSet(); + private Set interestIncentives = new HashSet<>(); protected DepositAccountInterestRateChartSlabs() { // @@ -64,7 +64,7 @@ public class DepositAccountInterestRateChartSlabs extends AbstractPersistable depositInterestIncentives = new HashSet(); + Set depositInterestIncentives = new HashSet<>(); Set incentives = interestRateChartSlab.setOfInterestIncentives(); for (InterestIncentives incentive : incentives) { depositInterestIncentives.add(DepositAccountInterestIncentives.from(null, incentive.interestIncentivesFields())); @@ -84,7 +84,7 @@ public class DepositAccountInterestRateChartSlabs extends AbstractPersistable setOfIncentives() { if (this.interestIncentives == null) { - this.interestIncentives = new HashSet(); + this.interestIncentives = new HashSet<>(); } return this.interestIncentives; } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountRecurringDetail.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountRecurringDetail.java index 33c0d3671..613e655dd 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountRecurringDetail.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountRecurringDetail.java @@ -29,25 +29,22 @@ public class DepositAccountRecurringDetail extends AbstractPersistable { @Column(name = "mandatory_recommended_deposit_amount", scale = 6, precision = 19, nullable = true) private BigDecimal mandatoryRecommendedDepositAmount; - @SuppressWarnings("unused") @Column(name = "total_overdue_amount", scale = 6, precision = 19, nullable = true) private BigDecimal totalOverdueAmount; @Column(name = "is_calendar_inherited", nullable = false) - private boolean isCalendarInherited; - - @SuppressWarnings("unused") + private final boolean isCalendarInherited; + @Column(name = "no_of_overdue_installments", nullable = false) private Integer noOfOverdueInstallments; @Embedded private DepositRecurringDetail recurringDetail; - @SuppressWarnings("unused") @OneToOne @JoinColumn(name = "savings_account_id", nullable = false) private SavingsAccount account; - + /** * */ @@ -56,8 +53,6 @@ public class DepositAccountRecurringDetail extends AbstractPersistable { this.isCalendarInherited = false; } - - public static DepositAccountRecurringDetail createNew(final BigDecimal mandatoryRecommendedDepositAmount, final DepositRecurringDetail recurringDetail, final SavingsAccount account, final boolean isCalendarInherited) { final BigDecimal totalOverdueAmount = null; @@ -74,7 +69,8 @@ public class DepositAccountRecurringDetail extends AbstractPersistable { * @param account */ protected DepositAccountRecurringDetail(final BigDecimal mandatoryRecommendedDepositAmount, final BigDecimal totalOverdueAmount, - final Integer noOfOverdueInstallments, final DepositRecurringDetail recurringDetail, final SavingsAccount account, final boolean isCalendarInherited) { + final Integer noOfOverdueInstallments, final DepositRecurringDetail recurringDetail, final SavingsAccount account, + final boolean isCalendarInherited) { this.mandatoryRecommendedDepositAmount = mandatoryRecommendedDepositAmount; this.totalOverdueAmount = totalOverdueAmount; this.noOfOverdueInstallments = noOfOverdueInstallments; @@ -84,7 +80,7 @@ public class DepositAccountRecurringDetail extends AbstractPersistable { } public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(10); + final Map actualChanges = new LinkedHashMap<>(10); if (command.isChangeInBigDecimalParameterNamed(mandatoryRecommendedDepositAmountParamName, this.mandatoryRecommendedDepositAmount)) { final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(mandatoryRecommendedDepositAmountParamName); actualChanges.put(mandatoryRecommendedDepositAmountParamName, newValue); @@ -120,18 +116,18 @@ public class DepositAccountRecurringDetail extends AbstractPersistable { return this.mandatoryRecommendedDepositAmount; } - public boolean isCalendarInherited(){ + public boolean isCalendarInherited() { return this.isCalendarInherited; } - + public DepositAccountRecurringDetail copy() { final BigDecimal mandatoryRecommendedDepositAmount = this.mandatoryRecommendedDepositAmount; final DepositRecurringDetail recurringDetail = this.recurringDetail.copy(); final boolean isCalendarInherited = this.isCalendarInherited; return DepositAccountRecurringDetail.createNew(mandatoryRecommendedDepositAmount, recurringDetail, null, isCalendarInherited); } - - public void updateOverdueDetails(final int noOfOverdueInstallments, final Money totalOverdueAmount){ + + public void updateOverdueDetails(final int noOfOverdueInstallments, final Money totalOverdueAmount) { this.noOfOverdueInstallments = noOfOverdueInstallments; this.totalOverdueAmount = totalOverdueAmount.getAmount(); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountTermAndPreClosure.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountTermAndPreClosure.java index fec12dfc8..9e28b9401 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountTermAndPreClosure.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositAccountTermAndPreClosure.java @@ -110,7 +110,7 @@ public class DepositAccountTermAndPreClosure extends AbstractPersistable { } public Map update(final JsonCommand command, final DataValidatorBuilder baseDataValidator) { - final Map actualChanges = new LinkedHashMap(10); + final Map actualChanges = new LinkedHashMap<>(10); if (command.isChangeInBigDecimalParameterNamed(depositAmountParamName, this.depositAmount)) { final BigDecimal newValue = command.bigDecimalValueOfParameterNamed(depositAmountParamName); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositPreClosureDetail.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositPreClosureDetail.java index 458b819df..fa1d827a7 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositPreClosureDetail.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositPreClosureDetail.java @@ -57,7 +57,7 @@ public class DepositPreClosureDetail { } protected Map update(final JsonCommand command, final DataValidatorBuilder baseDataValidator) { - final Map actualChanges = new LinkedHashMap(10); + final Map actualChanges = new LinkedHashMap<>(10); final String localeAsInput = command.locale(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductAmountDetails.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductAmountDetails.java index b9794465a..2c6f91ba1 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductAmountDetails.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductAmountDetails.java @@ -48,7 +48,7 @@ public class DepositProductAmountDetails { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(20); + final Map actualChanges = new LinkedHashMap<>(20); final String localeAsInput = command.locale(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductAssembler.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductAssembler.java index 73d5c3d3a..d04d875b5 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductAssembler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductAssembler.java @@ -382,7 +382,7 @@ public class DepositProductAssembler { public Set assembleListOfSavingsProductCharges(final JsonCommand command, final String savingsProductCurrencyCode) { - final Set charges = new HashSet(); + final Set charges = new HashSet<>(); if (command.parameterExists(chargesParamName)) { final JsonArray chargesArray = command.arrayOfParameterNamed(chargesParamName); @@ -415,7 +415,7 @@ public class DepositProductAssembler { } private Set assembleListOfCharts(JsonCommand command, String currencyCode) { - final Set charts = new HashSet(); + final Set charts = new HashSet<>(); if (command.parameterExists(chartsParamName)) { final JsonArray chartsArray = command.arrayOfParameterNamed(chartsParamName); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductRecurringDetail.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductRecurringDetail.java index c685bc3a1..fc9f54334 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductRecurringDetail.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductRecurringDetail.java @@ -24,7 +24,6 @@ public class DepositProductRecurringDetail extends AbstractPersistable { @Embedded private DepositRecurringDetail recurringDetail; - @SuppressWarnings("unused") @OneToOne @JoinColumn(name = "savings_product_id", nullable = false) private RecurringDepositProduct product; @@ -44,7 +43,7 @@ public class DepositProductRecurringDetail extends AbstractPersistable { } public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(10); + final Map actualChanges = new LinkedHashMap<>(10); if (this.recurringDetail != null) { actualChanges.putAll(this.recurringDetail.update(command)); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductTermAndPreClosure.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductTermAndPreClosure.java index 27324dca2..63a3a9ef1 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductTermAndPreClosure.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositProductTermAndPreClosure.java @@ -28,11 +28,10 @@ public class DepositProductTermAndPreClosure extends AbstractPersistable { @Embedded protected DepositTermDetail depositTermDetail; - @SuppressWarnings("unused") @OneToOne @JoinColumn(name = "savings_product_id", nullable = false) private FixedDepositProduct product; - + @Embedded private DepositProductAmountDetails depositProductAmountDetails; @@ -41,22 +40,21 @@ public class DepositProductTermAndPreClosure extends AbstractPersistable { } public static DepositProductTermAndPreClosure createNew(DepositPreClosureDetail preClosureDetail, DepositTermDetail depositTermDetail, - DepositProductAmountDetails depositProductMinMaxAmountDetails, - SavingsProduct product) { + DepositProductAmountDetails depositProductMinMaxAmountDetails, SavingsProduct product) { return new DepositProductTermAndPreClosure(preClosureDetail, depositTermDetail, depositProductMinMaxAmountDetails, product); } private DepositProductTermAndPreClosure(DepositPreClosureDetail preClosureDetail, DepositTermDetail depositTermDetail, - DepositProductAmountDetails depositProductMinMaxAmountDetails, SavingsProduct product) { + DepositProductAmountDetails depositProductMinMaxAmountDetails, SavingsProduct product) { this.preClosureDetail = preClosureDetail; this.depositTermDetail = depositTermDetail; this.depositProductAmountDetails = depositProductMinMaxAmountDetails; - this.product = (FixedDepositProduct)product; + this.product = (FixedDepositProduct) product; } public Map update(final JsonCommand command, final DataValidatorBuilder baseDataValidator) { - final Map actualChanges = new LinkedHashMap(10); + final Map actualChanges = new LinkedHashMap<>(10); if (this.preClosureDetail != null) { actualChanges.putAll(this.preClosureDetail.update(command, baseDataValidator)); } @@ -64,13 +62,13 @@ public class DepositProductTermAndPreClosure extends AbstractPersistable { if (this.depositTermDetail != null) { actualChanges.putAll(this.depositTermDetail.update(command, baseDataValidator)); } - - if(this.depositProductAmountDetails != null) { - actualChanges.putAll(this.depositProductAmountDetails.update(command)); + + if (this.depositProductAmountDetails != null) { + actualChanges.putAll(this.depositProductAmountDetails.update(command)); } return actualChanges; } - + public DepositPreClosureDetail depositPreClosureDetail() { return this.preClosureDetail; } @@ -78,12 +76,12 @@ public class DepositProductTermAndPreClosure extends AbstractPersistable { public DepositTermDetail depositTermDetail() { return this.depositTermDetail; } - + public DepositProductAmountDetails depositProductAmountDetails() { - return this.depositProductAmountDetails; - } - - public void updateProductReference(final SavingsProduct product){ - this.product = (FixedDepositProduct)product; + return this.depositProductAmountDetails; + } + + public void updateProductReference(final SavingsProduct product) { + this.product = (FixedDepositProduct) product; } } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositRecurringDetail.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositRecurringDetail.java index bf304f055..45a53a32c 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositRecurringDetail.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositRecurringDetail.java @@ -51,7 +51,7 @@ public class DepositRecurringDetail { } public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(10); + final Map actualChanges = new LinkedHashMap<>(10); if (command.isChangeInBooleanParameterNamed(isMandatoryDepositParamName, this.isMandatoryDeposit)) { final boolean newValue = command.booleanObjectValueOfParameterNamed(isMandatoryDepositParamName); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositTermDetail.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositTermDetail.java index 3d8359d5a..4bfc344ba 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositTermDetail.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/DepositTermDetail.java @@ -79,7 +79,7 @@ public class DepositTermDetail { } public Map update(final JsonCommand command, final DataValidatorBuilder baseDataValidator) { - final Map actualChanges = new LinkedHashMap(10); + final Map actualChanges = new LinkedHashMap<>(10); if (command.isChangeInIntegerParameterNamed(minDepositTermParamName, this.minDepositTerm)) { final Integer newValue = command.integerValueOfParameterNamed(minDepositTermParamName); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/FixedDepositAccount.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/FixedDepositAccount.java index 57e2f5bd4..44d1abbec 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/FixedDepositAccount.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/FixedDepositAccount.java @@ -120,7 +120,7 @@ public class FixedDepositAccount extends SavingsAccount { @Override public void modifyApplication(final JsonCommand command, final Map actualChanges) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME + SavingsApiConstants.modifyApplicationAction); super.modifyApplication(command, actualChanges, baseDataValidator); @@ -175,7 +175,7 @@ public class FixedDepositAccount extends SavingsAccount { } public void updateMaturityDateAndAmountBeforeAccountActivation(final MathContext mc, final boolean isPreMatureClosure) { - List allTransactions = new ArrayList(); + List allTransactions = new ArrayList<>(); final Money transactionAmountMoney = Money.of(getCurrency(), this.accountTermAndPreClosure.depositAmount()); final SavingsAccountTransaction transaction = SavingsAccountTransaction.deposit(null, office(), null, this.accountSubmittedOrActivationDate(), transactionAmountMoney, new Date()); @@ -214,7 +214,7 @@ public class FixedDepositAccount extends SavingsAccount { } public void updateMaturityStatus() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME + SavingsApiConstants.updateMaturityDetailsAction); @@ -271,7 +271,7 @@ public class FixedDepositAccount extends SavingsAccount { final List postingPeriodIntervals = this.savingsHelper.determineInterestPostingPeriods( accountSubmittedOrActivationDate(), maturityDate, postingPeriodType); - final List allPostingPeriods = new ArrayList(); + final List allPostingPeriods = new ArrayList<>(); Money periodStartingBalance = Money.zero(currency); @@ -299,7 +299,7 @@ public class FixedDepositAccount extends SavingsAccount { public void prematureClosure(final AppUser currentUser, final JsonCommand command, final LocalDate tenantsTodayDate, final Map actualChanges) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME + DepositsApiConstants.preMatureCloseAction); @@ -383,7 +383,7 @@ public class FixedDepositAccount extends SavingsAccount { public void close(final AppUser currentUser, final JsonCommand command, final LocalDate tenantsTodayDate, final Map actualChanges) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME + SavingsApiConstants.closeAction); @@ -633,7 +633,7 @@ public class FixedDepositAccount extends SavingsAccount { } public void validateDomainRules() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(FIXED_DEPOSIT_ACCOUNT_RESOURCE_NAME); validateDomainRules(baseDataValidator); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/FixedDepositProduct.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/FixedDepositProduct.java index 9036bafcb..28f742a36 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/FixedDepositProduct.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/FixedDepositProduct.java @@ -120,16 +120,16 @@ public class FixedDepositProduct extends SavingsProduct { public Set setOfCharts() { if (this.charts == null) { - this.charts = new HashSet(); + this.charts = new HashSet<>(); } return this.charts; } @Override public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(10); + final Map actualChanges = new LinkedHashMap<>(10); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(FIXED_DEPOSIT_PRODUCT_RESOURCE_NAME); @@ -143,7 +143,7 @@ public class FixedDepositProduct extends SavingsProduct { } protected Map update(final JsonCommand command, final DataValidatorBuilder baseDataValidator) { - final Map actualChanges = new LinkedHashMap(10); + final Map actualChanges = new LinkedHashMap<>(10); actualChanges.putAll(super.update(command)); @@ -160,8 +160,8 @@ public class FixedDepositProduct extends SavingsProduct { } private void updateCharts(JsonCommand command, Map actualChanges, final DataValidatorBuilder baseDataValidator) { - final Map deletedCharts = new HashMap(); - final Map chartsChanges = new HashMap(); + final Map deletedCharts = new HashMap<>(); + final Map chartsChanges = new HashMap<>(); if (command.hasParameter(DepositsApiConstants.chartsParamName)) { final JsonArray array = command.arrayOfParameterNamed(DepositsApiConstants.chartsParamName); @@ -265,7 +265,7 @@ public class FixedDepositProduct extends SavingsProduct { } public void validateInterestPostingAndCompoundingPeriodTypes(final DataValidatorBuilder baseDataValidator) { - Map> postingtoCompoundMap = new HashMap>(); + Map> postingtoCompoundMap = new HashMap<>(); postingtoCompoundMap.put( SavingsPostingInterestPeriodType.MONTHLY, Arrays.asList(new SavingsCompoundingInterestPeriodType[] { SavingsCompoundingInterestPeriodType.DAILY, @@ -302,7 +302,7 @@ public class FixedDepositProduct extends SavingsProduct { } public void validateDomainRules() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(FIXED_DEPOSIT_PRODUCT_RESOURCE_NAME); validateDomainRules(baseDataValidator); @@ -310,7 +310,7 @@ public class FixedDepositProduct extends SavingsProduct { } private void validateDomainRules(final DataValidatorBuilder baseDataValidator) { - + final DepositTermDetail termDetails = this.depositProductTermAndPreClosure().depositTermDetail(); final boolean isMinTermGreaterThanMax = termDetails.isMinDepositTermGreaterThanMaxDepositTerm(); if (isMinTermGreaterThanMax) { @@ -325,7 +325,7 @@ public class FixedDepositProduct extends SavingsProduct { baseDataValidator.reset().parameter(DepositsApiConstants.nominalAnnualInterestRateParamName).value(nominalAnnualInterestRate) .failWithCodeNoParameterAddedToErrorCode("interest.chart.or.nominal.interest.rate.required"); } - + this.validateInterestPostingAndCompoundingPeriodTypes(baseDataValidator); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/RecurringDepositAccount.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/RecurringDepositAccount.java index 536aa9f86..b131637e4 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/RecurringDepositAccount.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/RecurringDepositAccount.java @@ -77,7 +77,7 @@ public class RecurringDepositAccount extends SavingsAccount { @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "account", orphanRemoval = true) - private List depositScheduleInstallments = new ArrayList(); + private List depositScheduleInstallments = new ArrayList<>(); protected RecurringDepositAccount() { // @@ -153,7 +153,7 @@ public class RecurringDepositAccount extends SavingsAccount { @Override public void modifyApplication(final JsonCommand command, final Map actualChanges) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME + SavingsApiConstants.modifyApplicationAction); super.modifyApplication(command, actualChanges, baseDataValidator); @@ -224,7 +224,7 @@ public class RecurringDepositAccount extends SavingsAccount { } public void updateMaturityStatus() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME + SavingsApiConstants.updateMaturityDetailsAction); @@ -286,7 +286,7 @@ public class RecurringDepositAccount extends SavingsAccount { final List postingPeriodIntervals = this.savingsHelper.determineInterestPostingPeriods(depositStartDate(), maturityDate, postingPeriodType); - final List allPostingPeriods = new ArrayList(); + final List allPostingPeriods = new ArrayList<>(); Money periodStartingBalance = Money.zero(currency); @@ -312,7 +312,7 @@ public class RecurringDepositAccount extends SavingsAccount { } private List generateIncludingFutureTransactions(final LocalDate depositEndDate) { - List allTransactions = new ArrayList(); + List allTransactions = new ArrayList<>(); // add existing transactions allTransactions.addAll(retreiveOrderedNonInterestPostingTransactions()); for (RecurringDepositScheduleInstallment installment : depositScheduleInstallments()) { @@ -385,7 +385,7 @@ public class RecurringDepositAccount extends SavingsAccount { public void prematureClosure(final AppUser currentUser, final JsonCommand command, final LocalDate tenantsTodayDate, final Map actualChanges) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME + DepositsApiConstants.preMatureCloseAction); @@ -490,7 +490,7 @@ public class RecurringDepositAccount extends SavingsAccount { public void close(final AppUser currentUser, final JsonCommand command, final LocalDate tenantsTodayDate, final Map actualChanges) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME + SavingsApiConstants.closeAction); @@ -717,7 +717,7 @@ public class RecurringDepositAccount extends SavingsAccount { final Map actualChanges = super.activate(currentUser, command, tenantsTodayDate); if (accountTermAndPreClosure.isAfterExpectedFirstDepositDate(getActivationLocalDate())) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME); final DateTimeFormatter formatter = DateTimeFormat.forPattern(command.dateFormat()).withLocale(command.extractLocale()); @@ -731,7 +731,7 @@ public class RecurringDepositAccount extends SavingsAccount { } protected List sortTransactions(final List transactions) { - final List listOfTransactionsSorted = new ArrayList(); + final List listOfTransactionsSorted = new ArrayList<>(); listOfTransactionsSorted.addAll(transactions); final SavingsAccountTransactionComparator transactionComparator = new SavingsAccountTransactionComparator(); @@ -748,7 +748,7 @@ public class RecurringDepositAccount extends SavingsAccount { "error.msg.recurring.deposit.account.transaction.account.is.matured", defaultUserMessage, "transactionDate", transactionDTO.getTransactionDate().toString(transactionDTO.getFormatter())); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); dataValidationErrors.add(error); throw new PlatformApiDataValidationException(dataValidationErrors); @@ -760,7 +760,7 @@ public class RecurringDepositAccount extends SavingsAccount { "error.msg.recurring.deposit.account.transaction.date.is.after.account.maturity.date", defaultUserMessage, "transactionDate", transactionDTO.getTransactionDate().toString(transactionDTO.getFormatter())); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); dataValidationErrors.add(error); throw new PlatformApiDataValidationException(dataValidationErrors); @@ -772,7 +772,7 @@ public class RecurringDepositAccount extends SavingsAccount { "error.msg.recurring.deposit.account.transaction.date.is.before.account.activation.or.deposit.date", defaultUserMessage, "transactionDate", transactionDTO.getTransactionDate().toString(transactionDTO.getFormatter())); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); dataValidationErrors.add(error); throw new PlatformApiDataValidationException(dataValidationErrors); @@ -816,7 +816,7 @@ public class RecurringDepositAccount extends SavingsAccount { private List retreiveOrderedDepositTransactions() { final List listOfTransactionsSorted = retreiveListOfTransactions(); - final List orderedDepositTransactions = new ArrayList(); + final List orderedDepositTransactions = new ArrayList<>(); for (final SavingsAccountTransaction transaction : listOfTransactionsSorted) { if (transaction.isDepositAndNotReversed()) { @@ -869,7 +869,7 @@ public class RecurringDepositAccount extends SavingsAccount { } public void validateDomainRules() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME); validateDomainRules(baseDataValidator); @@ -932,7 +932,7 @@ public class RecurringDepositAccount extends SavingsAccount { } public void validateApplicableInterestRate() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(RECURRING_DEPOSIT_ACCOUNT_RESOURCE_NAME); @@ -1068,7 +1068,7 @@ public class RecurringDepositAccount extends SavingsAccount { private List depositScheduleInstallments() { if (this.depositScheduleInstallments == null) { - this.depositScheduleInstallments = new ArrayList(); + this.depositScheduleInstallments = new ArrayList<>(); } return this.depositScheduleInstallments; } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/RecurringDepositProduct.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/RecurringDepositProduct.java index 2a5f09d24..c5ea40bb7 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/RecurringDepositProduct.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/RecurringDepositProduct.java @@ -85,9 +85,9 @@ public class RecurringDepositProduct extends FixedDepositProduct { @Override public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(10); + final Map actualChanges = new LinkedHashMap<>(10); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(RECURRING_DEPOSIT_PRODUCT_RESOURCE_NAME); @@ -102,7 +102,7 @@ public class RecurringDepositProduct extends FixedDepositProduct { @Override protected Map update(final JsonCommand command, final DataValidatorBuilder baseDataValidator) { - final Map actualChanges = new LinkedHashMap(10); + final Map actualChanges = new LinkedHashMap<>(10); actualChanges.putAll(super.update(command, baseDataValidator)); @@ -123,7 +123,7 @@ public class RecurringDepositProduct extends FixedDepositProduct { @Override public void validateDomainRules() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(RECURRING_DEPOSIT_PRODUCT_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccount.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccount.java index 493c30ec3..fcb0581d6 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccount.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccount.java @@ -245,11 +245,11 @@ public class SavingsAccount extends AbstractPersistable { @OrderBy(value = "dateOf, createdDate, id") @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "savingsAccount", orphanRemoval = true) - protected final List transactions = new ArrayList(); + protected final List transactions = new ArrayList<>(); @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "savingsAccount", orphanRemoval = true) - protected Set charges = new HashSet(); + protected Set charges = new HashSet<>(); @Transient protected boolean accountNumberRequiresAutoGeneration = false; @@ -480,7 +480,7 @@ public class SavingsAccount extends AbstractPersistable { final List postingPeriodIntervals = this.savingsHelper.determineInterestPostingPeriods(getActivationLocalDate(), upToInterestCalculationDate, postingPeriodType); - final List allPostingPeriods = new ArrayList(); + final List allPostingPeriods = new ArrayList<>(); Money periodStartingBalance = Money.zero(this.currency); @@ -516,7 +516,7 @@ public class SavingsAccount extends AbstractPersistable { protected List retreiveOrderedNonInterestPostingTransactions() { final List listOfTransactionsSorted = retreiveListOfTransactions(); - final List orderedNonInterestPostingTransactions = new ArrayList(); + final List orderedNonInterestPostingTransactions = new ArrayList<>(); for (final SavingsAccountTransaction transaction : listOfTransactionsSorted) { if (!transaction.isInterestPostingAndNotReversed() && transaction.isNotReversed()) { @@ -528,7 +528,7 @@ public class SavingsAccount extends AbstractPersistable { } protected List retreiveListOfTransactions() { - final List listOfTransactionsSorted = new ArrayList(); + final List listOfTransactionsSorted = new ArrayList<>(); listOfTransactionsSorted.addAll(this.transactions); final SavingsAccountTransactionComparator transactionComparator = new SavingsAccountTransactionComparator(); @@ -615,7 +615,7 @@ public class SavingsAccount extends AbstractPersistable { + ".transaction.account.is.not.active", defaultUserMessage, "transactionDate", transactionDTO.getTransactionDate() .toString(transactionDTO.getFormatter())); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); dataValidationErrors.add(error); throw new PlatformApiDataValidationException(dataValidationErrors); @@ -627,7 +627,7 @@ public class SavingsAccount extends AbstractPersistable { "error.msg." + resourceTypeName + ".transaction.in.the.future", defaultUserMessage, "transactionDate", transactionDTO .getTransactionDate().toString(transactionDTO.getFormatter())); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); dataValidationErrors.add(error); throw new PlatformApiDataValidationException(dataValidationErrors); @@ -640,7 +640,7 @@ public class SavingsAccount extends AbstractPersistable { final ApiParameterError error = ApiParameterError.parameterError("error.msg." + resourceTypeName + ".transaction.before.activation.date", defaultUserMessage, "transactionDate", defaultUserArgs); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); dataValidationErrors.add(error); throw new PlatformApiDataValidationException(dataValidationErrors); @@ -674,7 +674,7 @@ public class SavingsAccount extends AbstractPersistable { final ApiParameterError error = ApiParameterError.parameterError("error.msg.savingsaccount.transaction.account.is.not.active", defaultUserMessage, "transactionDate", transactionDTO.getTransactionDate().toString(transactionDTO.getFormatter())); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); dataValidationErrors.add(error); throw new PlatformApiDataValidationException(dataValidationErrors); @@ -685,7 +685,7 @@ public class SavingsAccount extends AbstractPersistable { final ApiParameterError error = ApiParameterError.parameterError("error.msg.savingsaccount.transaction.in.the.future", defaultUserMessage, "transactionDate", transactionDTO.getTransactionDate().toString(transactionDTO.getFormatter())); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); dataValidationErrors.add(error); throw new PlatformApiDataValidationException(dataValidationErrors); @@ -698,7 +698,7 @@ public class SavingsAccount extends AbstractPersistable { final ApiParameterError error = ApiParameterError.parameterError("error.msg.savingsaccount.transaction.before.activation.date", defaultUserMessage, "transactionDate", defaultUserArgs); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); dataValidationErrors.add(error); throw new PlatformApiDataValidationException(dataValidationErrors); @@ -712,7 +712,7 @@ public class SavingsAccount extends AbstractPersistable { transactionDTO.getTransactionDate().toString(transactionDTO.getFormatter()), getLockedInUntilLocalDate().toString(transactionDTO.getFormatter())); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); dataValidationErrors.add(error); throw new PlatformApiDataValidationException(dataValidationErrors); @@ -795,7 +795,7 @@ public class SavingsAccount extends AbstractPersistable { if (runningBalance.isLessThanZero()) { // - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(depositAccountType() .resourceName() + transactionAction); @@ -841,7 +841,7 @@ public class SavingsAccount extends AbstractPersistable { } public void modifyApplication(final JsonCommand command, final Map actualChanges) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME + SavingsApiConstants.modifyApplicationAction); this.modifyApplication(command, actualChanges, baseDataValidator); @@ -1030,7 +1030,7 @@ public class SavingsAccount extends AbstractPersistable { public Map deriveAccountingBridgeData(final CurrencyData currencyData, final Set existingTransactionIds, final Set existingReversedTransactionIds, boolean isAccountTransfer) { - final Map accountingBridgeData = new LinkedHashMap(); + final Map accountingBridgeData = new LinkedHashMap<>(); accountingBridgeData.put("savingsId", getId()); accountingBridgeData.put("savingsProductId", productId()); accountingBridgeData.put("currency", currencyData); @@ -1039,7 +1039,7 @@ public class SavingsAccount extends AbstractPersistable { accountingBridgeData.put("accrualBasedAccountingEnabled", isAccrualBasedAccountingEnabledOnSavingsProduct()); accountingBridgeData.put("isAccountTransfer", isAccountTransfer); - final List> newLoanTransactions = new ArrayList>(); + final List> newLoanTransactions = new ArrayList<>(); for (final SavingsAccountTransaction transaction : this.transactions) { if (transaction.isReversed() && !existingReversedTransactionIds.contains(transaction.getId())) { newLoanTransactions.add(transaction.toMapData(currencyData)); @@ -1054,7 +1054,7 @@ public class SavingsAccount extends AbstractPersistable { public Collection findExistingTransactionIds() { - final Collection ids = new ArrayList(); + final Collection ids = new ArrayList<>(); for (final SavingsAccountTransaction transaction : this.transactions) { ids.add(transaction.getId()); @@ -1065,7 +1065,7 @@ public class SavingsAccount extends AbstractPersistable { public Collection findExistingReversedTransactionIds() { - final Collection ids = new ArrayList(); + final Collection ids = new ArrayList<>(); for (final SavingsAccountTransaction transaction : this.transactions) { if (transaction.isReversed()) { @@ -1168,7 +1168,7 @@ public class SavingsAccount extends AbstractPersistable { final LocalDate submittedOn = getSubmittedOnLocalDate(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(resourceName + SavingsApiConstants.summitalAction); @@ -1218,9 +1218,9 @@ public class SavingsAccount extends AbstractPersistable { public Map approveApplication(final AppUser currentUser, final JsonCommand command, final LocalDate tenantsTodayDate) { - final Map actualChanges = new LinkedHashMap(); + final Map actualChanges = new LinkedHashMap<>(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME + SavingsApiConstants.approvalAction); @@ -1278,9 +1278,9 @@ public class SavingsAccount extends AbstractPersistable { } public Map undoApplicationApproval() { - final Map actualChanges = new LinkedHashMap(); + final Map actualChanges = new LinkedHashMap<>(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME + SavingsApiConstants.undoApprovalAction); @@ -1364,9 +1364,9 @@ public class SavingsAccount extends AbstractPersistable { public Map rejectApplication(final AppUser currentUser, final JsonCommand command, final LocalDate tenantsTodayDate) { - final Map actualChanges = new LinkedHashMap(); + final Map actualChanges = new LinkedHashMap<>(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME + SavingsApiConstants.rejectAction); @@ -1424,9 +1424,9 @@ public class SavingsAccount extends AbstractPersistable { public Map applicantWithdrawsFromApplication(final AppUser currentUser, final JsonCommand command, final LocalDate tenantsTodayDate) { - final Map actualChanges = new LinkedHashMap(); + final Map actualChanges = new LinkedHashMap<>(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME + SavingsApiConstants.withdrawnByApplicantAction); @@ -1483,9 +1483,9 @@ public class SavingsAccount extends AbstractPersistable { public Map activate(final AppUser currentUser, final JsonCommand command, final LocalDate tenantsTodayDate) { - final Map actualChanges = new LinkedHashMap(); + final Map actualChanges = new LinkedHashMap<>(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(depositAccountType() .resourceName() + SavingsApiConstants.activateAction); @@ -1617,9 +1617,9 @@ public class SavingsAccount extends AbstractPersistable { public Map close(final AppUser currentUser, final JsonCommand command, final LocalDate tenantsTodayDate) { - final Map actualChanges = new LinkedHashMap(); + final Map actualChanges = new LinkedHashMap<>(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME + SavingsApiConstants.closeAction); @@ -1751,7 +1751,7 @@ public class SavingsAccount extends AbstractPersistable { if (newSavingsAccountCharges == null) { return false; } if (this.charges == null) { - this.charges = new HashSet(); + this.charges = new HashSet<>(); } this.charges.clear(); this.charges.addAll(associateChargesWithThisSavingsAccount(newSavingsAccountCharges)); @@ -1764,7 +1764,7 @@ public class SavingsAccount extends AbstractPersistable { } public void removeCharge(final SavingsAccountCharge charge) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -1783,7 +1783,7 @@ public class SavingsAccount extends AbstractPersistable { public void waiveCharge(final Long savingsAccountChargeId) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -1821,7 +1821,7 @@ public class SavingsAccount extends AbstractPersistable { public void addCharge(final DateTimeFormatter formatter, final SavingsAccountCharge savingsAccountCharge, final Charge chargeDefinition) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -1908,7 +1908,7 @@ public class SavingsAccount extends AbstractPersistable { public void payCharge(final SavingsAccountCharge savingsAccountCharge, final BigDecimal amountPaid, final LocalDate transactionDate, final DateTimeFormatter formatter) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -2034,7 +2034,7 @@ public class SavingsAccount extends AbstractPersistable { public void validateAccountValuesWithProduct() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -2072,7 +2072,7 @@ public class SavingsAccount extends AbstractPersistable { } public void validateInterestPostingAndCompoundingPeriodTypes(final DataValidatorBuilder baseDataValidator) { - Map> postingtoCompoundMap = new HashMap>(); + Map> postingtoCompoundMap = new HashMap<>(); postingtoCompoundMap.put( SavingsPostingInterestPeriodType.MONTHLY, Arrays.asList(new SavingsCompoundingInterestPeriodType[] { SavingsCompoundingInterestPeriodType.DAILY, diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountCharge.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountCharge.java index 021a7e476..1a898e6ed 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountCharge.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountCharge.java @@ -403,7 +403,7 @@ public class SavingsAccountCharge extends AbstractPersistable { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(7); + final Map actualChanges = new LinkedHashMap<>(7); final String dateFormatAsInput = command.dateFormat(); final String localeAsInput = command.locale(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountChargeAssembler.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountChargeAssembler.java index fdbd3c420..81dc1ff0a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountChargeAssembler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountChargeAssembler.java @@ -59,7 +59,7 @@ public class SavingsAccountChargeAssembler { public Set fromParsedJson(final JsonElement element, final String productCurrencyCode) { - final Set savingsAccountCharges = new HashSet(); + final Set savingsAccountCharges = new HashSet<>(); if (element.isJsonObject()) { final JsonObject topLevelJsonElement = element.getAsJsonObject(); @@ -130,7 +130,7 @@ public class SavingsAccountChargeAssembler { public Set fromSavingsProduct(final SavingsProduct savingsProduct) { - final Set savingsAccountCharges = new HashSet(); + final Set savingsAccountCharges = new HashSet<>(); Set productCharges = savingsProduct.charges(); for (Charge charge : productCharges) { ChargeTimeType chargeTime = null; @@ -154,7 +154,7 @@ public class SavingsAccountChargeAssembler { } private void validateSavingsCharges(final Set charges, final String productCurrencyCode) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME); boolean isOneWithdrawalPresent = false; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountDomainServiceJpa.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountDomainServiceJpa.java index 7a818ed23..fe0c6472d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountDomainServiceJpa.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountDomainServiceJpa.java @@ -53,8 +53,8 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi if (isRegularTransaction && !account.allowWithdrawal()) { throw new DepositAccountTransactionNotAllowedException(account.getId(), "withdraw", account.depositAccountType()); } - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); final SavingsAccountTransactionDTO transactionDTO = new SavingsAccountTransactionDTO(fmt, transactionDate, transactionAmount, paymentDetail, new Date()); @@ -87,8 +87,8 @@ public class SavingsAccountDomainServiceJpa implements SavingsAccountDomainServi "deposit", account.depositAccountType()); } boolean isInterestTransfer = false; - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); final SavingsAccountTransactionDTO transactionDTO = new SavingsAccountTransactionDTO(fmt, transactionDate, transactionAmount, paymentDetail, new Date()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountTransaction.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountTransaction.java index ce0b09ae3..116e90070 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountTransaction.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsAccountTransaction.java @@ -88,7 +88,7 @@ public final class SavingsAccountTransaction extends AbstractPersistable { @LazyCollection(LazyCollectionOption.FALSE) @OneToMany(cascade = CascadeType.ALL, mappedBy = "savingsAccountTransaction", orphanRemoval = true) - private final Set savingsAccountChargesPaid = new HashSet(); + private final Set savingsAccountChargesPaid = new HashSet<>(); @Column(name = "overdraft_amount_derived", scale = 6, precision = 19, nullable = true) private BigDecimal overdraftAmount; @@ -335,7 +335,7 @@ public final class SavingsAccountTransaction extends AbstractPersistable { } public Map toMapData(final CurrencyData currencyData) { - final Map thisTransactionData = new LinkedHashMap(); + final Map thisTransactionData = new LinkedHashMap<>(); final SavingsAccountTransactionEnumData transactionType = SavingsEnumerations.transactionType(this.typeOf); @@ -358,9 +358,9 @@ public final class SavingsAccountTransaction extends AbstractPersistable { * single charge too) ***/ if (!this.savingsAccountChargesPaid.isEmpty()) { - final List> savingsChargesPaidData = new ArrayList>(); + final List> savingsChargesPaidData = new ArrayList<>(); for (final SavingsAccountChargePaidBy chargePaidBy : this.savingsAccountChargesPaid) { - final Map savingChargePaidData = new LinkedHashMap(); + final Map savingChargePaidData = new LinkedHashMap<>(); savingChargePaidData.put("chargeId", chargePaidBy.getSavingsAccountCharge().getCharge().getId()); savingChargePaidData.put("isPenalty", chargePaidBy.getSavingsAccountCharge().getCharge().isPenalty()); savingChargePaidData.put("savingsChargeId", chargePaidBy.getSavingsAccountCharge().getId()); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsHelper.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsHelper.java index 656955661..6fb8c545a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsHelper.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsHelper.java @@ -27,7 +27,7 @@ public final class SavingsHelper { public List determineInterestPostingPeriods(final LocalDate activationLocalDate, final LocalDate interestPostingUpToDate, final SavingsPostingInterestPeriodType postingPeriodType) { - final List postingPeriods = new ArrayList(); + final List postingPeriods = new ArrayList<>(); LocalDate periodStartDate = activationLocalDate; LocalDate periodEndDate = periodStartDate; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsProduct.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsProduct.java index 62ea84add..494bf87e5 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsProduct.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsProduct.java @@ -69,9 +69,9 @@ import com.google.gson.JsonArray; @Entity @Table(name = "m_savings_product", uniqueConstraints = { @UniqueConstraint(columnNames = { "name" }, name = "sp_unq_name"), - @UniqueConstraint(columnNames = { "short_name" }, name = "sp_unq_short_name")}) + @UniqueConstraint(columnNames = { "short_name" }, name = "sp_unq_short_name") }) @Inheritance -@DiscriminatorColumn(name="deposit_type_enum", discriminatorType=DiscriminatorType.INTEGER) +@DiscriminatorColumn(name = "deposit_type_enum", discriminatorType = DiscriminatorType.INTEGER) @DiscriminatorValue("100") public class SavingsProduct extends AbstractPersistable { @@ -167,8 +167,8 @@ public class SavingsProduct extends AbstractPersistable { this.description = null; } - protected SavingsProduct(final String name, final String shortName, final String description, final MonetaryCurrency currency, final BigDecimal interestRate, - final SavingsCompoundingInterestPeriodType interestCompoundingPeriodType, + protected SavingsProduct(final String name, final String shortName, final String description, final MonetaryCurrency currency, + final BigDecimal interestRate, final SavingsCompoundingInterestPeriodType interestCompoundingPeriodType, final SavingsPostingInterestPeriodType interestPostingPeriodType, final SavingsInterestCalculationType interestCalculationType, final SavingsInterestCalculationDaysInYearType interestCalculationDaysInYearType, final BigDecimal minRequiredOpeningBalance, final Integer lockinPeriodFrequency, final SavingsPeriodFrequencyType lockinPeriodFrequencyType, @@ -252,7 +252,7 @@ public class SavingsProduct extends AbstractPersistable { public Map update(final JsonCommand command) { - final Map actualChanges = new LinkedHashMap(10); + final Map actualChanges = new LinkedHashMap<>(10); final String localeAsInput = command.locale(); @@ -401,7 +401,7 @@ public class SavingsProduct extends AbstractPersistable { private void validateLockinDetails() { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_PRODUCT_RESOURCE_NAME); @@ -450,8 +450,8 @@ public class SavingsProduct extends AbstractPersistable { boolean updated = false; if (this.charges != null) { - final Set currentSetOfCharges = new HashSet(this.charges); - final Set newSetOfCharges = new HashSet(newSavingsProductCharges); + final Set currentSetOfCharges = new HashSet<>(this.charges); + final Set newSetOfCharges = new HashSet<>(newSavingsProductCharges); if (!(currentSetOfCharges.equals(newSetOfCharges))) { updated = true; @@ -479,13 +479,13 @@ public class SavingsProduct extends AbstractPersistable { public Set charges() { return this.charges; } - - public InterestRateChart applicableChart(@SuppressWarnings("unused") final LocalDate target){ + + public InterestRateChart applicableChart(@SuppressWarnings("unused") final LocalDate target) { return null; } - + public InterestRateChart findChart(@SuppressWarnings("unused") Long chartId) { return null; } - + } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsProductAssembler.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsProductAssembler.java index da1473147..c57f57592 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsProductAssembler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsProductAssembler.java @@ -130,7 +130,7 @@ public class SavingsProductAssembler { public Set assembleListOfSavingsProductCharges(final JsonCommand command, final String savingsProductCurrencyCode) { - final Set charges = new HashSet(); + final Set charges = new HashSet<>(); if (command.parameterExists(chargesParamName)) { final JsonArray chargesArray = command.arrayOfParameterNamed(chargesParamName); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsProductChargeAssembler.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsProductChargeAssembler.java index 40edeaca2..4965627e1 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsProductChargeAssembler.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/SavingsProductChargeAssembler.java @@ -52,7 +52,7 @@ public class SavingsProductChargeAssembler { public Set fromParsedJson(final JsonElement element) { - final Set savingsAccountCharges = new HashSet(); + final Set savingsAccountCharges = new HashSet<>(); if (element.isJsonObject()) { final JsonObject topLevelJsonElement = element.getAsJsonObject(); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/AnnualCompoundingPeriod.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/AnnualCompoundingPeriod.java index d2c4df42e..9967fd856 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/AnnualCompoundingPeriod.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/AnnualCompoundingPeriod.java @@ -17,9 +17,11 @@ public class AnnualCompoundingPeriod implements CompoundingPeriod { private final LocalDateInterval periodInterval; private final List endOfDayBalances; - public static AnnualCompoundingPeriod create(final LocalDateInterval periodInterval, final List allEndOfDayBalances, final LocalDate upToInterestCalculationDate) { + public static AnnualCompoundingPeriod create(final LocalDateInterval periodInterval, final List allEndOfDayBalances, + final LocalDate upToInterestCalculationDate) { - final List endOfDayBalancesWithinPeriod = endOfDayBalancesWithinPeriodInterval(periodInterval, allEndOfDayBalances, upToInterestCalculationDate); + final List endOfDayBalancesWithinPeriod = endOfDayBalancesWithinPeriodInterval(periodInterval, + allEndOfDayBalances, upToInterestCalculationDate); return new AnnualCompoundingPeriod(periodInterval, endOfDayBalancesWithinPeriod); } @@ -104,19 +106,19 @@ public class AnnualCompoundingPeriod implements CompoundingPeriod { case MONTHLY: interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear); break; - case QUATERLY: - interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear); - break; + case QUATERLY: + interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear); + break; // case WEEKLY: // break; // case BIWEEKLY: // break; - case BI_ANNUAL: - interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear); - break; - case ANNUAL: - interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear); - break; + case BI_ANNUAL: + interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear); + break; + case ANNUAL: + interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear); + break; // case NO_COMPOUNDING_SIMPLE_INTEREST: // break; case INVALID: @@ -131,7 +133,7 @@ public class AnnualCompoundingPeriod implements CompoundingPeriod { private static List endOfDayBalancesWithinPeriodInterval(final LocalDateInterval compoundingPeriodInterval, final List allEndOfDayBalances, final LocalDate upToInterestCalculationDate) { - final List endOfDayBalancesForPeriodInterval = new ArrayList(); + final List endOfDayBalancesForPeriodInterval = new ArrayList<>(); for (final EndOfDayBalance endOfDayBalance : allEndOfDayBalances) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/BiAnnualCompoundingPeriod.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/BiAnnualCompoundingPeriod.java index 98c030d7e..1147ebb63 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/BiAnnualCompoundingPeriod.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/BiAnnualCompoundingPeriod.java @@ -17,9 +17,11 @@ public class BiAnnualCompoundingPeriod implements CompoundingPeriod { private final LocalDateInterval periodInterval; private final List endOfDayBalances; - public static BiAnnualCompoundingPeriod create(final LocalDateInterval periodInterval, final List allEndOfDayBalances, final LocalDate upToInterestCalculationDate) { + public static BiAnnualCompoundingPeriod create(final LocalDateInterval periodInterval, final List allEndOfDayBalances, + final LocalDate upToInterestCalculationDate) { - final List endOfDayBalancesWithinPeriod = endOfDayBalancesWithinPeriodInterval(periodInterval, allEndOfDayBalances, upToInterestCalculationDate); + final List endOfDayBalancesWithinPeriod = endOfDayBalancesWithinPeriodInterval(periodInterval, + allEndOfDayBalances, upToInterestCalculationDate); return new BiAnnualCompoundingPeriod(periodInterval, endOfDayBalancesWithinPeriod); } @@ -104,19 +106,19 @@ public class BiAnnualCompoundingPeriod implements CompoundingPeriod { case MONTHLY: interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear); break; - case QUATERLY: - interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear); - break; + case QUATERLY: + interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear); + break; // case WEEKLY: // break; // case BIWEEKLY: // break; - case BI_ANNUAL: - interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear); - break; - case ANNUAL: - interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear); - break; + case BI_ANNUAL: + interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear); + break; + case ANNUAL: + interestOnBalanceUnrounded = balance.calculateInterestOnBalance(interestToCompound, interestRateAsFraction, daysInYear); + break; // case NO_COMPOUNDING_SIMPLE_INTEREST: // break; case INVALID: @@ -131,7 +133,7 @@ public class BiAnnualCompoundingPeriod implements CompoundingPeriod { private static List endOfDayBalancesWithinPeriodInterval(final LocalDateInterval compoundingPeriodInterval, final List allEndOfDayBalances, final LocalDate upToInterestCalculationDate) { - final List endOfDayBalancesForPeriodInterval = new ArrayList(); + final List endOfDayBalancesForPeriodInterval = new ArrayList<>(); for (final EndOfDayBalance endOfDayBalance : allEndOfDayBalances) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/DailyCompoundingPeriod.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/DailyCompoundingPeriod.java index 4052ea8fe..83913c09e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/DailyCompoundingPeriod.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/DailyCompoundingPeriod.java @@ -16,9 +16,11 @@ public class DailyCompoundingPeriod implements CompoundingPeriod { private final LocalDateInterval periodInterval; private final List endOfDayBalances; - public static DailyCompoundingPeriod create(final LocalDateInterval periodInterval, final List allEndOfDayBalances, final LocalDate upToInterestCalculationDate) { + public static DailyCompoundingPeriod create(final LocalDateInterval periodInterval, final List allEndOfDayBalances, + final LocalDate upToInterestCalculationDate) { - final List endOfDayBalancesWithinPeriod = endOfDayBalancesWithinPeriodInterval(periodInterval, allEndOfDayBalances, upToInterestCalculationDate); + final List endOfDayBalancesWithinPeriod = endOfDayBalancesWithinPeriodInterval(periodInterval, + allEndOfDayBalances, upToInterestCalculationDate); return new DailyCompoundingPeriod(periodInterval, endOfDayBalancesWithinPeriod); } @@ -26,7 +28,7 @@ public class DailyCompoundingPeriod implements CompoundingPeriod { private static List endOfDayBalancesWithinPeriodInterval(final LocalDateInterval compoundingPeriodInterval, final List allEndOfDayBalances, final LocalDate upToInterestCalculationDate) { - final List endOfDayBalancesForPeriodInterval = new ArrayList(); + final List endOfDayBalancesForPeriodInterval = new ArrayList<>(); EndOfDayBalance cappedToPeriodEndDate = null; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/MonthlyCompoundingPeriod.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/MonthlyCompoundingPeriod.java index ce13ac38d..4af42b4d9 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/MonthlyCompoundingPeriod.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/MonthlyCompoundingPeriod.java @@ -17,9 +17,11 @@ public class MonthlyCompoundingPeriod implements CompoundingPeriod { private final LocalDateInterval periodInterval; private final List endOfDayBalances; - public static MonthlyCompoundingPeriod create(final LocalDateInterval periodInterval, final List allEndOfDayBalances, final LocalDate upToInterestCalculationDate) { + public static MonthlyCompoundingPeriod create(final LocalDateInterval periodInterval, final List allEndOfDayBalances, + final LocalDate upToInterestCalculationDate) { - final List endOfDayBalancesWithinPeriod = endOfDayBalancesWithinPeriodInterval(periodInterval, allEndOfDayBalances, upToInterestCalculationDate); + final List endOfDayBalancesWithinPeriod = endOfDayBalancesWithinPeriodInterval(periodInterval, + allEndOfDayBalances, upToInterestCalculationDate); return new MonthlyCompoundingPeriod(periodInterval, endOfDayBalancesWithinPeriod); } @@ -119,7 +121,7 @@ public class MonthlyCompoundingPeriod implements CompoundingPeriod { case INVALID: break; default: - break; + break; } interestEarned = interestEarned.add(interestOnBalanceUnrounded); @@ -130,7 +132,7 @@ public class MonthlyCompoundingPeriod implements CompoundingPeriod { private static List endOfDayBalancesWithinPeriodInterval(final LocalDateInterval compoundingPeriodInterval, final List allEndOfDayBalances, final LocalDate upToInterestCalculationDate) { - final List endOfDayBalancesForPeriodInterval = new ArrayList(); + final List endOfDayBalancesForPeriodInterval = new ArrayList<>(); for (final EndOfDayBalance endOfDayBalance : allEndOfDayBalances) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/PostingPeriod.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/PostingPeriod.java index 6a7c1e735..789cbf5d8 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/PostingPeriod.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/PostingPeriod.java @@ -44,7 +44,7 @@ public class PostingPeriod { final SavingsInterestCalculationType interestCalculationType, final BigDecimal interestRateAsFraction, final long daysInYear, final LocalDate upToInterestCalculationDate, Collection interestPostTransactions, boolean isInterestTransfer) { - final List accountEndOfDayBalances = new ArrayList(); + final List accountEndOfDayBalances = new ArrayList<>(); boolean interestTransfered = false; Money openingDayBalance = periodStartingBalance; Money closeOfDayBalance = openingDayBalance; @@ -166,7 +166,7 @@ public class PostingPeriod { final SavingsCompoundingInterestPeriodType interestPeriodType, final List allEndOfDayBalances, final LocalDate upToInterestCalculationDate) { - final List compoundingPeriods = new ArrayList(); + final List compoundingPeriods = new ArrayList<>(); CompoundingPeriod compoundingPeriod = null; switch (interestPeriodType) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/QuarterlyCompoundingPeriod.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/QuarterlyCompoundingPeriod.java index 0c53c6f1e..903393aff 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/QuarterlyCompoundingPeriod.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/domain/interest/QuarterlyCompoundingPeriod.java @@ -131,7 +131,7 @@ public class QuarterlyCompoundingPeriod implements CompoundingPeriod { private static List endOfDayBalancesWithinPeriodInterval(final LocalDateInterval compoundingPeriodInterval, final List allEndOfDayBalances, final LocalDate upToInterestCalculationDate) { - final List endOfDayBalancesForPeriodInterval = new ArrayList(); + final List endOfDayBalancesForPeriodInterval = new ArrayList<>(); for (final EndOfDayBalance endOfDayBalance : allEndOfDayBalances) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositAccountInterestRateChartReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositAccountInterestRateChartReadPlatformServiceImpl.java index 9671f2e3f..d3b3db63a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositAccountInterestRateChartReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositAccountInterestRateChartReadPlatformServiceImpl.java @@ -88,13 +88,13 @@ public class DepositAccountInterestRateChartReadPlatformServiceImpl implements D @Override public DepositAccountInterestRateChartData retrieveWithTemplate(DepositAccountInterestRateChartData chartData) { - final List genderOptions = new ArrayList( + final List genderOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.GENDER)); - final List clientTypeOptions = new ArrayList( + final List clientTypeOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.CLIENT_TYPE)); - final List clientClassificationOptions = new ArrayList( + final List clientClassificationOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.CLIENT_CLASSIFICATION)); return DepositAccountInterestRateChartData.withTemplate(chartData, @@ -120,13 +120,13 @@ public class DepositAccountInterestRateChartReadPlatformServiceImpl implements D @Override public DepositAccountInterestRateChartData template() { - final List genderOptions = new ArrayList( + final List genderOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.GENDER)); - final List clientTypeOptions = new ArrayList( + final List clientTypeOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.CLIENT_TYPE)); - final List clientClassificationOptions = new ArrayList( + final List clientClassificationOptions = new ArrayList<>( this.codeValueReadPlatformService.retrieveCodeValuesByCode(ClientApiConstants.CLIENT_CLASSIFICATION)); return DepositAccountInterestRateChartData.template(this.chartDropdownReadPlatformService.retrievePeriodTypeOptions(), this.interestIncentiveDropdownReadPlatformService.retrieveEntityTypeOptions(), @@ -178,7 +178,7 @@ public class DepositAccountInterestRateChartReadPlatformServiceImpl implements D @Override public Collection extractData(ResultSet rs) throws SQLException, DataAccessException { - List chartDataList = new ArrayList(); + List chartDataList = new ArrayList<>(); DepositAccountInterestRateChartData chartData = null; Long interestRateChartId = null; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositAccountReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositAccountReadPlatformServiceImpl.java index cfc71232f..ee570f64f 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositAccountReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositAccountReadPlatformServiceImpl.java @@ -89,7 +89,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead private final DepositAccountLookupMapper depositAccountLookupsRowMapper = new DepositAccountLookupMapper(); private final DepositAccountForMaturityMapper depositAccountForMaturityRowMapper = new DepositAccountForMaturityMapper(); private final PaginationParametersDataValidator paginationParametersDataValidator; - private final PaginationHelper paginationHelper = new PaginationHelper(); + private final PaginationHelper paginationHelper = new PaginationHelper<>(); private final SavingsAccountTransactionsMapper transactionsMapper; private final ClientReadPlatformService clientReadPlatformService; private final GroupReadPlatformService groupReadPlatformService; @@ -363,7 +363,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead .retrieveAllLoanOfficersInOfficeById(officeId); if (!CollectionUtils.isEmpty(fieldOfficersInBranch)) { - fieldOfficerOptions = new ArrayList(fieldOfficersInBranch); + fieldOfficerOptions = new ArrayList<>(fieldOfficersInBranch); } } else { // by default bring back all officers in selected @@ -374,7 +374,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead .retrieveAllStaffInOfficeAndItsParentOfficeHierarchy(officeId, restrictToLoanOfficersOnly); if (!CollectionUtils.isEmpty(loanOfficersInHierarchy)) { - fieldOfficerOptions = new ArrayList(loanOfficersInHierarchy); + fieldOfficerOptions = new ArrayList<>(loanOfficersInHierarchy); } } } @@ -1276,7 +1276,7 @@ public class DepositAccountReadPlatformServiceImpl implements DepositAccountRead } private Collection fromChargesToSavingsCharges(final Collection productCharges) { - final Collection savingsCharges = new ArrayList(); + final Collection savingsCharges = new ArrayList<>(); for (final ChargeData chargeData : productCharges) { final SavingsAccountChargeData savingsCharge = chargeData.toSavingsAccountChargeData(); savingsCharges.add(savingsCharge); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java index 16c2a4404..9ab59196e 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositAccountWritePlatformServiceJpaRepositoryImpl.java @@ -176,8 +176,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo DepositAccountType.FIXED_DEPOSIT); checkClientOrGroupActive(account); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); final Map changes = account.activate(user, command, DateUtils.getLocalDateOfTenant()); @@ -248,8 +248,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo DepositAccountType.RECURRING_DEPOSIT); checkClientOrGroupActive(account); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); final Map changes = account.activate(user, command, DateUtils.getLocalDateOfTenant()); @@ -349,7 +349,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo final LocalDate transactionDate = command.localDateValueOfParameterNamed("transactionDate"); final BigDecimal transactionAmount = command.bigDecimalValueOfParameterNamed("transactionAmount"); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes); final SavingsAccountTransaction deposit = this.depositAccountDomainService.handleRDDeposit(account, fmt, transactionDate, transactionAmount, paymentDetail, isRegularTransaction); @@ -383,7 +383,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo final Locale locale = command.extractLocale(); final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes); final SavingsAccount account = this.depositAccountAssembler.assembleFrom(savingsId, depositAccountType); @@ -445,8 +445,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo @Transactional private void postInterest(final SavingsAccount account) { - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); final LocalDate today = DateUtils.getLocalDateOfTenant(); final MathContext mc = new MathContext(10, RoundingMode.HALF_EVEN); @@ -490,8 +490,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo final RecurringDepositAccount account = (RecurringDepositAccount) this.depositAccountAssembler.assembleFrom(savingsId, DepositAccountType.RECURRING_DEPOSIT); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); final SavingsAccountTransaction savingsAccountTransaction = this.savingsAccountTransactionRepository @@ -573,15 +573,15 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo if (account.isNotActive()) { throwValidationForActiveStatus(SavingsApiConstants.adjustTransactionAction); } - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); final Locale locale = command.extractLocale(); final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale); final LocalDate transactionDate = command.localDateValueOfParameterNamed(SavingsApiConstants.transactionDateParamName); final BigDecimal transactionAmount = command.bigDecimalValueOfParameterNamed(SavingsApiConstants.transactionAmountParamName); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes); final MathContext mc = new MathContext(10, RoundingMode.HALF_EVEN); @@ -631,7 +631,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo * */ private void throwValidationForActiveStatus(final String actionName) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME + actionName); baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("account.is.not.active"); @@ -655,7 +655,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo final boolean isPreMatureClose = false; this.depositAccountTransactionDataValidator.validateClosing(command, DepositAccountType.FIXED_DEPOSIT, isPreMatureClose); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes); final FixedDepositAccount account = (FixedDepositAccount) this.depositAccountAssembler.assembleFrom(savingsId, @@ -689,7 +689,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo this.depositAccountTransactionDataValidator.validateClosing(command, DepositAccountType.RECURRING_DEPOSIT, false); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes); final RecurringDepositAccount account = (RecurringDepositAccount) this.depositAccountAssembler.assembleFrom(savingsId, @@ -723,7 +723,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo this.depositAccountTransactionDataValidator.validateClosing(command, DepositAccountType.FIXED_DEPOSIT, true); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes); final FixedDepositAccount account = (FixedDepositAccount) this.depositAccountAssembler.assembleFrom(savingsId, @@ -757,7 +757,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo this.depositAccountTransactionDataValidator.validateClosing(command, DepositAccountType.RECURRING_DEPOSIT, true); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes); final RecurringDepositAccount account = (RecurringDepositAccount) this.depositAccountAssembler.assembleFrom(savingsId, @@ -790,8 +790,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo final DepositAccountType depositAccountType) { final SavingsAccount savingsAccount = this.depositAccountAssembler.assembleFrom(accountId, depositAccountType); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(savingsAccount, existingTransactionIds, existingReversedTransactionIds); final SavingsAccountTransaction newTransferTransaction = SavingsAccountTransaction.initiateTransfer(savingsAccount, @@ -815,8 +815,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo final DepositAccountType depositAccountType) { final SavingsAccount savingsAccount = this.depositAccountAssembler.assembleFrom(accountId, depositAccountType); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(savingsAccount, existingTransactionIds, existingReversedTransactionIds); final SavingsAccountTransaction withdrawtransferTransaction = SavingsAccountTransaction.withdrawTransfer(savingsAccount, @@ -847,8 +847,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo final Office acceptedInOffice, final Staff fieldOfficer, final DepositAccountType depositAccountType) { final SavingsAccount savingsAccount = this.depositAccountAssembler.assembleFrom(accountId, depositAccountType); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(savingsAccount, existingTransactionIds, existingReversedTransactionIds); final SavingsAccountTransaction acceptTransferTransaction = SavingsAccountTransaction.approveTransfer(savingsAccount, @@ -875,7 +875,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo public CommandProcessingResult addSavingsAccountCharge(final JsonCommand command, final DepositAccountType depositAccountType) { this.context.authenticatedUser(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -931,7 +931,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo this.context.authenticatedUser(); this.savingsAccountChargeDataValidator.validateUpdate(command.json()); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -993,8 +993,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo final SavingsAccount account = savingsAccountCharge.savingsAccount(); this.depositAccountAssembler.assignSavingAccountHelpers(account); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); account.waiveCharge(savingsAccountChargeId); @@ -1060,7 +1060,7 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo final SavingsAccountCharge savingsAccountCharge = this.savingsAccountChargeRepository.findOneWithNotFoundDetection( savingsAccountChargeId, savingsAccountId); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -1112,8 +1112,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo // Get Savings account from savings charge final SavingsAccount account = savingsAccountCharge.savingsAccount(); this.depositAccountAssembler.assignSavingAccountHelpers(account); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); account.payCharge(savingsAccountCharge, amountPaid, transactionDate, formatter); boolean isInterestTransfer = false; @@ -1137,8 +1137,8 @@ public class DepositAccountWritePlatformServiceJpaRepositoryImpl implements Depo @Override public void updateMaturityDetails(Long depositAccountId, DepositAccountType depositAccountType) { final SavingsAccount account = this.depositAccountAssembler.assembleFrom(depositAccountId, depositAccountType); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); if (depositAccountType.isFixedDeposit()) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl.java index 92dced3eb..0209cf64b 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl.java @@ -319,7 +319,7 @@ public class DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl impl try { this.depositAccountDataValidator.validateFixedDepositForUpdate(command.json()); - final Map changes = new LinkedHashMap(20); + final Map changes = new LinkedHashMap<>(20); final FixedDepositAccount account = (FixedDepositAccount) this.depositAccountAssembler.assembleFrom(accountId, DepositAccountType.FIXED_DEPOSIT); @@ -356,7 +356,7 @@ public class DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl impl try { this.depositAccountDataValidator.validateRecurringDepositForUpdate(command.json()); - final Map changes = new LinkedHashMap(20); + final Map changes = new LinkedHashMap<>(20); final RecurringDepositAccount account = (RecurringDepositAccount) this.depositAccountAssembler.assembleFrom(accountId, DepositAccountType.RECURRING_DEPOSIT); @@ -521,7 +521,7 @@ public class DepositApplicationProcessWritePlatformServiceJpaRepositoryImpl impl checkClientOrGroupActive(account); if (account.isNotSubmittedAndPendingApproval()) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource(depositAccountType .resourceName() + DepositsApiConstants.deleteApplicationAction); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountApplicationTransitionApiJsonValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountApplicationTransitionApiJsonValidator.java index b570222ca..b7201d904 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountApplicationTransitionApiJsonValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountApplicationTransitionApiJsonValidator.java @@ -44,12 +44,12 @@ public final class SavingsAccountApplicationTransitionApiJsonValidator { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set disbursementParameters = new HashSet(Arrays.asList("approvedOnDate", "note", "locale", "dateFormat")); + final Set disbursementParameters = new HashSet<>(Arrays.asList("approvedOnDate", "note", "locale", "dateFormat")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, disbursementParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("savingsaccountapplication"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -66,12 +66,12 @@ public final class SavingsAccountApplicationTransitionApiJsonValidator { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set disbursementParameters = new HashSet(Arrays.asList("rejectedOnDate", "note", "locale", "dateFormat")); + final Set disbursementParameters = new HashSet<>(Arrays.asList("rejectedOnDate", "note", "locale", "dateFormat")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, disbursementParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("savingsaccountapplication"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -88,12 +88,12 @@ public final class SavingsAccountApplicationTransitionApiJsonValidator { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set disbursementParameters = new HashSet(Arrays.asList("withdrawnOnDate", "note", "locale", "dateFormat")); + final Set disbursementParameters = new HashSet<>(Arrays.asList("withdrawnOnDate", "note", "locale", "dateFormat")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, disbursementParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors).resource("savingsaccountapplication"); final JsonElement element = this.fromApiJsonHelper.parse(json); @@ -109,11 +109,11 @@ public final class SavingsAccountApplicationTransitionApiJsonValidator { public void validateForUndo(final String json) { if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); } - final Set undoSupportedParameters = new HashSet(Arrays.asList("note")); + final Set undoSupportedParameters = new HashSet<>(Arrays.asList("note")); final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, undoSupportedParameters); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource("savingsaccountapplication.undo"); final JsonElement element = this.fromApiJsonHelper.parse(json); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountReadPlatformServiceImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountReadPlatformServiceImpl.java index 08145051d..e0b17acb9 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountReadPlatformServiceImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountReadPlatformServiceImpl.java @@ -76,7 +76,7 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead // private final SavingsAccountAnnualFeeMapper annualFeeMapper; // pagination - private final PaginationHelper paginationHelper = new PaginationHelper(); + private final PaginationHelper paginationHelper = new PaginationHelper<>(); @Autowired public SavingsAccountReadPlatformServiceImpl(final PlatformSecurityContext context, final RoutingDataSource dataSource, @@ -522,7 +522,7 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead .retrieveAllLoanOfficersInOfficeById(officeId); if (!CollectionUtils.isEmpty(fieldOfficersInBranch)) { - fieldOfficerOptions = new ArrayList(fieldOfficersInBranch); + fieldOfficerOptions = new ArrayList<>(fieldOfficersInBranch); } } else { // by default bring back all officers in selected @@ -533,7 +533,7 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead .retrieveAllStaffInOfficeAndItsParentOfficeHierarchy(officeId, restrictToLoanOfficersOnly); if (!CollectionUtils.isEmpty(loanOfficersInHierarchy)) { - fieldOfficerOptions = new ArrayList(loanOfficersInHierarchy); + fieldOfficerOptions = new ArrayList<>(loanOfficersInHierarchy); } } } @@ -581,7 +581,7 @@ public class SavingsAccountReadPlatformServiceImpl implements SavingsAccountRead } private Collection fromChargesToSavingsCharges(final Collection productCharges) { - final Collection savingsCharges = new ArrayList(); + final Collection savingsCharges = new ArrayList<>(); for (final ChargeData chargeData : productCharges) { final SavingsAccountChargeData savingsCharge = chargeData.toSavingsAccountChargeData(); savingsCharges.add(savingsCharge); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java index c2dac4ee2..52c3c7f79 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsAccountWritePlatformServiceJpaRepositoryImpl.java @@ -147,8 +147,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId); checkClientOrGroupActive(account); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); final Map changes = account.activate(user, command, DateUtils.getLocalDateOfTenant()); if (!changes.isEmpty()) { @@ -203,7 +203,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi final LocalDate transactionDate = command.localDateValueOfParameterNamed("transactionDate"); final BigDecimal transactionAmount = command.bigDecimalValueOfParameterNamed("transactionAmount"); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes); boolean isAccountTransfer = false; boolean isRegularTransaction = true; @@ -237,7 +237,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi final Locale locale = command.extractLocale(); final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes); final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId); @@ -320,8 +320,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi @Transactional private void postInterest(final SavingsAccount account) { if (account.getNominalAnnualInterestRate().compareTo(BigDecimal.ZERO) == 1) { - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); final LocalDate today = DateUtils.getLocalDateOfTenant(); final MathContext mc = new MathContext(10, RoundingMode.HALF_EVEN); @@ -358,8 +358,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi final boolean allowAccountTransferModification) { final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); final SavingsAccountTransaction savingsAccountTransaction = this.savingsAccountTransactionRepository @@ -438,15 +438,15 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi if (!account.allowModify()) { throw new PlatformServiceUnavailableException( "error.msg.saving.account.transaction.update.not.allowed", "Savings account transaction:" + transactionId + " update not allowed for this savings type", transactionId); } - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); final Locale locale = command.extractLocale(); final DateTimeFormatter fmt = DateTimeFormat.forPattern(command.dateFormat()).withLocale(locale); final LocalDate transactionDate = command.localDateValueOfParameterNamed(SavingsApiConstants.transactionDateParamName); final BigDecimal transactionAmount = command.bigDecimalValueOfParameterNamed(SavingsApiConstants.transactionAmountParamName); - final Map changes = new LinkedHashMap(); + final Map changes = new LinkedHashMap<>(); final PaymentDetail paymentDetail = this.paymentDetailWritePlatformService.createAndPersistPaymentDetail(command, changes); final MathContext mc = new MathContext(10, RoundingMode.HALF_EVEN); @@ -493,7 +493,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi * */ private void throwValidationForActiveStatus(final String actionName) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME + actionName); baseDataValidator.reset().failWithCodeNoParameterAddedToErrorCode("account.is.not.active"); @@ -550,8 +550,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi public SavingsAccountTransaction initiateSavingsTransfer(final Long accountId, final LocalDate transferDate) { final SavingsAccount savingsAccount = this.savingAccountAssembler.assembleFrom(accountId); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(savingsAccount, existingTransactionIds, existingReversedTransactionIds); final SavingsAccountTransaction newTransferTransaction = SavingsAccountTransaction.initiateTransfer(savingsAccount, @@ -574,8 +574,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi public SavingsAccountTransaction withdrawSavingsTransfer(final Long accountId, final LocalDate transferDate) { final SavingsAccount savingsAccount = this.savingAccountAssembler.assembleFrom(accountId); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(savingsAccount, existingTransactionIds, existingReversedTransactionIds); final SavingsAccountTransaction withdrawtransferTransaction = SavingsAccountTransaction.withdrawTransfer(savingsAccount, @@ -606,8 +606,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi final Office acceptedInOffice, final Staff fieldOfficer) { final SavingsAccount savingsAccount = this.savingAccountAssembler.assembleFrom(accountId); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(savingsAccount, existingTransactionIds, existingReversedTransactionIds); final SavingsAccountTransaction acceptTransferTransaction = SavingsAccountTransaction.approveTransfer(savingsAccount, @@ -634,7 +634,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi public CommandProcessingResult addSavingsAccountCharge(final JsonCommand command) { this.context.authenticatedUser(); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -690,7 +690,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi this.context.authenticatedUser(); this.savingsAccountChargeDataValidator.validateUpdate(command.json()); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -751,8 +751,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi final SavingsAccount account = savingsAccountCharge.savingsAccount(); this.savingAccountAssembler.assignSavingAccountHelpers(account); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); account.waiveCharge(savingsAccountChargeId); @@ -817,7 +817,7 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi final SavingsAccountCharge savingsAccountCharge = this.savingsAccountChargeRepository.findOneWithNotFoundDetection( savingsAccountChargeId, savingsAccountId); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME); @@ -868,8 +868,8 @@ public class SavingsAccountWritePlatformServiceJpaRepositoryImpl implements Savi // Get Savings account from savings charge final SavingsAccount account = savingsAccountCharge.savingsAccount(); this.savingAccountAssembler.assignSavingAccountHelpers(account); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); updateExistingTransactionsDetails(account, existingTransactionIds, existingReversedTransactionIds); account.payCharge(savingsAccountCharge, amountPaid, transactionDate, formatter); boolean isInterestTransfer = false; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl.java index de59400e8..498be2f01 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl.java @@ -182,7 +182,7 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl try { this.savingsAccountDataValidator.validateForUpdate(command.json()); - final Map changes = new LinkedHashMap(20); + final Map changes = new LinkedHashMap<>(20); final SavingsAccount account = this.savingAccountAssembler.assembleFrom(savingsId); checkClientOrGroupActive(account); @@ -274,7 +274,7 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl checkClientOrGroupActive(account); if (account.isNotSubmittedAndPendingApproval()) { - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(SAVINGS_ACCOUNT_RESOURCE_NAME + SavingsApiConstants.deleteApplicationAction); @@ -460,8 +460,8 @@ public class SavingsApplicationProcessWritePlatformServiceJpaRepositoryImpl impl account.approveAndActivateApplication(savingsAccountDataDTO.getApplicationDate().toDate(), savingsAccountDataDTO.getAppliedBy()); Money amountForDeposit = account.activateWithBalance(); - final Set existingTransactionIds = new HashSet(); - final Set existingReversedTransactionIds = new HashSet(); + final Set existingTransactionIds = new HashSet<>(); + final Set existingReversedTransactionIds = new HashSet<>(); if (amountForDeposit.isGreaterThanZero()) { this.savingAccountRepository.save(account); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsEnumerations.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsEnumerations.java index 6a72b85ae..72d63d0b8 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsEnumerations.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/savings/service/SavingsEnumerations.java @@ -445,7 +445,7 @@ public class SavingsEnumerations { } public static List preClosurePenaltyInterestOnType(final PreClosurePenalInterestOnType[] types) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final PreClosurePenalInterestOnType type : types) { if (!type.isInvalid()) { optionDatas.add(preClosurePenaltyInterestOnType(type)); @@ -479,7 +479,7 @@ public class SavingsEnumerations { } public static List recurringDepositType(final RecurringDepositType[] types) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final RecurringDepositType type : types) { if (!type.isInvalid()) { optionDatas.add(recurringDepositType(type)); @@ -520,7 +520,7 @@ public class SavingsEnumerations { } public static List recurringDepositFrequencyType(final SavingsPeriodFrequencyType[] types) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final SavingsPeriodFrequencyType type : types) { if (!type.isInvalid()) { optionDatas.add(recurringDepositFrequencyType(type)); @@ -561,7 +561,7 @@ public class SavingsEnumerations { } public static List depositTermFrequencyType(final SavingsPeriodFrequencyType[] types) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final SavingsPeriodFrequencyType type : types) { if (!type.isInvalid()) { optionDatas.add(recurringDepositFrequencyType(type)); @@ -602,7 +602,7 @@ public class SavingsEnumerations { } public static List inMultiplesOfDepositTermFrequencyType(final SavingsPeriodFrequencyType[] types) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final SavingsPeriodFrequencyType type : types) { if (!type.isInvalid()) { optionDatas.add(recurringDepositFrequencyType(type)); @@ -638,7 +638,7 @@ public class SavingsEnumerations { } public static List depositType(final DepositAccountType[] types) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final DepositAccountType type : types) { if (!type.isInvalid()) { optionDatas.add(depositType(type)); @@ -679,7 +679,7 @@ public class SavingsEnumerations { } public static List depositPeriodFrequency(final SavingsPeriodFrequencyType[] types) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final SavingsPeriodFrequencyType type : types) { if (!type.isInvalid()) { optionDatas.add(recurringDepositFrequencyType(type)); @@ -712,7 +712,7 @@ public class SavingsEnumerations { } public static List depositAccountOnClosureType(final DepositAccountOnClosureType[] types) { - final List optionDatas = new ArrayList(); + final List optionDatas = new ArrayList<>(); for (final DepositAccountOnClosureType type : types) { if (!type.isInvalid()) { optionDatas.add(depositAccountOnClosureType(type)); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/SearchConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/SearchConstants.java index d6043a8a8..35e50dff2 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/SearchConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/SearchConstants.java @@ -20,7 +20,7 @@ public class SearchConstants { this.value = value; } - private static final Set values = new HashSet(); + private static final Set values = new HashSet<>(); static { for (final SEARCH_RESPONSE_PARAMETERS param : SEARCH_RESPONSE_PARAMETERS.values()) { values.add(param.value); @@ -50,7 +50,7 @@ public class SearchConstants { this.value = value; } - private static final Set values = new HashSet(); + private static final Set values = new HashSet<>(); static { for (final SEARCH_SUPPORTED_PARAMETERS param : SEARCH_SUPPORTED_PARAMETERS.values()) { values.add(param.value); @@ -80,7 +80,7 @@ public class SearchConstants { this.value = value; } - private static final Set values = new HashSet(); + private static final Set values = new HashSet<>(); static { for (final SEARCH_SUPPORTED_RESOURCES param : SEARCH_SUPPORTED_RESOURCES.values()) { values.add(param.value); @@ -110,7 +110,7 @@ public class SearchConstants { this.value = value; } - private static final Set values = new HashSet(); + private static final Set values = new HashSet<>(); static { for (final SEARCH_LOAN_DATE param : SEARCH_LOAN_DATE.values()) { values.add(param.value); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/data/AdHocQueryDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/data/AdHocQueryDataValidator.java index 8c6c217f2..2e6cd5cb5 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/data/AdHocQueryDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/data/AdHocQueryDataValidator.java @@ -40,7 +40,7 @@ public class AdHocQueryDataValidator { final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(AdHocQuerySearchConstants.AD_HOC_SEARCH_QUERY_RESOURCE_NAME); @@ -266,7 +266,7 @@ public class AdHocQueryDataValidator { } private List extractLongValuesList(List listTobeConverted) { - List tempList = new ArrayList(); + List tempList = new ArrayList<>(); for (String temp : listTobeConverted) { tempList.add(Long.valueOf(temp)); } diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/data/AdHocQuerySearchConditions.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/data/AdHocQuerySearchConditions.java index 12a8bee4f..85dafa847 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/data/AdHocQuerySearchConditions.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/data/AdHocQuerySearchConditions.java @@ -72,7 +72,7 @@ public class AdHocQuerySearchConditions { } private List getStatusVluesFromStatusCodes() { - List loanStatusValues = new ArrayList(); + List loanStatusValues = new ArrayList<>(); if (this.loanStatus != null) { for (String statusCode : this.loanStatus) { diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/data/AdHocQuerySearchConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/data/AdHocQuerySearchConstants.java index c452cf48d..76264c589 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/data/AdHocQuerySearchConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/search/data/AdHocQuerySearchConstants.java @@ -28,14 +28,14 @@ public interface AdHocQuerySearchConstants { public static final String maxOutstandingAmountParamName = "maxOutstandingAmount"; public static final String outstandingAmountParamName = "outstandingAmount"; - public static final Set AD_HOC_SEARCH_QUERY_REQUEST_DATA_PARAMETERS = new HashSet(Arrays.asList(loanStatusParamName, + public static final Set AD_HOC_SEARCH_QUERY_REQUEST_DATA_PARAMETERS = new HashSet<>(Arrays.asList(loanStatusParamName, loanProductsParamName, officesParamName, loanDateOptionParamName, loanFromDateParamName, loanToDateParamName, includeOutStandingAmountPercentageParamName, outStandingAmountPercentageConditionParamName, minOutStandingAmountPercentageParamName, maxOutStandingAmountPercentageParamName, outStandingAmountPercentageParamName, includeOutstandingAmountParamName, outstandingAmountConditionParamName, minOutstandingAmountParamName, maxOutstandingAmountParamName, outstandingAmountParamName, localeParamName, dateFormatParamName)); - public static final Set AD_HOC_SEARCH_QUERY_CONDITIONS = new HashSet( + public static final Set AD_HOC_SEARCH_QUERY_CONDITIONS = new HashSet<>( Arrays.asList("between", "<=", ">=", "<", ">", "=")); public static final Object[] loanDateOptions = { "approvalDate", "createdDate", "disbursalDate" }; diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/transfer/api/TransferApiConstants.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/transfer/api/TransferApiConstants.java index 7e962e1b2..084bf4895 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/transfer/api/TransferApiConstants.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/transfer/api/TransferApiConstants.java @@ -25,21 +25,21 @@ public class TransferApiConstants { public static final String destinationOfficeIdParamName = "destinationOfficeId"; public static final String note = "note"; - public static final Set TRANSFER_CLIENTS_BETWEEN_GROUPS_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set TRANSFER_CLIENTS_BETWEEN_GROUPS_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, destinationGroupIdParamName, clients, inheritDestinationGroupLoanOfficer, newStaffIdParamName, transferActiveLoans)); - public static final Set PROPOSE_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set PROPOSE_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, destinationOfficeIdParamName, transferActiveLoans, note)); - public static final Set ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet(Arrays.asList(newStaffIdParamName, + public static final Set ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(Arrays.asList(newStaffIdParamName, destinationGroupIdParamName, note)); - public static final Set PROPOSE_AND_ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet(Arrays.asList(localeParamName, + public static final Set PROPOSE_AND_ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(Arrays.asList(localeParamName, dateFormatParamName, destinationOfficeIdParamName, transferActiveLoans, newStaffIdParamName, destinationGroupIdParamName, note)); - public static final Set REJECT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet(Arrays.asList(note)); + public static final Set REJECT_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(Arrays.asList(note)); - public static final Set WITHDRAW_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet(Arrays.asList(note)); + public static final Set WITHDRAW_CLIENT_TRANSFER_DATA_PARAMETERS = new HashSet<>(Arrays.asList(note)); } \ No newline at end of file diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/transfer/data/TransfersDataValidator.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/transfer/data/TransfersDataValidator.java index 7067d8858..33d1f56e8 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/transfer/data/TransfersDataValidator.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/transfer/data/TransfersDataValidator.java @@ -48,7 +48,7 @@ public final class TransfersDataValidator { TransferApiConstants.TRANSFER_CLIENTS_BETWEEN_GROUPS_DATA_PARAMETERS); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(GroupingTypesApiConstants.GROUP_RESOURCE_NAME); @@ -81,7 +81,7 @@ public final class TransfersDataValidator { this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, TransferApiConstants.PROPOSE_CLIENT_TRANSFER_DATA_PARAMETERS); final JsonElement element = this.fromApiJsonHelper.parse(json); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(ClientApiConstants.CLIENT_RESOURCE_NAME); @@ -101,7 +101,7 @@ public final class TransfersDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, TransferApiConstants.ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(ClientApiConstants.CLIENT_RESOURCE_NAME); @@ -131,7 +131,7 @@ public final class TransfersDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, TransferApiConstants.PROPOSE_AND_ACCEPT_CLIENT_TRANSFER_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(ClientApiConstants.CLIENT_RESOURCE_NAME); @@ -165,7 +165,7 @@ public final class TransfersDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json, TransferApiConstants.REJECT_CLIENT_TRANSFER_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(ClientApiConstants.CLIENT_RESOURCE_NAME); @@ -182,7 +182,7 @@ public final class TransfersDataValidator { final Type typeOfMap = new TypeToken>() {}.getType(); this.fromApiJsonHelper .checkForUnsupportedParameters(typeOfMap, json, TransferApiConstants.WITHDRAW_CLIENT_TRANSFER_DATA_PARAMETERS); - final List dataValidationErrors = new ArrayList(); + final List dataValidationErrors = new ArrayList<>(); final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors) .resource(ClientApiConstants.CLIENT_RESOURCE_NAME); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/transfer/service/TransferWritePlatformServiceJpaRepositoryImpl.java b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/transfer/service/TransferWritePlatformServiceJpaRepositoryImpl.java index 8a8517ecb..596a0b69a 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/portfolio/transfer/service/TransferWritePlatformServiceJpaRepositoryImpl.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/portfolio/transfer/service/TransferWritePlatformServiceJpaRepositoryImpl.java @@ -455,7 +455,7 @@ public class TransferWritePlatformServiceJpaRepositoryImpl implements TransferWr private List assembleListOfClients(final JsonCommand command) { - final List clients = new ArrayList(); + final List clients = new ArrayList<>(); if (command.parameterExists(TransferApiConstants.clients)) { final JsonArray clientsArray = command.arrayOfParameterNamed(TransferApiConstants.clients); diff --git a/mifosng-provider/src/main/java/org/mifosplatform/template/api/TemplatesApiResource.java b/mifosng-provider/src/main/java/org/mifosplatform/template/api/TemplatesApiResource.java index 973305b13..f1f5c8d1d 100644 --- a/mifosng-provider/src/main/java/org/mifosplatform/template/api/TemplatesApiResource.java +++ b/mifosng-provider/src/main/java/org/mifosplatform/template/api/TemplatesApiResource.java @@ -51,8 +51,8 @@ import org.springframework.stereotype.Component; @Scope("singleton") public class TemplatesApiResource { - private final Set RESPONSE_TEMPLATES_DATA_PARAMETERS = new HashSet(Arrays.asList("id")); - private final Set RESPONSE_TEMPLATE_DATA_PARAMETERS = new HashSet(Arrays.asList("id", "entities", "types", "template")); + private final Set RESPONSE_TEMPLATES_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id")); + private final Set RESPONSE_TEMPLATE_DATA_PARAMETERS = new HashSet<>(Arrays.asList("id", "entities", "types", "template")); private final String RESOURCE_NAME_FOR_PERMISSION = "template"; private final PlatformSecurityContext context; @@ -65,8 +65,9 @@ public class TemplatesApiResource { @Autowired public TemplatesApiResource(final PlatformSecurityContext context, final DefaultToApiJsonSerializer