You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@fineract.apache.org by vo...@apache.org on 2020/01/19 18:58:33 UTC
[fineract] 01/03: convert all Java files from DOS to UNIX line
ending (FINERACT-821)
This is an automated email from the ASF dual-hosted git repository.
vorburger pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/fineract.git
commit 68006ae8f2af81c1d84c4fd26e57718c48fb5b59
Author: Michael Vorburger <mi...@vorburger.ch>
AuthorDate: Sun Jan 12 18:07:27 2020 +0100
convert all Java files from DOS to UNIX line ending (FINERACT-821)
find . -type f -name "*.java" -exec dos2unix '{}' ';'
---
.../fineract/integrationtests/WorkingDaysTest.java | 140 ++++++-------
.../integrationtests/common/WorkingDaysHelper.java | 156 +++++++-------
...validEntityTypeForImageManagementException.java | 62 +++---
.../workingdays/api/WorkingDaysApiConstants.java | 94 ++++-----
.../workingdays/api/WorkingDaysApiResource.java | 232 ++++++++++-----------
.../workingdays/data/WorkingDayValidator.java | 180 ++++++++--------
.../workingdays/data/WorkingDaysData.java | 136 ++++++------
.../domain/WorkingDaysEnumerations.java | 120 +++++------
.../handler/UpdateWorkingDaysCommandHandler.java | 92 ++++----
.../service/WorkingDaysReadPlatformService.java | 56 ++---
.../WorkingDaysReadPlatformServiceImpl.java | 214 +++++++++----------
.../handler/LoanRecoveryPaymentCommandHandler.java | 90 ++++----
.../loanschedule/data/OverdueLoanScheduleData.java | 170 +++++++--------
13 files changed, 871 insertions(+), 871 deletions(-)
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/WorkingDaysTest.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/WorkingDaysTest.java
index 38278b1..92e3d09 100755
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/WorkingDaysTest.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/WorkingDaysTest.java
@@ -1,70 +1,70 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.integrationtests;
-
-import static org.junit.Assert.assertEquals;
-
-import java.util.HashMap;
-import java.util.List;
-
-import org.apache.fineract.integrationtests.common.CommonConstants;
-import org.apache.fineract.integrationtests.common.Utils;
-import org.apache.fineract.integrationtests.common.WorkingDaysHelper;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import com.jayway.restassured.builder.RequestSpecBuilder;
-import com.jayway.restassured.builder.ResponseSpecBuilder;
-import com.jayway.restassured.http.ContentType;
-import com.jayway.restassured.specification.RequestSpecification;
-import com.jayway.restassured.specification.ResponseSpecification;
-
-@SuppressWarnings({ "rawtypes", "unchecked" })
-public class WorkingDaysTest {
-
- private ResponseSpecification responseSpec;
- private RequestSpecification requestSpec;
- private ResponseSpecification generalResponseSpec;
-
- @Before
- public void setUp() {
- Utils.initializeRESTAssured();
- this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
- this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
- this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
- this.generalResponseSpec = new ResponseSpecBuilder().build();
-
- }
-
- @Test
- public void updateWorkingDays() {
- HashMap response = (HashMap) WorkingDaysHelper.updateWorkingDays(requestSpec, responseSpec);
- Assert.assertNotNull(response.get("resourceId"));
- }
-
- @Test
- public void updateWorkingDaysWithWrongRecurrencePattern() {
- final List<HashMap> error = (List) WorkingDaysHelper.updateWorkingDaysWithWrongRecurrence(requestSpec, generalResponseSpec,
- CommonConstants.RESPONSE_ERROR);
- assertEquals("Verify wrong recurrence pattern error", "error.msg.recurring.rule.parsing.error",
- error.get(0).get("userMessageGlobalisationCode"));
- }
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.integrationtests;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.HashMap;
+import java.util.List;
+
+import org.apache.fineract.integrationtests.common.CommonConstants;
+import org.apache.fineract.integrationtests.common.Utils;
+import org.apache.fineract.integrationtests.common.WorkingDaysHelper;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import com.jayway.restassured.builder.RequestSpecBuilder;
+import com.jayway.restassured.builder.ResponseSpecBuilder;
+import com.jayway.restassured.http.ContentType;
+import com.jayway.restassured.specification.RequestSpecification;
+import com.jayway.restassured.specification.ResponseSpecification;
+
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class WorkingDaysTest {
+
+ private ResponseSpecification responseSpec;
+ private RequestSpecification requestSpec;
+ private ResponseSpecification generalResponseSpec;
+
+ @Before
+ public void setUp() {
+ Utils.initializeRESTAssured();
+ this.requestSpec = new RequestSpecBuilder().setContentType(ContentType.JSON).build();
+ this.requestSpec.header("Authorization", "Basic " + Utils.loginIntoServerAndGetBase64EncodedAuthenticationKey());
+ this.responseSpec = new ResponseSpecBuilder().expectStatusCode(200).build();
+ this.generalResponseSpec = new ResponseSpecBuilder().build();
+
+ }
+
+ @Test
+ public void updateWorkingDays() {
+ HashMap response = (HashMap) WorkingDaysHelper.updateWorkingDays(requestSpec, responseSpec);
+ Assert.assertNotNull(response.get("resourceId"));
+ }
+
+ @Test
+ public void updateWorkingDaysWithWrongRecurrencePattern() {
+ final List<HashMap> error = (List) WorkingDaysHelper.updateWorkingDaysWithWrongRecurrence(requestSpec, generalResponseSpec,
+ CommonConstants.RESPONSE_ERROR);
+ assertEquals("Verify wrong recurrence pattern error", "error.msg.recurring.rule.parsing.error",
+ error.get(0).get("userMessageGlobalisationCode"));
+ }
+
+}
diff --git a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/WorkingDaysHelper.java b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/WorkingDaysHelper.java
index 104272f..f352c9d 100755
--- a/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/WorkingDaysHelper.java
+++ b/fineract-provider/src/integrationTest/java/org/apache/fineract/integrationtests/common/WorkingDaysHelper.java
@@ -1,78 +1,78 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.integrationtests.common;
-
-import com.google.gson.Gson;
-import com.jayway.restassured.specification.RequestSpecification;
-import com.jayway.restassured.specification.ResponseSpecification;
-
-import java.util.HashMap;
-import java.util.Random;
-
-public class WorkingDaysHelper {
-
- private static final String WORKINGDAYS_URL = "/fineract-provider/api/v1/workingdays";
-
- public static Object updateWorkingDays(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
- final String UPDATE_WORKINGDAYS_URL = WORKINGDAYS_URL + "?" + Utils.TENANT_IDENTIFIER;
- System.out.println("---------------------------------UPDATE WORKINGDAY---------------------------------------------");
- return Utils.performServerPut(requestSpec, responseSpec, UPDATE_WORKINGDAYS_URL, updateWorkingDaysAsJson(), "");
- }
-
- public static Object updateWorkingDaysWithWrongRecurrence(final RequestSpecification requestSpec,
- final ResponseSpecification responseSpec, String jsonAttributeToGetback) {
- final String UPDATE_WORKINGDAYS_URL = WORKINGDAYS_URL + "?" + Utils.TENANT_IDENTIFIER;
- System.out
- .println("---------------------------------UPDATE WORKINGDAY WITH WRONG RECURRENCE-----------------------------------------");
- return Utils.performServerPut(requestSpec, responseSpec, UPDATE_WORKINGDAYS_URL, updateWorkingDayWithWrongRecur(),
- jsonAttributeToGetback);
- }
-
- public static String updateWorkingDaysAsJson() {
- final HashMap<String, Object> map = new HashMap<>();
- map.put("recurrence", "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,SA,SU");
- map.put("locale", "en");
- map.put("repaymentRescheduleType", new Random().nextInt(4) + 1);
- map.put("extendTermForDailyRepayments", false);
- System.out.println("map : " + map);
- return new Gson().toJson(map);
- }
-
- public static String updateWorkingDayWithWrongRecur() {
- final HashMap<String, Object> map = new HashMap<>();
- map.put("recurrence", "FREQ=WEEKLY;INTERVAL=1;BYDAY=MP,TI,TE,TH");
- map.put("locale", "en");
- map.put("repaymentRescheduleType", new Random().nextInt(4) + 1);
- map.put("extendTermForDailyRepayments", false);
- System.out.println("map : " + map);
- return new Gson().toJson(map);
- }
-
- public static int workingDaysId(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
- HashMap<String, Object> workingDays = getAllWorkingDays(requestSpec, responseSpec);
- return (int) workingDays.get("id");
- }
-
- public static HashMap<String, Object> getAllWorkingDays(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
-
- return Utils.performServerGet(requestSpec, responseSpec, WORKINGDAYS_URL + "?" + Utils.TENANT_IDENTIFIER, "");
-
- }
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.integrationtests.common;
+
+import com.google.gson.Gson;
+import com.jayway.restassured.specification.RequestSpecification;
+import com.jayway.restassured.specification.ResponseSpecification;
+
+import java.util.HashMap;
+import java.util.Random;
+
+public class WorkingDaysHelper {
+
+ private static final String WORKINGDAYS_URL = "/fineract-provider/api/v1/workingdays";
+
+ public static Object updateWorkingDays(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
+ final String UPDATE_WORKINGDAYS_URL = WORKINGDAYS_URL + "?" + Utils.TENANT_IDENTIFIER;
+ System.out.println("---------------------------------UPDATE WORKINGDAY---------------------------------------------");
+ return Utils.performServerPut(requestSpec, responseSpec, UPDATE_WORKINGDAYS_URL, updateWorkingDaysAsJson(), "");
+ }
+
+ public static Object updateWorkingDaysWithWrongRecurrence(final RequestSpecification requestSpec,
+ final ResponseSpecification responseSpec, String jsonAttributeToGetback) {
+ final String UPDATE_WORKINGDAYS_URL = WORKINGDAYS_URL + "?" + Utils.TENANT_IDENTIFIER;
+ System.out
+ .println("---------------------------------UPDATE WORKINGDAY WITH WRONG RECURRENCE-----------------------------------------");
+ return Utils.performServerPut(requestSpec, responseSpec, UPDATE_WORKINGDAYS_URL, updateWorkingDayWithWrongRecur(),
+ jsonAttributeToGetback);
+ }
+
+ public static String updateWorkingDaysAsJson() {
+ final HashMap<String, Object> map = new HashMap<>();
+ map.put("recurrence", "FREQ=WEEKLY;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR,SA,SU");
+ map.put("locale", "en");
+ map.put("repaymentRescheduleType", new Random().nextInt(4) + 1);
+ map.put("extendTermForDailyRepayments", false);
+ System.out.println("map : " + map);
+ return new Gson().toJson(map);
+ }
+
+ public static String updateWorkingDayWithWrongRecur() {
+ final HashMap<String, Object> map = new HashMap<>();
+ map.put("recurrence", "FREQ=WEEKLY;INTERVAL=1;BYDAY=MP,TI,TE,TH");
+ map.put("locale", "en");
+ map.put("repaymentRescheduleType", new Random().nextInt(4) + 1);
+ map.put("extendTermForDailyRepayments", false);
+ System.out.println("map : " + map);
+ return new Gson().toJson(map);
+ }
+
+ public static int workingDaysId(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
+ HashMap<String, Object> workingDays = getAllWorkingDays(requestSpec, responseSpec);
+ return (int) workingDays.get("id");
+ }
+
+ public static HashMap<String, Object> getAllWorkingDays(final RequestSpecification requestSpec, final ResponseSpecification responseSpec) {
+
+ return Utils.performServerGet(requestSpec, responseSpec, WORKINGDAYS_URL + "?" + Utils.TENANT_IDENTIFIER, "");
+
+ }
+
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/exception/InvalidEntityTypeForImageManagementException.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/exception/InvalidEntityTypeForImageManagementException.java
index 679a4a1..cd0e21e 100644
--- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/exception/InvalidEntityTypeForImageManagementException.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/documentmanagement/exception/InvalidEntityTypeForImageManagementException.java
@@ -1,31 +1,31 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.infrastructure.documentmanagement.exception;
-
-import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
-
-/**
- * Runtime exception for invalid image types
- */
-public class InvalidEntityTypeForImageManagementException extends AbstractPlatformResourceNotFoundException {
-
- public InvalidEntityTypeForImageManagementException(String imageType) {
- super("error.imagemanagement.entitytype.invalid", "Image Management is not support for the Entity Type: " + imageType);
- }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.infrastructure.documentmanagement.exception;
+
+import org.apache.fineract.infrastructure.core.exception.AbstractPlatformResourceNotFoundException;
+
+/**
+ * Runtime exception for invalid image types
+ */
+public class InvalidEntityTypeForImageManagementException extends AbstractPlatformResourceNotFoundException {
+
+ public InvalidEntityTypeForImageManagementException(String imageType) {
+ super("error.imagemanagement.entitytype.invalid", "Image Management is not support for the Entity Type: " + imageType);
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiConstants.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiConstants.java
index 5cfef90..d7357db 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiConstants.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiConstants.java
@@ -1,47 +1,47 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.organisation.workingdays.api;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-public class WorkingDaysApiConstants {
-
- public static final String WORKING_DAYS_RESOURCE_NAME = "workingdays";
-
- // request parameters
- public static final String recurrence = "recurrence";
-
- public static final String repayment_rescheduling_enum = "repaymentRescheduleType";
-
- public static final String idParamName = "id";
-
- public static final String rescheduleRepaymentTemplate = "rescheduleRepaymentTemplate";
- public static final String localeParamName = "locale";
- public static final String extendTermForDailyRepayments = "extendTermForDailyRepayments";
- public static final String extendTermForRepaymentsOnHolidays = "extendTermForRepaymentsOnHolidays";
-
- protected static final Set<String> WORKING_DAYS_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
- recurrence,repayment_rescheduling_enum,extendTermForDailyRepayments,extendTermForRepaymentsOnHolidays
- ));
-
- protected static final Set<String> WORKING_DAYS_TEMPLATE_PARAMETERS = new HashSet<>(Arrays.asList
- (rescheduleRepaymentTemplate));
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.organisation.workingdays.api;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+public class WorkingDaysApiConstants {
+
+ public static final String WORKING_DAYS_RESOURCE_NAME = "workingdays";
+
+ // request parameters
+ public static final String recurrence = "recurrence";
+
+ public static final String repayment_rescheduling_enum = "repaymentRescheduleType";
+
+ public static final String idParamName = "id";
+
+ public static final String rescheduleRepaymentTemplate = "rescheduleRepaymentTemplate";
+ public static final String localeParamName = "locale";
+ public static final String extendTermForDailyRepayments = "extendTermForDailyRepayments";
+ public static final String extendTermForRepaymentsOnHolidays = "extendTermForRepaymentsOnHolidays";
+
+ protected static final Set<String> WORKING_DAYS_RESPONSE_DATA_PARAMETERS = new HashSet<>(Arrays.asList(idParamName,
+ recurrence,repayment_rescheduling_enum,extendTermForDailyRepayments,extendTermForRepaymentsOnHolidays
+ ));
+
+ protected static final Set<String> WORKING_DAYS_TEMPLATE_PARAMETERS = new HashSet<>(Arrays.asList
+ (rescheduleRepaymentTemplate));
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResource.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResource.java
index 5955517..a1f6ca7 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResource.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/api/WorkingDaysApiResource.java
@@ -1,116 +1,116 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.organisation.workingdays.api;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.PUT;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.UriInfo;
-
-import io.swagger.annotations.*;
-import org.apache.fineract.commands.domain.CommandWrapper;
-import org.apache.fineract.commands.service.CommandWrapperBuilder;
-import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
-import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
-import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
-import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
-import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
-import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
-import org.apache.fineract.organisation.workingdays.data.WorkingDaysData;
-import org.apache.fineract.organisation.workingdays.service.WorkingDaysReadPlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.context.annotation.Scope;
-import org.springframework.stereotype.Component;
-
-@Path("/workingdays")
-@Component
-@Scope("singleton")
-@Api(tags = {"Working days"})
-@SwaggerDefinition(tags = {
- @Tag(name = "Working days", description = "The days of the week that are workdays.\n" + "\n" + "Rescheduling of repayments when it falls on a non-working is turned on /off by enable/disable reschedule-future-repayments parameter in Global configurations\n" + "\n" + "Allow transactions on non-working days is configurable by enabling/disbaling the allow-transactions-on-non_workingday parameter in Global configurations.")
-})
-public class WorkingDaysApiResource {
-
- private final DefaultToApiJsonSerializer<WorkingDaysData> toApiJsonSerializer;
- private final WorkingDaysReadPlatformService workingDaysReadPlatformService;
- private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
- private final PlatformSecurityContext context;
- private final ApiRequestParameterHelper apiRequestParameterHelper;
-
- @Autowired
- public WorkingDaysApiResource(DefaultToApiJsonSerializer<WorkingDaysData> toApiJsonSerializer,
- WorkingDaysReadPlatformService workingDaysReadPlatformService,
- PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, PlatformSecurityContext context,
- ApiRequestParameterHelper apiRequestParameterHelper) {
- this.toApiJsonSerializer = toApiJsonSerializer;
- this.workingDaysReadPlatformService = workingDaysReadPlatformService;
- this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
- this.context = context;
- this.apiRequestParameterHelper = apiRequestParameterHelper;
- }
-
- @GET
- @Consumes({ MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_JSON })
- @ApiOperation(value = "List Working days", notes = "Example Requests:\n" + "\n" + "workingdays")
- @ApiResponses({@ApiResponse(code = 200, message = "", response = WorkingDaysApiResourceSwagger.GetWorkingDaysResponse.class, responseContainer = "list")})
- public String retrieveAll(@Context final UriInfo uriInfo) {
- this.context.authenticatedUser().validateHasReadPermission(WorkingDaysApiConstants.WORKING_DAYS_RESOURCE_NAME);
- final WorkingDaysData workingDaysData = this.workingDaysReadPlatformService.retrieve();
-
- final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, workingDaysData);
- }
-
- @PUT
- @Consumes({ MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_JSON })
- @ApiOperation(value = "Update a Working Day", notes = "Mandatory Fields\n" + "recurrence,repaymentRescheduleType,extendTermForDailyRepayments,locale")
- @ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = WorkingDaysApiResourceSwagger.PutWorkingDaysRequest.class )})
- @ApiResponses({@ApiResponse(code = 200, message = "", response = WorkingDaysApiResourceSwagger.PutWorkingDaysResponse.class)})
- public String update(@ApiParam(hidden = true) final String jsonRequestBody) {
-
- final CommandWrapper commandRequest = new CommandWrapperBuilder().updateWorkingDays().withJson(jsonRequestBody).build();
-
- final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
-
- return this.toApiJsonSerializer.serialize(result);
- }
-
- @GET
- @Path("/template")
- @Consumes({ MediaType.APPLICATION_JSON })
- @Produces({ MediaType.APPLICATION_JSON })
- @ApiOperation(value = "Working Days Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for working days.\n" + "\n" + "Example Request:\n" + "\n" + "workingdays/template")
- @ApiResponses({@ApiResponse(code = 200, message = "", response = WorkingDaysApiResourceSwagger.GetWorkingDaysTemplateResponse.class )})
- public String template(@Context final UriInfo uriInfo) {
- this.context.authenticatedUser().validateHasReadPermission(WorkingDaysApiConstants.WORKING_DAYS_RESOURCE_NAME);
-
- final WorkingDaysData repaymentRescheduleOptions = this.workingDaysReadPlatformService.repaymentRescheduleType();
-
- final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
- return this.toApiJsonSerializer.serialize(settings, repaymentRescheduleOptions,
- WorkingDaysApiConstants.WORKING_DAYS_TEMPLATE_PARAMETERS);
- }
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.organisation.workingdays.api;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.PUT;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+
+import io.swagger.annotations.*;
+import org.apache.fineract.commands.domain.CommandWrapper;
+import org.apache.fineract.commands.service.CommandWrapperBuilder;
+import org.apache.fineract.commands.service.PortfolioCommandSourceWritePlatformService;
+import org.apache.fineract.infrastructure.core.api.ApiRequestParameterHelper;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.infrastructure.core.serialization.ApiRequestJsonSerializationSettings;
+import org.apache.fineract.infrastructure.core.serialization.DefaultToApiJsonSerializer;
+import org.apache.fineract.infrastructure.security.service.PlatformSecurityContext;
+import org.apache.fineract.organisation.workingdays.data.WorkingDaysData;
+import org.apache.fineract.organisation.workingdays.service.WorkingDaysReadPlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+@Path("/workingdays")
+@Component
+@Scope("singleton")
+@Api(tags = {"Working days"})
+@SwaggerDefinition(tags = {
+ @Tag(name = "Working days", description = "The days of the week that are workdays.\n" + "\n" + "Rescheduling of repayments when it falls on a non-working is turned on /off by enable/disable reschedule-future-repayments parameter in Global configurations\n" + "\n" + "Allow transactions on non-working days is configurable by enabling/disbaling the allow-transactions-on-non_workingday parameter in Global configurations.")
+})
+public class WorkingDaysApiResource {
+
+ private final DefaultToApiJsonSerializer<WorkingDaysData> toApiJsonSerializer;
+ private final WorkingDaysReadPlatformService workingDaysReadPlatformService;
+ private final PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService;
+ private final PlatformSecurityContext context;
+ private final ApiRequestParameterHelper apiRequestParameterHelper;
+
+ @Autowired
+ public WorkingDaysApiResource(DefaultToApiJsonSerializer<WorkingDaysData> toApiJsonSerializer,
+ WorkingDaysReadPlatformService workingDaysReadPlatformService,
+ PortfolioCommandSourceWritePlatformService commandsSourceWritePlatformService, PlatformSecurityContext context,
+ ApiRequestParameterHelper apiRequestParameterHelper) {
+ this.toApiJsonSerializer = toApiJsonSerializer;
+ this.workingDaysReadPlatformService = workingDaysReadPlatformService;
+ this.commandsSourceWritePlatformService = commandsSourceWritePlatformService;
+ this.context = context;
+ this.apiRequestParameterHelper = apiRequestParameterHelper;
+ }
+
+ @GET
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ @ApiOperation(value = "List Working days", notes = "Example Requests:\n" + "\n" + "workingdays")
+ @ApiResponses({@ApiResponse(code = 200, message = "", response = WorkingDaysApiResourceSwagger.GetWorkingDaysResponse.class, responseContainer = "list")})
+ public String retrieveAll(@Context final UriInfo uriInfo) {
+ this.context.authenticatedUser().validateHasReadPermission(WorkingDaysApiConstants.WORKING_DAYS_RESOURCE_NAME);
+ final WorkingDaysData workingDaysData = this.workingDaysReadPlatformService.retrieve();
+
+ final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
+ return this.toApiJsonSerializer.serialize(settings, workingDaysData);
+ }
+
+ @PUT
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ @ApiOperation(value = "Update a Working Day", notes = "Mandatory Fields\n" + "recurrence,repaymentRescheduleType,extendTermForDailyRepayments,locale")
+ @ApiImplicitParams({@ApiImplicitParam(value = "body", required = true, paramType = "body", dataType = "body", format = "body", dataTypeClass = WorkingDaysApiResourceSwagger.PutWorkingDaysRequest.class )})
+ @ApiResponses({@ApiResponse(code = 200, message = "", response = WorkingDaysApiResourceSwagger.PutWorkingDaysResponse.class)})
+ public String update(@ApiParam(hidden = true) final String jsonRequestBody) {
+
+ final CommandWrapper commandRequest = new CommandWrapperBuilder().updateWorkingDays().withJson(jsonRequestBody).build();
+
+ final CommandProcessingResult result = this.commandsSourceWritePlatformService.logCommandSource(commandRequest);
+
+ return this.toApiJsonSerializer.serialize(result);
+ }
+
+ @GET
+ @Path("/template")
+ @Consumes({ MediaType.APPLICATION_JSON })
+ @Produces({ MediaType.APPLICATION_JSON })
+ @ApiOperation(value = "Working Days Template", notes = "This is a convenience resource. It can be useful when building maintenance user interface screens for working days.\n" + "\n" + "Example Request:\n" + "\n" + "workingdays/template")
+ @ApiResponses({@ApiResponse(code = 200, message = "", response = WorkingDaysApiResourceSwagger.GetWorkingDaysTemplateResponse.class )})
+ public String template(@Context final UriInfo uriInfo) {
+ this.context.authenticatedUser().validateHasReadPermission(WorkingDaysApiConstants.WORKING_DAYS_RESOURCE_NAME);
+
+ final WorkingDaysData repaymentRescheduleOptions = this.workingDaysReadPlatformService.repaymentRescheduleType();
+
+ final ApiRequestJsonSerializationSettings settings = this.apiRequestParameterHelper.process(uriInfo.getQueryParameters());
+ return this.toApiJsonSerializer.serialize(settings, repaymentRescheduleOptions,
+ WorkingDaysApiConstants.WORKING_DAYS_TEMPLATE_PARAMETERS);
+ }
+
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDayValidator.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDayValidator.java
index 77bd3f7..fd59e5f 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDayValidator.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDayValidator.java
@@ -1,90 +1,90 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.organisation.workingdays.data;
-
-import java.lang.reflect.Type;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.fineract.infrastructure.core.data.ApiParameterError;
-import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
-import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
-import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
-import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
-import org.apache.fineract.organisation.workingdays.api.WorkingDaysApiConstants;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import com.google.gson.JsonElement;
-import com.google.gson.reflect.TypeToken;
-
-@Component
-public class WorkingDayValidator {
-
- private final FromJsonHelper fromApiJsonHelper;
- private static final Set<String> WORKING_DAYS_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
- Arrays.asList(WorkingDaysApiConstants.recurrence, WorkingDaysApiConstants.repayment_rescheduling_enum,
- WorkingDaysApiConstants.localeParamName, WorkingDaysApiConstants.extendTermForDailyRepayments,
- WorkingDaysApiConstants.extendTermForRepaymentsOnHolidays));
-
- @Autowired
- public WorkingDayValidator(FromJsonHelper fromApiJsonHelper) {
- this.fromApiJsonHelper = fromApiJsonHelper;
- }
-
- public void validateForUpdate(final String json) {
- if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
-
- final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
- this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
- WORKING_DAYS_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
- final JsonElement element = this.fromApiJsonHelper.parse(json);
-
- final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
-
- final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
- .resource(WorkingDaysApiConstants.WORKING_DAYS_RESOURCE_NAME);
-
- final String recurrence = this.fromApiJsonHelper.extractStringNamed(WorkingDaysApiConstants.recurrence, element);
- baseDataValidator.reset().parameter(WorkingDaysApiConstants.recurrence).value(recurrence).notNull();
-
- final Integer repaymentRescheduleType = this.fromApiJsonHelper.extractIntegerSansLocaleNamed("repaymentRescheduleType", element);
- baseDataValidator.reset().parameter("repaymentRescheduleType").value(repaymentRescheduleType).ignoreIfNull().inMinMaxRange(1, 4);
-
- final Boolean extendTermForDailyRepayments = this.fromApiJsonHelper.extractBooleanNamed("extendTermForDailyRepayments", element);
- baseDataValidator.reset().parameter(WorkingDaysApiConstants.extendTermForDailyRepayments).value(extendTermForDailyRepayments).ignoreIfNull().validateForBooleanValue();
-
- final Boolean extendTermForRepaymentsOnHolidays = this.fromApiJsonHelper.extractBooleanNamed("extendTermForRepaymentsOnHolidays", element);
- baseDataValidator.reset().parameter(WorkingDaysApiConstants.extendTermForRepaymentsOnHolidays).value(extendTermForRepaymentsOnHolidays).ignoreIfNull().validateForBooleanValue();
-
- throwExceptionIfValidationWarningsExist(dataValidationErrors);
-
- }
-
- private void throwExceptionIfValidationWarningsExist(final List<ApiParameterError> dataValidationErrors) {
- if (!dataValidationErrors.isEmpty()) {
- throw new PlatformApiDataValidationException(dataValidationErrors);
- }
- }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.organisation.workingdays.data;
+
+import java.lang.reflect.Type;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.fineract.infrastructure.core.data.ApiParameterError;
+import org.apache.fineract.infrastructure.core.data.DataValidatorBuilder;
+import org.apache.fineract.infrastructure.core.exception.InvalidJsonException;
+import org.apache.fineract.infrastructure.core.exception.PlatformApiDataValidationException;
+import org.apache.fineract.infrastructure.core.serialization.FromJsonHelper;
+import org.apache.fineract.organisation.workingdays.api.WorkingDaysApiConstants;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+import com.google.gson.JsonElement;
+import com.google.gson.reflect.TypeToken;
+
+@Component
+public class WorkingDayValidator {
+
+ private final FromJsonHelper fromApiJsonHelper;
+ private static final Set<String> WORKING_DAYS_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS = new HashSet<>(
+ Arrays.asList(WorkingDaysApiConstants.recurrence, WorkingDaysApiConstants.repayment_rescheduling_enum,
+ WorkingDaysApiConstants.localeParamName, WorkingDaysApiConstants.extendTermForDailyRepayments,
+ WorkingDaysApiConstants.extendTermForRepaymentsOnHolidays));
+
+ @Autowired
+ public WorkingDayValidator(FromJsonHelper fromApiJsonHelper) {
+ this.fromApiJsonHelper = fromApiJsonHelper;
+ }
+
+ public void validateForUpdate(final String json) {
+ if (StringUtils.isBlank(json)) { throw new InvalidJsonException(); }
+
+ final Type typeOfMap = new TypeToken<Map<String, Object>>() {}.getType();
+ this.fromApiJsonHelper.checkForUnsupportedParameters(typeOfMap, json,
+ WORKING_DAYS_CREATE_OR_UPDATE_REQUEST_DATA_PARAMETERS);
+ final JsonElement element = this.fromApiJsonHelper.parse(json);
+
+ final List<ApiParameterError> dataValidationErrors = new ArrayList<>();
+
+ final DataValidatorBuilder baseDataValidator = new DataValidatorBuilder(dataValidationErrors)
+ .resource(WorkingDaysApiConstants.WORKING_DAYS_RESOURCE_NAME);
+
+ final String recurrence = this.fromApiJsonHelper.extractStringNamed(WorkingDaysApiConstants.recurrence, element);
+ baseDataValidator.reset().parameter(WorkingDaysApiConstants.recurrence).value(recurrence).notNull();
+
+ final Integer repaymentRescheduleType = this.fromApiJsonHelper.extractIntegerSansLocaleNamed("repaymentRescheduleType", element);
+ baseDataValidator.reset().parameter("repaymentRescheduleType").value(repaymentRescheduleType).ignoreIfNull().inMinMaxRange(1, 4);
+
+ final Boolean extendTermForDailyRepayments = this.fromApiJsonHelper.extractBooleanNamed("extendTermForDailyRepayments", element);
+ baseDataValidator.reset().parameter(WorkingDaysApiConstants.extendTermForDailyRepayments).value(extendTermForDailyRepayments).ignoreIfNull().validateForBooleanValue();
+
+ final Boolean extendTermForRepaymentsOnHolidays = this.fromApiJsonHelper.extractBooleanNamed("extendTermForRepaymentsOnHolidays", element);
+ baseDataValidator.reset().parameter(WorkingDaysApiConstants.extendTermForRepaymentsOnHolidays).value(extendTermForRepaymentsOnHolidays).ignoreIfNull().validateForBooleanValue();
+
+ throwExceptionIfValidationWarningsExist(dataValidationErrors);
+
+ }
+
+ private void throwExceptionIfValidationWarningsExist(final List<ApiParameterError> dataValidationErrors) {
+ if (!dataValidationErrors.isEmpty()) {
+ throw new PlatformApiDataValidationException(dataValidationErrors);
+ }
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDaysData.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDaysData.java
index d859603..84f1906 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDaysData.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/data/WorkingDaysData.java
@@ -1,68 +1,68 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.organisation.workingdays.data;
-
-import org.apache.fineract.infrastructure.core.data.EnumOptionData;
-
-import java.util.Collection;
-
-public class WorkingDaysData {
-
- private final Long id;
-
- private final String recurrence;
-
- private final EnumOptionData repaymentRescheduleType;
-
- private final Boolean extendTermForDailyRepayments;
-
- private final Boolean extendTermForRepaymentsOnHolidays;
-
- // template date
- @SuppressWarnings("unused")
- private final Collection<EnumOptionData> repaymentRescheduleOptions;
-
- public WorkingDaysData(Long id, String recurrence, EnumOptionData repaymentRescheduleType, Boolean extendTermForDailyRepayments, Boolean extendTermForRepaymentsOnHolidays) {
- this.id = id;
- this.recurrence = recurrence;
- this.repaymentRescheduleType = repaymentRescheduleType;
- this.repaymentRescheduleOptions = null;
- this.extendTermForDailyRepayments = extendTermForDailyRepayments;
- this.extendTermForRepaymentsOnHolidays = extendTermForRepaymentsOnHolidays;
- }
-
- public WorkingDaysData(Long id, String recurrence, EnumOptionData repaymentRescheduleType,
- Collection<EnumOptionData> repaymentRescheduleOptions, Boolean extendTermForDailyRepayments, Boolean extendTermForRepaymentsOnHolidays) {
- this.id = id;
- this.recurrence = recurrence;
- this.repaymentRescheduleType = repaymentRescheduleType;
- this.repaymentRescheduleOptions = repaymentRescheduleOptions;
- this.extendTermForDailyRepayments = extendTermForDailyRepayments;
- this.extendTermForRepaymentsOnHolidays = extendTermForRepaymentsOnHolidays;
- }
-
- public WorkingDaysData(WorkingDaysData data, Collection<EnumOptionData> repaymentRescheduleOptions) {
- this.id = data.id;
- this.recurrence = data.recurrence;
- this.repaymentRescheduleType = data.repaymentRescheduleType;
- this.repaymentRescheduleOptions = repaymentRescheduleOptions;
- this.extendTermForDailyRepayments = data.extendTermForDailyRepayments;
- this.extendTermForRepaymentsOnHolidays = data.extendTermForRepaymentsOnHolidays;
- }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.organisation.workingdays.data;
+
+import org.apache.fineract.infrastructure.core.data.EnumOptionData;
+
+import java.util.Collection;
+
+public class WorkingDaysData {
+
+ private final Long id;
+
+ private final String recurrence;
+
+ private final EnumOptionData repaymentRescheduleType;
+
+ private final Boolean extendTermForDailyRepayments;
+
+ private final Boolean extendTermForRepaymentsOnHolidays;
+
+ // template date
+ @SuppressWarnings("unused")
+ private final Collection<EnumOptionData> repaymentRescheduleOptions;
+
+ public WorkingDaysData(Long id, String recurrence, EnumOptionData repaymentRescheduleType, Boolean extendTermForDailyRepayments, Boolean extendTermForRepaymentsOnHolidays) {
+ this.id = id;
+ this.recurrence = recurrence;
+ this.repaymentRescheduleType = repaymentRescheduleType;
+ this.repaymentRescheduleOptions = null;
+ this.extendTermForDailyRepayments = extendTermForDailyRepayments;
+ this.extendTermForRepaymentsOnHolidays = extendTermForRepaymentsOnHolidays;
+ }
+
+ public WorkingDaysData(Long id, String recurrence, EnumOptionData repaymentRescheduleType,
+ Collection<EnumOptionData> repaymentRescheduleOptions, Boolean extendTermForDailyRepayments, Boolean extendTermForRepaymentsOnHolidays) {
+ this.id = id;
+ this.recurrence = recurrence;
+ this.repaymentRescheduleType = repaymentRescheduleType;
+ this.repaymentRescheduleOptions = repaymentRescheduleOptions;
+ this.extendTermForDailyRepayments = extendTermForDailyRepayments;
+ this.extendTermForRepaymentsOnHolidays = extendTermForRepaymentsOnHolidays;
+ }
+
+ public WorkingDaysData(WorkingDaysData data, Collection<EnumOptionData> repaymentRescheduleOptions) {
+ this.id = data.id;
+ this.recurrence = data.recurrence;
+ this.repaymentRescheduleType = data.repaymentRescheduleType;
+ this.repaymentRescheduleOptions = repaymentRescheduleOptions;
+ this.extendTermForDailyRepayments = data.extendTermForDailyRepayments;
+ this.extendTermForRepaymentsOnHolidays = data.extendTermForRepaymentsOnHolidays;
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/domain/WorkingDaysEnumerations.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/domain/WorkingDaysEnumerations.java
index 8b2b752..b5d01f2 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/domain/WorkingDaysEnumerations.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/domain/WorkingDaysEnumerations.java
@@ -1,60 +1,60 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.organisation.workingdays.domain;
-
-
-import org.apache.fineract.infrastructure.core.data.EnumOptionData;
-
-public class WorkingDaysEnumerations {
-
- public static EnumOptionData workingDaysStatusType(final int id) {
- return repaymentRescheduleType(RepaymentRescheduleType.fromInt(id));
- }
-
- public static EnumOptionData repaymentRescheduleType(final RepaymentRescheduleType type){
- EnumOptionData optionData = null;
- switch(type){
- case INVALID:
- optionData = new EnumOptionData(RepaymentRescheduleType.INVALID.getValue().longValue(),RepaymentRescheduleType.INVALID.getCode(),
- "invalid");
- break;
-
- case SAME_DAY:
- optionData = new EnumOptionData(RepaymentRescheduleType.SAME_DAY.getValue().longValue(),RepaymentRescheduleType.SAME_DAY.getCode(),
- "same day");
-
- break;
- case MOVE_TO_NEXT_WORKING_DAY:
- optionData = new EnumOptionData(RepaymentRescheduleType.MOVE_TO_NEXT_WORKING_DAY.getValue().longValue(),RepaymentRescheduleType.MOVE_TO_NEXT_WORKING_DAY.getCode(),
- "move to next working day");
- break;
-
- case MOVE_TO_NEXT_REPAYMENT_MEETING_DAY:
- optionData = new EnumOptionData(RepaymentRescheduleType.MOVE_TO_NEXT_REPAYMENT_MEETING_DAY.getValue().longValue(),RepaymentRescheduleType.MOVE_TO_NEXT_REPAYMENT_MEETING_DAY.getCode(),
- "move to next repayment meeting day");
- break;
- case MOVE_TO_PREVIOUS_WORKING_DAY:
- optionData = new EnumOptionData(RepaymentRescheduleType.MOVE_TO_PREVIOUS_WORKING_DAY.getValue().longValue(),RepaymentRescheduleType.MOVE_TO_PREVIOUS_WORKING_DAY.getCode(),
- "move to previous working day");
- break;
- }
-
- return optionData;
- }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.organisation.workingdays.domain;
+
+
+import org.apache.fineract.infrastructure.core.data.EnumOptionData;
+
+public class WorkingDaysEnumerations {
+
+ public static EnumOptionData workingDaysStatusType(final int id) {
+ return repaymentRescheduleType(RepaymentRescheduleType.fromInt(id));
+ }
+
+ public static EnumOptionData repaymentRescheduleType(final RepaymentRescheduleType type){
+ EnumOptionData optionData = null;
+ switch(type){
+ case INVALID:
+ optionData = new EnumOptionData(RepaymentRescheduleType.INVALID.getValue().longValue(),RepaymentRescheduleType.INVALID.getCode(),
+ "invalid");
+ break;
+
+ case SAME_DAY:
+ optionData = new EnumOptionData(RepaymentRescheduleType.SAME_DAY.getValue().longValue(),RepaymentRescheduleType.SAME_DAY.getCode(),
+ "same day");
+
+ break;
+ case MOVE_TO_NEXT_WORKING_DAY:
+ optionData = new EnumOptionData(RepaymentRescheduleType.MOVE_TO_NEXT_WORKING_DAY.getValue().longValue(),RepaymentRescheduleType.MOVE_TO_NEXT_WORKING_DAY.getCode(),
+ "move to next working day");
+ break;
+
+ case MOVE_TO_NEXT_REPAYMENT_MEETING_DAY:
+ optionData = new EnumOptionData(RepaymentRescheduleType.MOVE_TO_NEXT_REPAYMENT_MEETING_DAY.getValue().longValue(),RepaymentRescheduleType.MOVE_TO_NEXT_REPAYMENT_MEETING_DAY.getCode(),
+ "move to next repayment meeting day");
+ break;
+ case MOVE_TO_PREVIOUS_WORKING_DAY:
+ optionData = new EnumOptionData(RepaymentRescheduleType.MOVE_TO_PREVIOUS_WORKING_DAY.getValue().longValue(),RepaymentRescheduleType.MOVE_TO_PREVIOUS_WORKING_DAY.getCode(),
+ "move to previous working day");
+ break;
+ }
+
+ return optionData;
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/handler/UpdateWorkingDaysCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/handler/UpdateWorkingDaysCommandHandler.java
index 160758a..cbd19a4 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/handler/UpdateWorkingDaysCommandHandler.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/handler/UpdateWorkingDaysCommandHandler.java
@@ -1,46 +1,46 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.organisation.workingdays.handler;
-
-
-import org.apache.fineract.commands.annotation.CommandType;
-import org.apache.fineract.commands.handler.NewCommandSourceHandler;
-import org.apache.fineract.infrastructure.core.api.JsonCommand;
-import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
-import org.apache.fineract.organisation.workingdays.service.WorkingDaysWritePlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-@Service
-@CommandType(entity = "WORKINGDAYS", action = "UPDATE")
-public class UpdateWorkingDaysCommandHandler implements NewCommandSourceHandler {
-
- private final WorkingDaysWritePlatformService workingDaysWritePlatformService;
-
- @Autowired
- public UpdateWorkingDaysCommandHandler(final WorkingDaysWritePlatformService workingDaysWritePlatformService) {
- this.workingDaysWritePlatformService = workingDaysWritePlatformService;
- }
- @Transactional
- @Override
- public CommandProcessingResult processCommand(JsonCommand command) {
- return this.workingDaysWritePlatformService.updateWorkingDays(command);
- }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.organisation.workingdays.handler;
+
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.organisation.workingdays.service.WorkingDaysWritePlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+@Service
+@CommandType(entity = "WORKINGDAYS", action = "UPDATE")
+public class UpdateWorkingDaysCommandHandler implements NewCommandSourceHandler {
+
+ private final WorkingDaysWritePlatformService workingDaysWritePlatformService;
+
+ @Autowired
+ public UpdateWorkingDaysCommandHandler(final WorkingDaysWritePlatformService workingDaysWritePlatformService) {
+ this.workingDaysWritePlatformService = workingDaysWritePlatformService;
+ }
+ @Transactional
+ @Override
+ public CommandProcessingResult processCommand(JsonCommand command) {
+ return this.workingDaysWritePlatformService.updateWorkingDays(command);
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/service/WorkingDaysReadPlatformService.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/service/WorkingDaysReadPlatformService.java
index 90ba1db..55898ea 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/service/WorkingDaysReadPlatformService.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/service/WorkingDaysReadPlatformService.java
@@ -1,28 +1,28 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.organisation.workingdays.service;
-
-import org.apache.fineract.organisation.workingdays.data.WorkingDaysData;
-
-public interface WorkingDaysReadPlatformService {
-
- WorkingDaysData retrieve();
-
- WorkingDaysData repaymentRescheduleType();
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.organisation.workingdays.service;
+
+import org.apache.fineract.organisation.workingdays.data.WorkingDaysData;
+
+public interface WorkingDaysReadPlatformService {
+
+ WorkingDaysData retrieve();
+
+ WorkingDaysData repaymentRescheduleType();
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/service/WorkingDaysReadPlatformServiceImpl.java b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/service/WorkingDaysReadPlatformServiceImpl.java
index e5085e0..6ca8c56 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/service/WorkingDaysReadPlatformServiceImpl.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/organisation/workingdays/service/WorkingDaysReadPlatformServiceImpl.java
@@ -1,107 +1,107 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.organisation.workingdays.service;
-
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.Arrays;
-import java.util.Collection;
-
-import org.apache.fineract.infrastructure.core.data.EnumOptionData;
-import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
-import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
-import org.apache.fineract.organisation.workingdays.data.WorkingDaysData;
-import org.apache.fineract.organisation.workingdays.domain.RepaymentRescheduleType;
-import org.apache.fineract.organisation.workingdays.domain.WorkingDaysEnumerations;
-import org.apache.fineract.organisation.workingdays.exception.WorkingDaysNotFoundException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.dao.EmptyResultDataAccessException;
-import org.springframework.jdbc.core.JdbcTemplate;
-import org.springframework.jdbc.core.RowMapper;
-import org.springframework.stereotype.Service;
-
-@Service
-public class WorkingDaysReadPlatformServiceImpl implements WorkingDaysReadPlatformService {
-
- private final JdbcTemplate jdbcTemplate;
-
- @Autowired
- public WorkingDaysReadPlatformServiceImpl(final RoutingDataSource dataSource) {
- this.jdbcTemplate = new JdbcTemplate(dataSource);
- }
-
- private static final class WorkingDaysMapper implements RowMapper<WorkingDaysData> {
-
- private final String schema;
-
- public WorkingDaysMapper() {
- final StringBuilder sqlBuilder = new StringBuilder(100);
- sqlBuilder.append("w.id as id,w.recurrence as recurrence,w.repayment_rescheduling_enum as status_enum,");
- sqlBuilder.append("w.extend_term_daily_repayments as extendTermForDailyRepayments,");
- sqlBuilder.append("w.extend_term_holiday_repayment as extendTermForRepaymentsOnHolidays ");
- sqlBuilder.append("from m_working_days w");
-
- this.schema = sqlBuilder.toString();
- }
-
- public String schema() {
- return this.schema;
- }
-
- @Override
- public WorkingDaysData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum) throws SQLException {
- final Long id = rs.getLong("id");
- final String recurrence = rs.getString("recurrence");
- final Integer statusEnum = JdbcSupport.getInteger(rs, "status_enum");
- final EnumOptionData status = WorkingDaysEnumerations.workingDaysStatusType(statusEnum);
- final Boolean extendTermForDailyRepayments = rs.getBoolean("extendTermForDailyRepayments");
- final Boolean extendTermForRepaymentsOnHolidays = rs.getBoolean("extendTermForRepaymentsOnHolidays");
-
- return new WorkingDaysData(id, recurrence, status, extendTermForDailyRepayments, extendTermForRepaymentsOnHolidays);
- }
- }
-
- @Override
- public WorkingDaysData retrieve() {
- //Check whether template is enabled or not?
- try {
- final WorkingDaysMapper rm = new WorkingDaysMapper();
- final String sql = " select " + rm.schema();
- WorkingDaysData data = this.jdbcTemplate.queryForObject(sql, rm, new Object[] {});
- Collection<EnumOptionData> repaymentRescheduleOptions = repaymentRescheduleTypeOptions() ;
- return new WorkingDaysData(data, repaymentRescheduleOptions) ;
- } catch (final EmptyResultDataAccessException e) {
- throw new WorkingDaysNotFoundException();
- }
- }
-
- @Override
- public WorkingDaysData repaymentRescheduleType() {
- Collection<EnumOptionData> repaymentRescheduleOptions = repaymentRescheduleTypeOptions();
- return new WorkingDaysData(null, null, null, repaymentRescheduleOptions, null, null);
- }
-
- private Collection<EnumOptionData> repaymentRescheduleTypeOptions() {
- return Arrays.asList(
- WorkingDaysEnumerations.repaymentRescheduleType(RepaymentRescheduleType.SAME_DAY),
- WorkingDaysEnumerations.repaymentRescheduleType(RepaymentRescheduleType.MOVE_TO_NEXT_WORKING_DAY),
- WorkingDaysEnumerations.repaymentRescheduleType(RepaymentRescheduleType.MOVE_TO_NEXT_REPAYMENT_MEETING_DAY),
- WorkingDaysEnumerations.repaymentRescheduleType(RepaymentRescheduleType.MOVE_TO_PREVIOUS_WORKING_DAY));
- }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.organisation.workingdays.service;
+
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.Collection;
+
+import org.apache.fineract.infrastructure.core.data.EnumOptionData;
+import org.apache.fineract.infrastructure.core.domain.JdbcSupport;
+import org.apache.fineract.infrastructure.core.service.RoutingDataSource;
+import org.apache.fineract.organisation.workingdays.data.WorkingDaysData;
+import org.apache.fineract.organisation.workingdays.domain.RepaymentRescheduleType;
+import org.apache.fineract.organisation.workingdays.domain.WorkingDaysEnumerations;
+import org.apache.fineract.organisation.workingdays.exception.WorkingDaysNotFoundException;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.dao.EmptyResultDataAccessException;
+import org.springframework.jdbc.core.JdbcTemplate;
+import org.springframework.jdbc.core.RowMapper;
+import org.springframework.stereotype.Service;
+
+@Service
+public class WorkingDaysReadPlatformServiceImpl implements WorkingDaysReadPlatformService {
+
+ private final JdbcTemplate jdbcTemplate;
+
+ @Autowired
+ public WorkingDaysReadPlatformServiceImpl(final RoutingDataSource dataSource) {
+ this.jdbcTemplate = new JdbcTemplate(dataSource);
+ }
+
+ private static final class WorkingDaysMapper implements RowMapper<WorkingDaysData> {
+
+ private final String schema;
+
+ public WorkingDaysMapper() {
+ final StringBuilder sqlBuilder = new StringBuilder(100);
+ sqlBuilder.append("w.id as id,w.recurrence as recurrence,w.repayment_rescheduling_enum as status_enum,");
+ sqlBuilder.append("w.extend_term_daily_repayments as extendTermForDailyRepayments,");
+ sqlBuilder.append("w.extend_term_holiday_repayment as extendTermForRepaymentsOnHolidays ");
+ sqlBuilder.append("from m_working_days w");
+
+ this.schema = sqlBuilder.toString();
+ }
+
+ public String schema() {
+ return this.schema;
+ }
+
+ @Override
+ public WorkingDaysData mapRow(ResultSet rs, @SuppressWarnings("unused") int rowNum) throws SQLException {
+ final Long id = rs.getLong("id");
+ final String recurrence = rs.getString("recurrence");
+ final Integer statusEnum = JdbcSupport.getInteger(rs, "status_enum");
+ final EnumOptionData status = WorkingDaysEnumerations.workingDaysStatusType(statusEnum);
+ final Boolean extendTermForDailyRepayments = rs.getBoolean("extendTermForDailyRepayments");
+ final Boolean extendTermForRepaymentsOnHolidays = rs.getBoolean("extendTermForRepaymentsOnHolidays");
+
+ return new WorkingDaysData(id, recurrence, status, extendTermForDailyRepayments, extendTermForRepaymentsOnHolidays);
+ }
+ }
+
+ @Override
+ public WorkingDaysData retrieve() {
+ //Check whether template is enabled or not?
+ try {
+ final WorkingDaysMapper rm = new WorkingDaysMapper();
+ final String sql = " select " + rm.schema();
+ WorkingDaysData data = this.jdbcTemplate.queryForObject(sql, rm, new Object[] {});
+ Collection<EnumOptionData> repaymentRescheduleOptions = repaymentRescheduleTypeOptions() ;
+ return new WorkingDaysData(data, repaymentRescheduleOptions) ;
+ } catch (final EmptyResultDataAccessException e) {
+ throw new WorkingDaysNotFoundException();
+ }
+ }
+
+ @Override
+ public WorkingDaysData repaymentRescheduleType() {
+ Collection<EnumOptionData> repaymentRescheduleOptions = repaymentRescheduleTypeOptions();
+ return new WorkingDaysData(null, null, null, repaymentRescheduleOptions, null, null);
+ }
+
+ private Collection<EnumOptionData> repaymentRescheduleTypeOptions() {
+ return Arrays.asList(
+ WorkingDaysEnumerations.repaymentRescheduleType(RepaymentRescheduleType.SAME_DAY),
+ WorkingDaysEnumerations.repaymentRescheduleType(RepaymentRescheduleType.MOVE_TO_NEXT_WORKING_DAY),
+ WorkingDaysEnumerations.repaymentRescheduleType(RepaymentRescheduleType.MOVE_TO_NEXT_REPAYMENT_MEETING_DAY),
+ WorkingDaysEnumerations.repaymentRescheduleType(RepaymentRescheduleType.MOVE_TO_PREVIOUS_WORKING_DAY));
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRecoveryPaymentCommandHandler.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRecoveryPaymentCommandHandler.java
index a2429ca..87aa86d 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRecoveryPaymentCommandHandler.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/handler/LoanRecoveryPaymentCommandHandler.java
@@ -1,45 +1,45 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.portfolio.loanaccount.handler;
-
-import org.apache.fineract.commands.annotation.CommandType;
-import org.apache.fineract.commands.handler.NewCommandSourceHandler;
-import org.apache.fineract.infrastructure.core.api.JsonCommand;
-import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
-import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Service;
-
-@Service
-@CommandType(entity = "LOAN", action = "RECOVERYPAYMENT")
-public class LoanRecoveryPaymentCommandHandler implements NewCommandSourceHandler {
-
- private final LoanWritePlatformService writePlatformService;
-
- @Autowired
- public LoanRecoveryPaymentCommandHandler(LoanWritePlatformService writePlatformService) {
- this.writePlatformService = writePlatformService;
- }
-
- @Override
- public CommandProcessingResult processCommand(JsonCommand command) {
- final boolean isRecoveryRepayment = true;
- return writePlatformService.makeLoanRepayment(command.getLoanId(), command, isRecoveryRepayment);
- }
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.portfolio.loanaccount.handler;
+
+import org.apache.fineract.commands.annotation.CommandType;
+import org.apache.fineract.commands.handler.NewCommandSourceHandler;
+import org.apache.fineract.infrastructure.core.api.JsonCommand;
+import org.apache.fineract.infrastructure.core.data.CommandProcessingResult;
+import org.apache.fineract.portfolio.loanaccount.service.LoanWritePlatformService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+@Service
+@CommandType(entity = "LOAN", action = "RECOVERYPAYMENT")
+public class LoanRecoveryPaymentCommandHandler implements NewCommandSourceHandler {
+
+ private final LoanWritePlatformService writePlatformService;
+
+ @Autowired
+ public LoanRecoveryPaymentCommandHandler(LoanWritePlatformService writePlatformService) {
+ this.writePlatformService = writePlatformService;
+ }
+
+ @Override
+ public CommandProcessingResult processCommand(JsonCommand command) {
+ final boolean isRecoveryRepayment = true;
+ return writePlatformService.makeLoanRepayment(command.getLoanId(), command, isRecoveryRepayment);
+ }
+}
diff --git a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/data/OverdueLoanScheduleData.java b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/data/OverdueLoanScheduleData.java
index 3103a4e..180359b 100755
--- a/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/data/OverdueLoanScheduleData.java
+++ b/fineract-provider/src/main/java/org/apache/fineract/portfolio/loanaccount/loanschedule/data/OverdueLoanScheduleData.java
@@ -1,85 +1,85 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.fineract.portfolio.loanaccount.loanschedule.data;
-
-import java.math.BigDecimal;
-
-public class OverdueLoanScheduleData {
-
- private final Long loanId;
- private final Long chargeId;
- private final String locale;
- private final BigDecimal amount;
- private final String dateFormat;
- private final String dueDate;
- private final BigDecimal principalOverdue;
- private final BigDecimal interestOverdue;
- private final Integer periodNumber;
-
- public OverdueLoanScheduleData(final Long loanId, final Long chargeId, final String dueDate, final BigDecimal amount,
- final String dateFormat, final String locale, final BigDecimal principalOverdue, final BigDecimal interestOverdue,
- final Integer periodNumber) {
- this.loanId = loanId;
- this.chargeId = chargeId;
- this.dueDate = dueDate;
- this.amount = amount;
- this.dateFormat = dateFormat;
- this.locale = locale;
- this.principalOverdue = principalOverdue;
- this.interestOverdue = interestOverdue;
- this.periodNumber = periodNumber;
- }
-
- public Long getLoanId() {
- return this.loanId;
- }
-
- public Long getChargeId() {
- return this.chargeId;
- }
-
- public String getDueDate() {
- return this.dueDate;
- }
-
- public BigDecimal getAmount() {
- return this.amount;
- }
-
- public String getDateFormat() {
- return this.dateFormat;
- }
-
- public String getLocale() {
- return this.locale;
- }
-
-
- public Integer getPeriodNumber() {
- return this.periodNumber;
- }
-
- @Override
- public String toString() {
- return "{" + "chargeId:" + this.chargeId + ", locale:'" + this.locale + '\'' + ", amount:" + this.amount + ", dateFormat:'"
- + this.dateFormat + '\'' + ", dueDate:'" + this.dueDate + '\'' + ", principal:'" + this.principalOverdue + '\''
- + ", interest:'" + this.interestOverdue + '\'' + '}';
- }
-
-}
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.fineract.portfolio.loanaccount.loanschedule.data;
+
+import java.math.BigDecimal;
+
+public class OverdueLoanScheduleData {
+
+ private final Long loanId;
+ private final Long chargeId;
+ private final String locale;
+ private final BigDecimal amount;
+ private final String dateFormat;
+ private final String dueDate;
+ private final BigDecimal principalOverdue;
+ private final BigDecimal interestOverdue;
+ private final Integer periodNumber;
+
+ public OverdueLoanScheduleData(final Long loanId, final Long chargeId, final String dueDate, final BigDecimal amount,
+ final String dateFormat, final String locale, final BigDecimal principalOverdue, final BigDecimal interestOverdue,
+ final Integer periodNumber) {
+ this.loanId = loanId;
+ this.chargeId = chargeId;
+ this.dueDate = dueDate;
+ this.amount = amount;
+ this.dateFormat = dateFormat;
+ this.locale = locale;
+ this.principalOverdue = principalOverdue;
+ this.interestOverdue = interestOverdue;
+ this.periodNumber = periodNumber;
+ }
+
+ public Long getLoanId() {
+ return this.loanId;
+ }
+
+ public Long getChargeId() {
+ return this.chargeId;
+ }
+
+ public String getDueDate() {
+ return this.dueDate;
+ }
+
+ public BigDecimal getAmount() {
+ return this.amount;
+ }
+
+ public String getDateFormat() {
+ return this.dateFormat;
+ }
+
+ public String getLocale() {
+ return this.locale;
+ }
+
+
+ public Integer getPeriodNumber() {
+ return this.periodNumber;
+ }
+
+ @Override
+ public String toString() {
+ return "{" + "chargeId:" + this.chargeId + ", locale:'" + this.locale + '\'' + ", amount:" + this.amount + ", dateFormat:'"
+ + this.dateFormat + '\'' + ", dueDate:'" + this.dueDate + '\'' + ", principal:'" + this.principalOverdue + '\''
+ + ", interest:'" + this.interestOverdue + '\'' + '}';
+ }
+
+}