added path configurer to allow dots in url
added createdOn to CaseParameterEntity for deterministic query behavior
diff --git a/api/src/test/java/io/mifos/portfolio/api/v1/domain/InterestRangeTest.java b/api/src/test/java/io/mifos/portfolio/api/v1/domain/InterestRangeTest.java
index db1b3bc..121eab7 100644
--- a/api/src/test/java/io/mifos/portfolio/api/v1/domain/InterestRangeTest.java
+++ b/api/src/test/java/io/mifos/portfolio/api/v1/domain/InterestRangeTest.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2017 The Mifos Initiative.
+ *
+ * Licensed 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 io.mifos.portfolio.api.v1.domain;
import io.mifos.core.test.domain.ValidationTest;
diff --git a/service/src/main/java/io/mifos/individuallending/internal/mapper/CaseParametersMapper.java b/service/src/main/java/io/mifos/individuallending/internal/mapper/CaseParametersMapper.java
index e549cea..663bfbd 100644
--- a/service/src/main/java/io/mifos/individuallending/internal/mapper/CaseParametersMapper.java
+++ b/service/src/main/java/io/mifos/individuallending/internal/mapper/CaseParametersMapper.java
@@ -20,6 +20,9 @@
import io.mifos.portfolio.api.v1.domain.PaymentCycle;
import io.mifos.portfolio.api.v1.domain.TermRange;
+import java.time.Clock;
+import java.time.LocalDateTime;
+
/**
* @author Myrle Krantz
*/
@@ -39,6 +42,7 @@
ret.setPaymentCycleAlignmentDay(instance.getPaymentCycle().getAlignmentDay());
ret.setPaymentCycleAlignmentWeek(instance.getPaymentCycle().getAlignmentWeek());
ret.setPaymentCycleAlignmentMonth(instance.getPaymentCycle().getAlignmentMonth());
+ ret.setCreatedOn(LocalDateTime.now(Clock.systemUTC()));
return ret;
}
diff --git a/service/src/main/java/io/mifos/individuallending/internal/repository/CaseParametersEntity.java b/service/src/main/java/io/mifos/individuallending/internal/repository/CaseParametersEntity.java
index 053d6db..6f18336 100644
--- a/service/src/main/java/io/mifos/individuallending/internal/repository/CaseParametersEntity.java
+++ b/service/src/main/java/io/mifos/individuallending/internal/repository/CaseParametersEntity.java
@@ -15,8 +15,11 @@
*/
package io.mifos.individuallending.internal.repository;
+import io.mifos.core.mariadb.util.LocalDateTimeConverter;
+
import javax.persistence.*;
import java.math.BigDecimal;
+import java.time.LocalDateTime;
import java.time.temporal.ChronoUnit;
/**
@@ -65,6 +68,10 @@
@Column(name = "pay_cycle_align_month")
private Integer paymentCycleAlignmentMonth;
+ @Column(name = "created_on")
+ @Convert(converter = LocalDateTimeConverter.class)
+ private LocalDateTime createdOn;
+
public CaseParametersEntity() {
}
@@ -163,4 +170,12 @@
public void setPaymentCycleAlignmentMonth(Integer paymentCycleAlignmentMonth) {
this.paymentCycleAlignmentMonth = paymentCycleAlignmentMonth;
}
+
+ public LocalDateTime getCreatedOn() {
+ return this.createdOn;
+ }
+
+ public void setCreatedOn(final LocalDateTime createdOn) {
+ this.createdOn = createdOn;
+ }
}
diff --git a/service/src/main/java/io/mifos/individuallending/internal/service/CaseParametersService.java b/service/src/main/java/io/mifos/individuallending/internal/service/CaseParametersService.java
index 9a4070e..c7a4a6e 100644
--- a/service/src/main/java/io/mifos/individuallending/internal/service/CaseParametersService.java
+++ b/service/src/main/java/io/mifos/individuallending/internal/service/CaseParametersService.java
@@ -70,7 +70,7 @@
final int pageIndex,
final int size)
{
- final Pageable pageRequest = new PageRequest(pageIndex, size, Sort.Direction.DESC, "balanceRangeMaximum");
+ final Pageable pageRequest = new PageRequest(pageIndex, size, Sort.Direction.DESC, "createdOn");
final Page<CaseParametersEntity> ret = caseParametersRepository.findByCustomerIdentifier(customerIdentifier, pageRequest);
diff --git a/service/src/main/java/io/mifos/portfolio/service/PortfolioServiceConfiguration.java b/service/src/main/java/io/mifos/portfolio/service/PortfolioServiceConfiguration.java
index 78e5ae0..f9838b7 100644
--- a/service/src/main/java/io/mifos/portfolio/service/PortfolioServiceConfiguration.java
+++ b/service/src/main/java/io/mifos/portfolio/service/PortfolioServiceConfiguration.java
@@ -36,6 +36,8 @@
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.web.servlet.config.annotation.PathMatchConfigurer;
+import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
@EnableAutoConfiguration
@@ -55,7 +57,7 @@
@EntityScan(basePackages = "io.mifos.portfolio.service.internal.repository")
@EnableFeignClients(basePackages = {"io.mifos.accounting.api.v1"})
@Import(IndividualLendingConfiguration.class)
-public class PortfolioServiceConfiguration {
+public class PortfolioServiceConfiguration extends WebMvcConfigurerAdapter {
public PortfolioServiceConfiguration() {
super();
@@ -70,4 +72,9 @@
public Gson gson() {
return new Gson();
}
+
+ @Override
+ public void configurePathMatch(final PathMatchConfigurer configurer) {
+ configurer.setUseSuffixPatternMatch(Boolean.FALSE);
+ }
}
diff --git a/service/src/main/resources/db/migrations/mariadb/V2__add_created_on_to_bastet_il_cases.sql b/service/src/main/resources/db/migrations/mariadb/V2__add_created_on_to_bastet_il_cases.sql
new file mode 100644
index 0000000..38d82e4
--- /dev/null
+++ b/service/src/main/resources/db/migrations/mariadb/V2__add_created_on_to_bastet_il_cases.sql
@@ -0,0 +1,22 @@
+--
+-- Copyright 2017 The Mifos Initiative.
+--
+-- Licensed 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.
+--
+
+ALTER TABLE bastet_il_cases ADD COLUMN created_on TIMESTAMP(3) NULL;
+
+UPDATE bastet_il_cases bic INNER JOIN bastet_cases bc ON (bic.case_id = bc.id) SET bic.created_on = bc.created_on where bic.created_on IS NULL;
+
+ALTER TABLE bastet_il_cases MODIFY COLUMN created_on TIMESTAMP(3) NOT NULL;
+