From 9b9b90467e3d4086ace9323853a9180174e56424 Mon Sep 17 00:00:00 2001 From: Dhroov Sankla Date: Thu, 6 Aug 2026 21:33:03 +0530 Subject: [PATCH] FINERACT-2745: Deprecate and remove obsolete MIX XBRL reporting module --- build.gradle | 2 - .../client/feign/FineractFeignClient.java | 15 -- .../fineract/client/util/FineractClient.java | 9 - fineract-mix/build.gradle | 75 ------- fineract-mix/dependencies.gradle | 70 ------ .../mix/api/MixReportApiResource.java | 57 ----- .../mix/api/MixTaxonomyApiResource.java | 49 ----- .../api/MixTaxonomyMappingApiResource.java | 76 ------- .../MixTaxonomyMappingUpdateCommand.java | 28 --- .../mix/data/MixReportXBRLContextData.java | 42 ---- .../fineract/mix/data/MixReportXBRLData.java | 46 ---- .../mix/data/MixReportXBRLNamespaceData.java | 42 ---- .../fineract/mix/data/MixTaxonomyData.java | 57 ----- .../mix/data/MixTaxonomyMappingData.java | 37 ---- .../data/MixTaxonomyMappingUpdateRequest.java | 41 ---- .../MixTaxonomyMappingUpdateResponse.java | 38 ---- .../mix/domain/MixReportXBRLNamespace.java | 48 ---- .../MixReportXBRLNamespaceRepository.java | 29 --- .../fineract/mix/domain/MixTaxonomy.java | 63 ------ .../mix/domain/MixTaxonomyMapping.java | 53 ----- .../domain/MixTaxonomyMappingRepository.java | 25 --- .../mix/domain/MixTaxonomyRepository.java | 28 --- .../MixReportXBRLMappingInvalidException.java | 29 --- ...ixTaxonomyMappingUpdateCommandHandler.java | 51 ----- .../mapping/MixReportXBRLNamespaceMapper.java | 30 --- .../mix/mapping/MixTaxonomyMapper.java | 32 --- .../mix/mapping/MixTaxonomyMappingMapper.java | 30 --- ...MixTaxonomyMappingUpdateRequestMapper.java | 30 --- .../mix/service/MixReportXBRLBuilder.java | 208 ------------------ .../MixReportXBRLNamespaceReadService.java | 26 --- ...MixReportXBRLNamespaceReadServiceImpl.java | 40 ---- .../service/MixReportXBRLResultService.java | 28 --- .../MixReportXBRLResultServiceImpl.java | 185 ---------------- .../MixTaxonomyMappingReadService.java | 26 --- .../MixTaxonomyMappingReadServiceImpl.java | 40 ---- .../MixTaxonomyMappingWriteService.java | 27 --- .../MixTaxonomyMappingWriteServiceImpl.java | 48 ---- .../mix/service/MixTaxonomyReadService.java | 29 --- .../service/MixTaxonomyReadServiceImpl.java | 46 ---- fineract-provider/dependencies.gradle | 1 - .../core/config/JdbcConfig.java | 3 +- .../core/config/SecurityConfig.java | 29 +-- .../core/config/jpa/JPAConfig.java | 3 +- .../db/changelog/tenant/changelog-tenant.xml | 1 + .../tenant/parts/0243_remove_mix_module.xml | 51 +++++ .../report/MixXbrlBuilderStepDefinitions.java | 83 ------- .../MixXbrlTaxonomyStepDefinitions.java | 52 ----- .../resources/features/mix/mix.report.feature | 40 ---- fineract-war/build.gradle | 1 - .../integrationtests/XBRLIntegrationTest.java | 67 ------ .../xbrl/XBRLIntegrationTestHelper.java | 64 ------ settings.gradle | 1 - 52 files changed, 55 insertions(+), 2176 deletions(-) delete mode 100644 fineract-mix/build.gradle delete mode 100644 fineract-mix/dependencies.gradle delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/api/MixReportApiResource.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/api/MixTaxonomyApiResource.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/api/MixTaxonomyMappingApiResource.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/command/MixTaxonomyMappingUpdateCommand.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/data/MixReportXBRLContextData.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/data/MixReportXBRLData.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/data/MixReportXBRLNamespaceData.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyData.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyMappingData.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyMappingUpdateRequest.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyMappingUpdateResponse.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixReportXBRLNamespace.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixReportXBRLNamespaceRepository.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomy.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomyMapping.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomyMappingRepository.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomyRepository.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/exception/MixReportXBRLMappingInvalidException.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/handler/MixTaxonomyMappingUpdateCommandHandler.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixReportXBRLNamespaceMapper.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixTaxonomyMapper.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixTaxonomyMappingMapper.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixTaxonomyMappingUpdateRequestMapper.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLBuilder.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLNamespaceReadService.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLNamespaceReadServiceImpl.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLResultService.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLResultServiceImpl.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingReadService.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingReadServiceImpl.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingWriteService.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingWriteServiceImpl.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyReadService.java delete mode 100644 fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyReadServiceImpl.java create mode 100644 fineract-provider/src/main/resources/db/changelog/tenant/parts/0243_remove_mix_module.xml delete mode 100644 fineract-provider/src/test/java/org/apache/fineract/mix/report/MixXbrlBuilderStepDefinitions.java delete mode 100644 fineract-provider/src/test/java/org/apache/fineract/mix/report/MixXbrlTaxonomyStepDefinitions.java delete mode 100644 fineract-provider/src/test/resources/features/mix/mix.report.feature delete mode 100644 integration-tests/src/test/java/org/apache/fineract/integrationtests/XBRLIntegrationTest.java delete mode 100644 integration-tests/src/test/java/org/apache/fineract/integrationtests/common/xbrl/XBRLIntegrationTestHelper.java diff --git a/build.gradle b/build.gradle index 19eeb7f2ab7..ea65956608d 100644 --- a/build.gradle +++ b/build.gradle @@ -45,7 +45,6 @@ buildscript { 'fineract-loan', 'fineract-savings', 'fineract-report', - 'fineract-mix', 'integration-tests', 'twofactor-tests', 'oauth2-tests', @@ -81,7 +80,6 @@ buildscript { 'fineract-loan', 'fineract-savings', 'fineract-report', - 'fineract-mix', 'fineract-branch', 'fineract-document', 'fineract-progressive-loan', diff --git a/fineract-client-feign/src/main/java/org/apache/fineract/client/feign/FineractFeignClient.java b/fineract-client-feign/src/main/java/org/apache/fineract/client/feign/FineractFeignClient.java index 2b8204d5f87..ab84e882292 100644 --- a/fineract-client-feign/src/main/java/org/apache/fineract/client/feign/FineractFeignClient.java +++ b/fineract-client-feign/src/main/java/org/apache/fineract/client/feign/FineractFeignClient.java @@ -105,9 +105,6 @@ import org.apache.fineract.client.feign.services.MakerCheckerOr4EyeFunctionalityApi; import org.apache.fineract.client.feign.services.MappingFinancialActivitiesToAccountsApi; import org.apache.fineract.client.feign.services.MeetingsApi; -import org.apache.fineract.client.feign.services.MixMappingApi; -import org.apache.fineract.client.feign.services.MixReportApi; -import org.apache.fineract.client.feign.services.MixTaxonomyApi; import org.apache.fineract.client.feign.services.NotesApi; import org.apache.fineract.client.feign.services.NotificationApi; import org.apache.fineract.client.feign.services.OfficesApi; @@ -562,18 +559,6 @@ public MeetingsApi meetings() { return create(MeetingsApi.class); } - public MixMappingApi mixMapping() { - return create(MixMappingApi.class); - } - - public MixReportApi mixReport() { - return create(MixReportApi.class); - } - - public MixTaxonomyApi mixTaxonomy() { - return create(MixTaxonomyApi.class); - } - public NotesApi notes() { return create(NotesApi.class); } diff --git a/fineract-client/src/main/java/org/apache/fineract/client/util/FineractClient.java b/fineract-client/src/main/java/org/apache/fineract/client/util/FineractClient.java index 61b6b0d6e56..4bfbd024bf8 100644 --- a/fineract-client/src/main/java/org/apache/fineract/client/util/FineractClient.java +++ b/fineract-client/src/main/java/org/apache/fineract/client/util/FineractClient.java @@ -105,9 +105,6 @@ import org.apache.fineract.client.services.LoansPointInTimeApi; import org.apache.fineract.client.services.MakerCheckerOr4EyeFunctionalityApi; import org.apache.fineract.client.services.MappingFinancialActivitiesToAccountsApi; -import org.apache.fineract.client.services.MixMappingApi; -import org.apache.fineract.client.services.MixReportApi; -import org.apache.fineract.client.services.MixTaxonomyApi; import org.apache.fineract.client.services.NotesApi; import org.apache.fineract.client.services.NotificationApi; import org.apache.fineract.client.services.OfficesApi; @@ -251,9 +248,6 @@ public final class FineractClient { public final LoanTransactionsApi loanTransactions; public final MakerCheckerOr4EyeFunctionalityApi makerCheckers; public final MappingFinancialActivitiesToAccountsApi financialActivyAccountMappings; - public final MixMappingApi mixMappings; - public final MixReportApi mixReports; - public final MixTaxonomyApi mixTaxonomies; public final NotesApi notes; public final NotificationApi notifications; public final OfficesApi offices; @@ -390,9 +384,6 @@ private FineractClient(OkHttpClient okHttpClient, Retrofit retrofit) { makerCheckers = retrofit.create(MakerCheckerOr4EyeFunctionalityApi.class); financialActivyAccountMappings = retrofit.create(MappingFinancialActivitiesToAccountsApi.class); jobs = retrofit.create(SchedulerJobApi.class); - mixMappings = retrofit.create(MixMappingApi.class); - mixReports = retrofit.create(MixReportApi.class); - mixTaxonomies = retrofit.create(MixTaxonomyApi.class); notes = retrofit.create(NotesApi.class); notifications = retrofit.create(NotificationApi.class); offices = retrofit.create(OfficesApi.class); diff --git a/fineract-mix/build.gradle b/fineract-mix/build.gradle deleted file mode 100644 index bbde3766997..00000000000 --- a/fineract-mix/build.gradle +++ /dev/null @@ -1,75 +0,0 @@ -/** - * 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. - */ -description = 'Fineract Mix' - -apply plugin: 'java' -apply plugin: 'eclipse' - -compileJava { - dependsOn ':fineract-avro-schemas:buildJavaSdk' -} - -configurations { - providedRuntime // needed for Spring Boot executable WAR - providedCompile - compile() { - exclude module: 'hibernate-entitymanager' - exclude module: 'hibernate-validator' - exclude module: 'activation' - exclude module: 'bcmail-jdk14' - exclude module: 'bcprov-jdk14' - exclude module: 'bctsp-jdk14' - exclude module: 'c3p0' - exclude module: 'stax-api' - exclude module: 'jaxb-api' - exclude module: 'jaxb-impl' - exclude module: 'jboss-logging' - exclude module: 'itext-rtf' - exclude module: 'classworlds' - } - runtime -} - -apply from: 'dependencies.gradle' - -// Configuration for the modernizer plugin -// https://github.com/andygoossens/gradle-modernizer-plugin -modernizer { - ignoreClassNamePatterns = [ - '.*AbstractPersistableCustom', - '.*EntityTables', - '.*domain.*' - ] -} - -// If we are running Gradle within Eclipse to enhance classes with OpenJPA, -// set the classes directory to point to Eclipse's default build directory -if (project.hasProperty('env') && project.getProperty('env') == 'eclipse') { - sourceSets.main.java.outputDir = new File(rootProject.projectDir, "fineract-core/bin/main") -} - -if (!(project.hasProperty('env') && project.getProperty('env') == 'dev')) { - sourceSets { - test { - java { - exclude '**/core/boot/tests/**' - } - } - } -} diff --git a/fineract-mix/dependencies.gradle b/fineract-mix/dependencies.gradle deleted file mode 100644 index 698ffa7e6fd..00000000000 --- a/fineract-mix/dependencies.gradle +++ /dev/null @@ -1,70 +0,0 @@ -/** - * 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. - */ - -dependencies { - // Never use "compile" scope, but make all dependencies either 'implementation', 'runtimeOnly' or 'testCompile'. - // Note that we never use 'api', because Fineract at least currently is a simple monolithic application ("WAR"), not a library. - // We also (normally should have) no need to ever use 'compileOnly'. - - // implementation dependencies are directly used (compiled against) in src/main (and src/test) - // - implementation( - project(path: ':fineract-core'), - project(path: ':fineract-command'), - ) - - implementation( - 'org.springframework.boot:spring-boot-starter-web', - 'org.springframework.boot:spring-boot-starter-validation', - 'org.springframework.boot:spring-boot-starter-security', - 'org.springframework.boot:spring-boot-starter-data-jdbc', - 'jakarta.ws.rs:jakarta.ws.rs-api', - - 'org.apache.commons:commons-lang3', - - 'com.google.guava:guava', - // TODO: try to get rid of this as soon as we get hands on the MIX XSD file from 2009; then we can use JAXB - 'com.google.code.gson:gson', - - 'io.swagger.core.v3:swagger-annotations-jakarta', - - 'org.mapstruct:mapstruct', - - 'io.github.resilience4j:resilience4j-spring-boot3', - ) - compileOnly 'com.github.spotbugs:spotbugs-annotations' - compileOnly 'org.projectlombok:lombok' - annotationProcessor 'org.projectlombok:lombok' - annotationProcessor 'org.mapstruct:mapstruct-processor' - implementation('org.dom4j:dom4j') { - exclude group: 'javax.xml.bind' - } - // testCompile dependencies are ONLY used in src/test, not src/main. - // Do NOT repeat dependencies which are ALREADY in implementation or runtimeOnly! - // - testImplementation( 'io.github.classgraph:classgraph' ) - testImplementation ('org.springframework.boot:spring-boot-starter-test') { - exclude group: 'com.jayway.jsonpath', module: 'json-path' - exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' - exclude group: 'jakarta.activation' - exclude group: 'javax.activation' - exclude group: 'org.skyscreamer' - } - testImplementation ('org.mockito:mockito-inline') -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/api/MixReportApiResource.java b/fineract-mix/src/main/java/org/apache/fineract/mix/api/MixReportApiResource.java deleted file mode 100644 index 89d48356606..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/api/MixReportApiResource.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * 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.mix.api; - -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.QueryParam; -import jakarta.ws.rs.core.MediaType; -import java.sql.Date; -import lombok.RequiredArgsConstructor; -import org.apache.fineract.infrastructure.core.annotation.AlternativeOperationId; -import org.apache.fineract.mix.service.MixReportXBRLBuilder; -import org.apache.fineract.mix.service.MixReportXBRLResultService; -import org.springframework.stereotype.Component; - -@Path("/v1/mixreport") -@Component -@Tag(name = "Mix Report", description = """ - """) -@RequiredArgsConstructor -public class MixReportApiResource { - - private final MixReportXBRLResultService xbrlResultService; - private final MixReportXBRLBuilder xbrlBuilder; - - @GET - @Produces({ MediaType.APPLICATION_XML }) - @Operation(summary = "Retrieve Mix XBRL report", operationId = "retrieveMixReport") - @AlternativeOperationId("retrieveXBRLReport") - public String retrieveXBRLReport(@QueryParam("startDate") final Date startDate, @QueryParam("endDate") final Date endDate, - @QueryParam("currency") final String currency) { - - final var data = xbrlResultService.getXBRLResult(startDate, endDate, currency); - - // TODO: make this type safe? - return this.xbrlBuilder.build(data); - } -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/api/MixTaxonomyApiResource.java b/fineract-mix/src/main/java/org/apache/fineract/mix/api/MixTaxonomyApiResource.java deleted file mode 100644 index 250bd3fc840..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/api/MixTaxonomyApiResource.java +++ /dev/null @@ -1,49 +0,0 @@ -/** - * 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.mix.api; - -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; -import java.util.List; -import lombok.RequiredArgsConstructor; -import org.apache.fineract.infrastructure.core.annotation.AlternativeOperationId; -import org.apache.fineract.mix.data.MixTaxonomyData; -import org.apache.fineract.mix.service.MixTaxonomyReadService; -import org.springframework.stereotype.Component; - -@Path("/v1/mixtaxonomy") -@Component -@Tag(name = "Mix Taxonomy", description = "") -@RequiredArgsConstructor -public class MixTaxonomyApiResource { - - private final MixTaxonomyReadService readTaxonomyService; - - @GET - @Produces({ MediaType.APPLICATION_JSON }) - @Operation(summary = "List Mix Taxonomies", operationId = "retrieveAllMixTaxonomies") - @AlternativeOperationId("retrieveAll_14") - public List retrieveAll() { - return readTaxonomyService.retrieveAll(); - } -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/api/MixTaxonomyMappingApiResource.java b/fineract-mix/src/main/java/org/apache/fineract/mix/api/MixTaxonomyMappingApiResource.java deleted file mode 100644 index 1285a7e50c1..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/api/MixTaxonomyMappingApiResource.java +++ /dev/null @@ -1,76 +0,0 @@ -/** - * 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.mix.api; - -import io.swagger.v3.oas.annotations.Operation; -import io.swagger.v3.oas.annotations.tags.Tag; -import jakarta.ws.rs.Consumes; -import jakarta.ws.rs.GET; -import jakarta.ws.rs.PUT; -import jakarta.ws.rs.Path; -import jakarta.ws.rs.Produces; -import jakarta.ws.rs.core.MediaType; -import java.util.function.Supplier; -import lombok.RequiredArgsConstructor; -import org.apache.fineract.command.core.CommandDispatcher; -import org.apache.fineract.infrastructure.core.annotation.AlternativeOperationId; -import org.apache.fineract.mix.command.MixTaxonomyMappingUpdateCommand; -import org.apache.fineract.mix.data.MixTaxonomyMappingData; -import org.apache.fineract.mix.data.MixTaxonomyMappingUpdateRequest; -import org.apache.fineract.mix.data.MixTaxonomyMappingUpdateResponse; -import org.apache.fineract.mix.service.MixTaxonomyMappingReadService; -import org.springframework.stereotype.Component; - -@Path("/v1/mixmapping") -@Component -@Tag(name = "Mix Mapping", description = "") -@RequiredArgsConstructor -public class MixTaxonomyMappingApiResource { - - private final MixTaxonomyMappingReadService readTaxonomyMappingService; - private final CommandDispatcher dispatcher; - - @GET - @Produces({ MediaType.APPLICATION_JSON }) - @Operation(summary = "Retrieve Mix Taxonomy Mapping", operationId = "retrieveMixTaxonomyMapping") - @AlternativeOperationId("retrieveTaxonomyMapping") - public MixTaxonomyMappingData retrieveTaxonomyMapping() { - return this.readTaxonomyMappingService.retrieveTaxonomyMapping(); - } - - @PUT - @Consumes({ MediaType.APPLICATION_JSON }) - @Produces({ MediaType.APPLICATION_JSON }) - @Operation(summary = "Update Mix Taxonomy Mapping", operationId = "updateMixTaxonomyMapping") - @AlternativeOperationId("updateTaxonomyMapping") - public MixTaxonomyMappingUpdateResponse updateTaxonomyMapping(final MixTaxonomyMappingUpdateRequest request) { - // TODO support multiple configuration file loading; this is the legacy behavior - if (request.getId() == null) { - request.setId(1L); - } - - final var command = new MixTaxonomyMappingUpdateCommand(); - - command.setPayload(request); - - final Supplier response = dispatcher.dispatch(command); - - return response.get(); - } -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/command/MixTaxonomyMappingUpdateCommand.java b/fineract-mix/src/main/java/org/apache/fineract/mix/command/MixTaxonomyMappingUpdateCommand.java deleted file mode 100644 index fa59fe6a50f..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/command/MixTaxonomyMappingUpdateCommand.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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.mix.command; - -import lombok.Data; -import lombok.EqualsAndHashCode; -import org.apache.fineract.command.core.Command; -import org.apache.fineract.mix.data.MixTaxonomyMappingUpdateRequest; - -@Data -@EqualsAndHashCode(callSuper = true) -public class MixTaxonomyMappingUpdateCommand extends Command {} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixReportXBRLContextData.java b/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixReportXBRLContextData.java deleted file mode 100644 index d70d6abe5ff..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixReportXBRLContextData.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * 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.mix.data; - -import java.io.Serial; -import java.io.Serializable; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -@Builder -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -public class MixReportXBRLContextData implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - private String dimensionType; - private String dimension; - private Integer periodType; -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixReportXBRLData.java b/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixReportXBRLData.java deleted file mode 100644 index a6f60929ac9..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixReportXBRLData.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * 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.mix.data; - -import java.io.Serial; -import java.io.Serializable; -import java.math.BigDecimal; -import java.sql.Date; -import java.util.Map; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -@Builder -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -public class MixReportXBRLData implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - private Map resultMap; - private Date startDate; - private Date endDate; - private String currency; -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixReportXBRLNamespaceData.java b/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixReportXBRLNamespaceData.java deleted file mode 100644 index 6e256bc663d..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixReportXBRLNamespaceData.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * 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.mix.data; - -import java.io.Serial; -import java.io.Serializable; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -@Builder -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -public class MixReportXBRLNamespaceData implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - private Long id; - private String prefix; - private String url; -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyData.java b/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyData.java deleted file mode 100644 index 857df912a33..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyData.java +++ /dev/null @@ -1,57 +0,0 @@ -/** - * 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.mix.data; - -import com.fasterxml.jackson.annotation.JsonIgnore; -import java.io.Serial; -import java.io.Serializable; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -@Builder -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -public class MixTaxonomyData implements Serializable { - - public static final Integer PORTFOLIO = 0; - public static final Integer BALANCE_SHEET = 1; - public static final Integer INCOME = 2; - public static final Integer EXPENSE = 3; - - @Serial - private static final long serialVersionUID = 1L; - - private Long id; - private String name; - private String namespace; - private String dimension; - private Integer type; - private String description; - - // TODO: why is this different from the PORTFOLIO constant? This doesn't seem right! - @JsonIgnore - public boolean isPortfolio() { - return this.type == 5; - } -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyMappingData.java b/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyMappingData.java deleted file mode 100644 index 26e71b3a581..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyMappingData.java +++ /dev/null @@ -1,37 +0,0 @@ -/** - * 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.mix.data; - -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -@Builder -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -public class MixTaxonomyMappingData { - - private String identifier; - private String config; - private String currency; -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyMappingUpdateRequest.java b/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyMappingUpdateRequest.java deleted file mode 100644 index eeea823cd52..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyMappingUpdateRequest.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * 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.mix.data; - -import java.io.Serial; -import java.io.Serializable; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Builder -@Data -@NoArgsConstructor -@AllArgsConstructor -public class MixTaxonomyMappingUpdateRequest implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - private Long id; - private String identifier; - private String config; - private String currency; -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyMappingUpdateResponse.java b/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyMappingUpdateResponse.java deleted file mode 100644 index 059f15bee42..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/data/MixTaxonomyMappingUpdateResponse.java +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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.mix.data; - -import java.io.Serial; -import java.io.Serializable; -import lombok.AllArgsConstructor; -import lombok.Builder; -import lombok.Data; -import lombok.NoArgsConstructor; - -@Builder -@Data -@NoArgsConstructor -@AllArgsConstructor -public class MixTaxonomyMappingUpdateResponse implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - private Long entityId; -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixReportXBRLNamespace.java b/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixReportXBRLNamespace.java deleted file mode 100644 index d73813aeb3b..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixReportXBRLNamespace.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * 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.mix.domain; - -import java.io.Serial; -import java.io.Serializable; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.experimental.Accessors; -import org.springframework.data.annotation.Id; -import org.springframework.data.relational.core.mapping.Column; -import org.springframework.data.relational.core.mapping.Table; - -@Table("mix_xbrl_namespace") -@Getter -@Setter -@NoArgsConstructor -@Accessors(chain = true) -public class MixReportXBRLNamespace implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - @Id - @Column("id") - private Long id; - @Column("prefix") - private String prefix; - @Column("url") - private String url; -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixReportXBRLNamespaceRepository.java b/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixReportXBRLNamespaceRepository.java deleted file mode 100644 index a8806fa0464..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixReportXBRLNamespaceRepository.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * 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.mix.domain; - -import java.util.Optional; -import org.springframework.data.repository.ListCrudRepository; -import org.springframework.data.repository.query.QueryByExampleExecutor; - -public interface MixReportXBRLNamespaceRepository - extends ListCrudRepository, QueryByExampleExecutor { - - Optional findOneByPrefix(String prefix); -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomy.java b/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomy.java deleted file mode 100644 index 79b3462a3f4..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomy.java +++ /dev/null @@ -1,63 +0,0 @@ -/** - * 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.mix.domain; - -import java.io.Serial; -import java.io.Serializable; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.experimental.Accessors; -import org.springframework.data.annotation.Id; -import org.springframework.data.relational.core.mapping.Column; -import org.springframework.data.relational.core.mapping.Table; - -@Table("mix_taxonomy") -@Getter -@Setter -@NoArgsConstructor -@Accessors(chain = true) -public final class MixTaxonomy implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - @Id - @Column("id") - private Long id; - - @Column("name") - private String name; - - @Column("namespace_id") - private Long namespaceId; - - @Column("dimension") - private String dimension; - - @Column("type") - private Integer type; - - @Column("description") - private String description; - - // TODO: this is never used, but creates an error on MySQL (tinyint vs boolean mapping) - // @Column("need_mapping") - // private Boolean needMapping; -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomyMapping.java b/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomyMapping.java deleted file mode 100644 index 30e4abc7cf5..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomyMapping.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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.mix.domain; - -import java.io.Serial; -import java.io.Serializable; -import lombok.Getter; -import lombok.NoArgsConstructor; -import lombok.Setter; -import lombok.experimental.Accessors; -import org.springframework.data.annotation.Id; -import org.springframework.data.relational.core.mapping.Column; -import org.springframework.data.relational.core.mapping.Table; - -@Table("mix_taxonomy_mapping") -@Getter -@Setter -@NoArgsConstructor -@Accessors(chain = true) -public final class MixTaxonomyMapping implements Serializable { - - @Serial - private static final long serialVersionUID = 1L; - - @Id - @Column("id") - private Long id; - - @Column("identifier") - private String identifier; - - @Column("config") - private String config; - - @Column("currency") - private String currency; -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomyMappingRepository.java b/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomyMappingRepository.java deleted file mode 100644 index 35baecaab26..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomyMappingRepository.java +++ /dev/null @@ -1,25 +0,0 @@ -/** - * 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.mix.domain; - -import org.springframework.data.repository.ListCrudRepository; -import org.springframework.data.repository.query.QueryByExampleExecutor; - -public interface MixTaxonomyMappingRepository - extends ListCrudRepository, QueryByExampleExecutor {} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomyRepository.java b/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomyRepository.java deleted file mode 100644 index 8b1fa29ad01..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/domain/MixTaxonomyRepository.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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.mix.domain; - -import java.util.List; -import org.springframework.data.repository.ListCrudRepository; -import org.springframework.data.repository.query.QueryByExampleExecutor; - -public interface MixTaxonomyRepository extends ListCrudRepository, QueryByExampleExecutor { - - List findAllByOrderByIdAsc(); -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/exception/MixReportXBRLMappingInvalidException.java b/fineract-mix/src/main/java/org/apache/fineract/mix/exception/MixReportXBRLMappingInvalidException.java deleted file mode 100644 index cf78409424f..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/exception/MixReportXBRLMappingInvalidException.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * 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.mix.exception; - -import org.apache.fineract.infrastructure.core.exception.AbstractPlatformDomainRuleException; - -public class MixReportXBRLMappingInvalidException extends AbstractPlatformDomainRuleException { - - public MixReportXBRLMappingInvalidException(final String msg) { - super("error.msg.xbrl.report.mapping.invalid.id", "Mapping does not exist", msg); - } - -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/handler/MixTaxonomyMappingUpdateCommandHandler.java b/fineract-mix/src/main/java/org/apache/fineract/mix/handler/MixTaxonomyMappingUpdateCommandHandler.java deleted file mode 100644 index af59efdd713..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/handler/MixTaxonomyMappingUpdateCommandHandler.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * 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.mix.handler; - -import io.github.resilience4j.retry.annotation.Retry; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.fineract.command.core.Command; -import org.apache.fineract.command.core.CommandHandler; -import org.apache.fineract.mix.data.MixTaxonomyMappingUpdateRequest; -import org.apache.fineract.mix.data.MixTaxonomyMappingUpdateResponse; -import org.apache.fineract.mix.service.MixTaxonomyMappingWriteService; -import org.springframework.stereotype.Component; -import org.springframework.transaction.annotation.Transactional; - -@Slf4j -@Component -@RequiredArgsConstructor -public class MixTaxonomyMappingUpdateCommandHandler - implements CommandHandler { - - private final MixTaxonomyMappingWriteService writeTaxonomyService; - - @Retry(name = "commandMixTaxonomyMappingUpdate", fallbackMethod = "fallback") - @Transactional - @Override - public MixTaxonomyMappingUpdateResponse handle(Command command) { - return writeTaxonomyService.updateMapping(command.getPayload()); - } - - @Override - public MixTaxonomyMappingUpdateResponse fallback(Command command, Throwable t) { - return CommandHandler.super.fallback(command, t); - } -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixReportXBRLNamespaceMapper.java b/fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixReportXBRLNamespaceMapper.java deleted file mode 100644 index bbd88503e78..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixReportXBRLNamespaceMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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.mix.mapping; - -import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig; -import org.apache.fineract.mix.data.MixReportXBRLNamespaceData; -import org.apache.fineract.mix.domain.MixReportXBRLNamespace; -import org.mapstruct.Mapper; - -@Mapper(config = MapstructMapperConfig.class) -public interface MixReportXBRLNamespaceMapper { - - MixReportXBRLNamespaceData map(MixReportXBRLNamespace source); -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixTaxonomyMapper.java b/fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixTaxonomyMapper.java deleted file mode 100644 index ad23c6dd93d..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixTaxonomyMapper.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * 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.mix.mapping; - -import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig; -import org.apache.fineract.mix.data.MixTaxonomyData; -import org.apache.fineract.mix.domain.MixTaxonomy; -import org.mapstruct.Mapper; -import org.mapstruct.Mapping; - -@Mapper(config = MapstructMapperConfig.class) -public interface MixTaxonomyMapper { - - @Mapping(ignore = true, target = "namespace") - MixTaxonomyData map(MixTaxonomy source); -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixTaxonomyMappingMapper.java b/fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixTaxonomyMappingMapper.java deleted file mode 100644 index ac61c5eb492..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixTaxonomyMappingMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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.mix.mapping; - -import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig; -import org.apache.fineract.mix.data.MixTaxonomyMappingData; -import org.apache.fineract.mix.domain.MixTaxonomyMapping; -import org.mapstruct.Mapper; - -@Mapper(config = MapstructMapperConfig.class) -public interface MixTaxonomyMappingMapper { - - MixTaxonomyMappingData map(MixTaxonomyMapping source); -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixTaxonomyMappingUpdateRequestMapper.java b/fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixTaxonomyMappingUpdateRequestMapper.java deleted file mode 100644 index a985c30a625..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/mapping/MixTaxonomyMappingUpdateRequestMapper.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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.mix.mapping; - -import org.apache.fineract.infrastructure.core.config.MapstructMapperConfig; -import org.apache.fineract.mix.data.MixTaxonomyMappingUpdateRequest; -import org.apache.fineract.mix.domain.MixTaxonomyMapping; -import org.mapstruct.Mapper; - -@Mapper(config = MapstructMapperConfig.class) -public interface MixTaxonomyMappingUpdateRequestMapper { - - MixTaxonomyMapping map(MixTaxonomyMappingUpdateRequest source); -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLBuilder.java b/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLBuilder.java deleted file mode 100644 index 1d97f3210aa..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLBuilder.java +++ /dev/null @@ -1,208 +0,0 @@ -/** - * 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.mix.service; - -import com.google.common.base.Splitter; -import java.math.BigDecimal; -import java.sql.Date; -import java.text.SimpleDateFormat; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.fineract.mix.data.MixReportXBRLContextData; -import org.apache.fineract.mix.data.MixReportXBRLData; -import org.apache.fineract.mix.data.MixReportXBRLNamespaceData; -import org.apache.fineract.mix.data.MixTaxonomyData; -import org.apache.fineract.mix.exception.MixReportXBRLMappingInvalidException; -import org.dom4j.Document; -import org.dom4j.DocumentHelper; -import org.dom4j.Element; -import org.springframework.stereotype.Component; - -@Slf4j -@RequiredArgsConstructor -@Component -public class MixReportXBRLBuilder { - - // NOTE: see https://www.xbrl.org/taxonomyrecognition/mx_2009-06-19_summary-page.htm - private static final String SCHEME_URL = "http://www.themix.org"; - private static final String IDENTIFIER = "000000"; - private static final String UNITID_PURE = "Unit1"; - private static final String UNITID_CUR = "Unit2"; - - private final MixReportXBRLNamespaceReadService readNamespaceService; - - // TODO: we should do this with JAXB - public String build(final MixReportXBRLData xbrlData) { - return this.build(xbrlData.getResultMap(), xbrlData.getStartDate(), xbrlData.getEndDate(), xbrlData.getCurrency()); - } - - public String build(final Map map, final Date startDate, final Date endDate, final String currency) { - Integer instantScenarioCounter = 0; - Integer durationScenarioCounter = 0; - Map contextMap = new HashMap<>(); - final Document doc = DocumentHelper.createDocument(); - Element root = doc.addElement("xbrl"); - - root.addElement("schemaRef").addNamespace("link", - "http://www.themix.org/sites/default/files/Taxonomy2010/dct/dc-all_2010-08-31.xsd"); - - for (final Map.Entry entry : map.entrySet()) { - final MixTaxonomyData taxonomy = entry.getKey(); - final BigDecimal value = entry.getValue(); - addTaxonomy(root, taxonomy, value, startDate, endDate, instantScenarioCounter, durationScenarioCounter, contextMap); - - } - - addContexts(root, startDate, endDate, contextMap); - addCurrencyUnit(root, currency); - addNumberUnit(root); - - doc.setXMLEncoding("UTF-8"); - - return doc.asXML(); - } - - private Element addTaxonomy(final Element rootElement, final MixTaxonomyData taxonomy, final BigDecimal value, final Date startDate, - final Date endDate, Integer instantScenarioCounter, Integer durationScenarioCounter, - final Map contextMap) { - - // throw an error is start / endate is null - if (startDate == null || endDate == null) { - throw new MixReportXBRLMappingInvalidException("start date and end date should not be null"); - } - - final String prefix = taxonomy.getNamespace(); - String qname = taxonomy.getName(); - if (prefix != null && !prefix.isEmpty()) { - final MixReportXBRLNamespaceData ns = this.readNamespaceService.retrieveNamespaceByPrefix(prefix); - if (ns != null) { - - rootElement.addNamespace(prefix, ns.getUrl()); - } - qname = prefix + ":" + taxonomy.getName(); - - } - final Element xmlElement = rootElement.addElement(qname); - - final String dimension = taxonomy.getDimension(); - final SimpleDateFormat timeFormat = new SimpleDateFormat("MM_dd_yyyy"); - - MixReportXBRLContextData context = null; - if (dimension != null) { - final List dims = Splitter.on(':').splitToList(dimension); - - if (dims.size() == 2) { - context = new MixReportXBRLContextData().setDimensionType(dims.get(0)).setDimension(dims.get(1)).setPeriodType( - taxonomy.getType().equals(MixTaxonomyData.BALANCE_SHEET) || taxonomy.getType().equals(MixTaxonomyData.PORTFOLIO) ? 0 - : 1); - } - } - - if (context == null) { - context = new MixReportXBRLContextData().setPeriodType( - taxonomy.getType().equals(MixTaxonomyData.BALANCE_SHEET) || taxonomy.getType().equals(MixTaxonomyData.PORTFOLIO) ? 0 - : 1); - } - - if (!contextMap.containsKey(context)) { - - final String startDateStr = timeFormat.format(startDate); - final String endDateStr = timeFormat.format(endDate); - instantScenarioCounter += 1; - durationScenarioCounter += 1; - final String contextRefID = context.getPeriodType() == 0 ? "As_Of_" + endDateStr + instantScenarioCounter - : "Duration_" + startDateStr + "_To_" + endDateStr + durationScenarioCounter; - - contextMap.put(context, contextRefID); - } - - xmlElement.addAttribute("contextRef", contextMap.get(context)); - xmlElement.addAttribute("unitRef", getUnitRef(taxonomy)); - xmlElement.addAttribute("decimals", getNumberOfDecimalPlaces(value).toString()); - - // add the child - xmlElement.addText(value.toPlainString()); - - return xmlElement; - } - - private String getUnitRef(final MixTaxonomyData tx) { - return tx.isPortfolio() ? UNITID_PURE : UNITID_CUR; - } - - /** - * Adds the generic number unit - */ - private void addNumberUnit(final Element root) { - final Element numerUnit = root.addElement("unit"); - numerUnit.addAttribute("id", UNITID_PURE); - final Element measure = numerUnit.addElement("measure"); - measure.addText("xbrli:pure"); - - } - - /** - * Adds the currency unit to the document - * - * @param currencyCode - */ - private void addCurrencyUnit(final Element root, final String currencyCode) { - final Element currencyUnitElement = root.addElement("unit"); - currencyUnitElement.addAttribute("id", UNITID_CUR); - final Element measure = currencyUnitElement.addElement("measure"); - measure.addText("iso4217:" + currencyCode); - - } - - private void addContexts(final Element root, final Date startDate, final Date endDate, - final Map contextMap) { - final SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd"); - for (final Map.Entry entry : contextMap.entrySet()) { - final MixReportXBRLContextData context = entry.getKey(); - final Element contextElement = root.addElement("context"); - contextElement.addAttribute("id", entry.getValue()); - contextElement.addElement("entity").addElement("identifier").addAttribute("scheme", SCHEME_URL).addText(IDENTIFIER); - - final Element periodElement = contextElement.addElement("period"); - - if (context.getPeriodType() == 0) { - periodElement.addElement("instant").addText(format.format(endDate)); - } else { - periodElement.addElement("startDate").addText(format.format(startDate)); - periodElement.addElement("endDate").addText(format.format(endDate)); - } - - final String dimension = context.getDimension(); - final String dimType = context.getDimensionType(); - if (dimType != null && dimension != null) { - contextElement.addElement("scenario").addElement("explicitMember").addAttribute("dimension", dimType).addText(dimension); - } - } - - } - - private Integer getNumberOfDecimalPlaces(final BigDecimal bigDecimal) { - final String string = bigDecimal.stripTrailingZeros().toPlainString(); - final int index = string.indexOf("."); - return index < 0 ? 0 : string.length() - index - 1; - } -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLNamespaceReadService.java b/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLNamespaceReadService.java deleted file mode 100644 index 8296fc6c164..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLNamespaceReadService.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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.mix.service; - -import org.apache.fineract.mix.data.MixReportXBRLNamespaceData; - -public interface MixReportXBRLNamespaceReadService { - - MixReportXBRLNamespaceData retrieveNamespaceByPrefix(String prefix); -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLNamespaceReadServiceImpl.java b/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLNamespaceReadServiceImpl.java deleted file mode 100644 index 7a4c1f998e8..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLNamespaceReadServiceImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * 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.mix.service; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.fineract.mix.data.MixReportXBRLNamespaceData; -import org.apache.fineract.mix.domain.MixReportXBRLNamespaceRepository; -import org.apache.fineract.mix.mapping.MixReportXBRLNamespaceMapper; -import org.springframework.stereotype.Service; - -@Slf4j -@RequiredArgsConstructor -@Service -public class MixReportXBRLNamespaceReadServiceImpl implements MixReportXBRLNamespaceReadService { - - private final MixReportXBRLNamespaceRepository repository; - private final MixReportXBRLNamespaceMapper mapper; - - @Override - public MixReportXBRLNamespaceData retrieveNamespaceByPrefix(final String prefix) { - return repository.findOneByPrefix(prefix).map(mapper::map).orElse(null); - } -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLResultService.java b/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLResultService.java deleted file mode 100644 index 9e4fb0f4624..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLResultService.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * 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.mix.service; - -import java.sql.Date; -import org.apache.fineract.mix.data.MixReportXBRLData; - -public interface MixReportXBRLResultService { - - MixReportXBRLData getXBRLResult(Date startDate, Date endDate, String currency); - -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLResultServiceImpl.java b/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLResultServiceImpl.java deleted file mode 100644 index 17eb95cc868..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixReportXBRLResultServiceImpl.java +++ /dev/null @@ -1,185 +0,0 @@ -/** - * 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.mix.service; - -import com.google.gson.Gson; -import java.math.BigDecimal; -import java.sql.Date; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import javax.script.ScriptEngine; -import javax.script.ScriptEngineManager; -import javax.script.ScriptException; -import lombok.extern.slf4j.Slf4j; -import org.apache.fineract.mix.data.MixReportXBRLData; -import org.apache.fineract.mix.data.MixTaxonomyData; -import org.apache.fineract.mix.data.MixTaxonomyMappingData; -import org.apache.fineract.mix.exception.MixReportXBRLMappingInvalidException; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; -import org.springframework.jdbc.support.rowset.SqlRowSet; -import org.springframework.stereotype.Component; - -@Slf4j -@Component -public class MixReportXBRLResultServiceImpl implements MixReportXBRLResultService { - - private static final ScriptEngine SCRIPT_ENGINE = new ScriptEngineManager().getEngineByName("JavaScript"); - - private final MixTaxonomyMappingReadService readTaxonomyMappingService; - private final MixTaxonomyReadService readTaxonomyService; - private final JdbcTemplate jdbcTemplate; - - @Autowired - public MixReportXBRLResultServiceImpl(final JdbcTemplate jdbcTemplate, final MixTaxonomyMappingReadService readTaxonomyMappingService, - final MixTaxonomyReadService readTaxonomyService) { - this.readTaxonomyMappingService = readTaxonomyMappingService; - this.readTaxonomyService = readTaxonomyService; - this.jdbcTemplate = jdbcTemplate; - } - - @Override - public MixReportXBRLData getXBRLResult(final Date startDate, final Date endDate, final String currency) { - - final Map config = retrieveTaxonomyConfig(startDate, endDate); - - if (config == null || config.isEmpty()) { - throw new MixReportXBRLMappingInvalidException("Mapping is empty"); - } - - return new MixReportXBRLData().setResultMap(config).setStartDate(startDate).setEndDate(endDate).setCurrency(currency); - } - - @SuppressWarnings("unchecked") - private Map retrieveTaxonomyConfig(final Date startDate, final Date endDate) { - final MixTaxonomyMappingData taxonomyMapping = this.readTaxonomyMappingService.retrieveTaxonomyMapping(); - if (taxonomyMapping == null) { - return null; - } - final String config = taxonomyMapping.getConfig(); - if (config != null) { - // - Map configMap = new HashMap<>(); - configMap = new Gson().fromJson(config, configMap.getClass()); - if (configMap == null) { - return null; - } - // - final HashMap resultMap = new HashMap<>(); - Map accountBalanceMap = setupBalanceMap(getAccountSql(startDate, endDate)); - for (final Map.Entry entry : configMap.entrySet()) { - final BigDecimal value = processMappingString(accountBalanceMap, entry.getValue()); - final MixTaxonomyData taxonomy = this.readTaxonomyService.retrieveOne(Long.parseLong(entry.getKey())); - resultMap.put(taxonomy, value); - - } - return resultMap; - } - return null; - } - - // TODO: this should at least use prepared statements and not just string concatenate the date objects! - private String getAccountSql(final Date startDate, final Date endDate) { - return "SELECT debits.glcode AS 'glcode', debits.name AS 'name', COALESCE(debits.debitamount,0)-COALESCE(credits.creditamount,0)) AS 'balance' " - + "FROM (SELECT acc_gl_account.gl_code AS 'glcode',name,SUM(amount) AS 'debitamount' " - + "FROM acc_gl_journal_entry,acc_gl_account WHERE acc_gl_account.id = acc_gl_journal_entry.account_id " - + "AND acc_gl_journal_entry.type_enum=2 AND acc_gl_journal_entry.entry_date <= " + endDate - + " AND acc_gl_journal_entry.entry_date > " + startDate - // - + " GROUP BY glcode ORDER BY glcode) debits LEFT OUTER JOIN " - + "(SELECT acc_gl_account.gl_code AS 'glcode',name,SUM(amount) AS 'creditamount' " - + "FROM acc_gl_journal_entry,acc_gl_account WHERE acc_gl_account.id = acc_gl_journal_entry.account_id " - + "AND acc_gl_journal_entry.type_enum=1 AND acc_gl_journal_entry.entry_date <= " + endDate - + " AND acc_gl_journal_entry.entry_date > " + startDate - // - + " GROUP BY glcode ORDER BY glcode) credits ON debits.glcode=credits.glcode UNION " - + "SELECT credits.glcode AS 'glcode', credits.name AS 'name', COALESCE(debits.debitamount,0)-COALESCE(credits.creditamount,0)) AS 'balance' " - + "FROM (SELECT acc_gl_account.gl_code AS 'glcode',name,SUM(amount) AS 'debitamount' " - + "FROM acc_gl_journal_entry,acc_gl_account WHERE acc_gl_account.id = acc_gl_journal_entry.account_id " - + "AND acc_gl_journal_entry.type_enum=2 AND acc_gl_journal_entry.entry_date <= " + endDate - + " AND acc_gl_journal_entry.entry_date > " + startDate - // - + " GROUP BY glcode ORDER BY glcode) debits RIGHT OUTER JOIN " - + "(SELECT acc_gl_account.gl_code AS 'glcode',name,SUM(amount) AS 'creditamount' " - + "FROM acc_gl_journal_entry,acc_gl_account WHERE acc_gl_account.id = acc_gl_journal_entry.account_id " - + "AND acc_gl_journal_entry.type_enum=1 AND acc_gl_journal_entry.entry_date <= " + endDate - + " AND acc_gl_journal_entry.entry_date > " + startDate - // - + " GROUP BY name, glcode ORDER BY glcode) credits ON debits.glcode=credits.glcode;"; - } - - private Map setupBalanceMap(final String sql) { - Map accountBalanceMap = new HashMap<>(); - - final SqlRowSet rs = this.jdbcTemplate.queryForRowSet(sql); - while (rs.next()) { - accountBalanceMap.put(rs.getString("glcode"), rs.getBigDecimal("balance")); - } - - return accountBalanceMap; - } - - // Calculate Taxonomy value from expression - private BigDecimal processMappingString(Map accountBalanceMap, String mappingString) { - final List glCodes = getGLCodes(mappingString); - for (final String glcode : glCodes) { - - final BigDecimal balance = accountBalanceMap.get(glcode); - mappingString = mappingString.replaceAll("\\{" + glcode + "\\}", balance != null ? balance.toString() : "0"); - } - - // evaluate the expression - float eval = 0f; - try { - // TODO: this doesn't work anymore in modern JVMs!!!! - final Number value = (Number) SCRIPT_ENGINE.eval(mappingString); - if (value != null) { - eval = value.floatValue(); - } - } catch (final ScriptException e) { - log.error("Problem occurred in processMappingString function", e); - throw new IllegalArgumentException(e.getMessage(), e); - } - - return BigDecimal.valueOf(eval); - } - - public List getGLCodes(final String template) { - - final ArrayList placeholders = new ArrayList<>(); - - if (template != null) { - - final Pattern p = Pattern.compile("\\{(.*?)\\}"); - final Matcher m = p.matcher(template); - - while (m.find()) { // find next match - final String match = m.group(); - final String code = match.substring(1, match.length() - 1); - placeholders.add(code); - } - - } - return placeholders; - } -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingReadService.java b/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingReadService.java deleted file mode 100644 index 32c0f6c8fb5..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingReadService.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 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.mix.service; - -import org.apache.fineract.mix.data.MixTaxonomyMappingData; - -public interface MixTaxonomyMappingReadService { - - MixTaxonomyMappingData retrieveTaxonomyMapping(); -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingReadServiceImpl.java b/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingReadServiceImpl.java deleted file mode 100644 index 4047f1d09ef..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingReadServiceImpl.java +++ /dev/null @@ -1,40 +0,0 @@ -/** - * 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.mix.service; - -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.fineract.mix.data.MixTaxonomyMappingData; -import org.apache.fineract.mix.domain.MixTaxonomyMappingRepository; -import org.apache.fineract.mix.mapping.MixTaxonomyMappingMapper; -import org.springframework.stereotype.Service; - -@Slf4j -@RequiredArgsConstructor -@Service -public class MixTaxonomyMappingReadServiceImpl implements MixTaxonomyMappingReadService { - - private final MixTaxonomyMappingRepository repository; - private final MixTaxonomyMappingMapper mapper; - - @Override - public MixTaxonomyMappingData retrieveTaxonomyMapping() { - return repository.findAll().stream().findFirst().map(mapper::map).orElse(null); - } -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingWriteService.java b/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingWriteService.java deleted file mode 100644 index 1c91559b6bd..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingWriteService.java +++ /dev/null @@ -1,27 +0,0 @@ -/** - * 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.mix.service; - -import org.apache.fineract.mix.data.MixTaxonomyMappingUpdateRequest; -import org.apache.fineract.mix.data.MixTaxonomyMappingUpdateResponse; - -public interface MixTaxonomyMappingWriteService { - - MixTaxonomyMappingUpdateResponse updateMapping(MixTaxonomyMappingUpdateRequest request); -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingWriteServiceImpl.java b/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingWriteServiceImpl.java deleted file mode 100644 index 4876476fa62..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyMappingWriteServiceImpl.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * 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.mix.service; - -import jakarta.validation.Valid; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.fineract.mix.data.MixTaxonomyMappingUpdateRequest; -import org.apache.fineract.mix.data.MixTaxonomyMappingUpdateResponse; -import org.apache.fineract.mix.domain.MixTaxonomyMappingRepository; -import org.apache.fineract.mix.mapping.MixTaxonomyMappingUpdateRequestMapper; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Slf4j -@RequiredArgsConstructor -@Service -public class MixTaxonomyMappingWriteServiceImpl implements MixTaxonomyMappingWriteService { - - private final MixTaxonomyMappingRepository repository; - private final MixTaxonomyMappingUpdateRequestMapper mapper; - - @Transactional - @Override - public MixTaxonomyMappingUpdateResponse updateMapping(@Valid final MixTaxonomyMappingUpdateRequest request) { - final var taxonomyMapping = mapper.map(request); - - repository.save(taxonomyMapping); - - return MixTaxonomyMappingUpdateResponse.builder().entityId(taxonomyMapping.getId()).build(); - } -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyReadService.java b/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyReadService.java deleted file mode 100644 index e541366c3a7..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyReadService.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * 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.mix.service; - -import java.util.List; -import org.apache.fineract.mix.data.MixTaxonomyData; - -public interface MixTaxonomyReadService { - - List retrieveAll(); - - MixTaxonomyData retrieveOne(Long id); -} diff --git a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyReadServiceImpl.java b/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyReadServiceImpl.java deleted file mode 100644 index 152055967fb..00000000000 --- a/fineract-mix/src/main/java/org/apache/fineract/mix/service/MixTaxonomyReadServiceImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -/** - * 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.mix.service; - -import java.util.List; -import lombok.RequiredArgsConstructor; -import lombok.extern.slf4j.Slf4j; -import org.apache.fineract.mix.data.MixTaxonomyData; -import org.apache.fineract.mix.domain.MixTaxonomyRepository; -import org.apache.fineract.mix.mapping.MixTaxonomyMapper; -import org.springframework.stereotype.Service; - -@Slf4j -@RequiredArgsConstructor -@Service -public class MixTaxonomyReadServiceImpl implements MixTaxonomyReadService { - - private final MixTaxonomyRepository repository; - private final MixTaxonomyMapper mapper; - - @Override - public List retrieveAll() { - return repository.findAllByOrderByIdAsc().stream().map(mapper::map).toList(); - } - - @Override - public MixTaxonomyData retrieveOne(final Long id) { - return repository.findById(id).map(mapper::map).orElse(null); - } -} diff --git a/fineract-provider/dependencies.gradle b/fineract-provider/dependencies.gradle index 669f7b94e19..545690cd921 100644 --- a/fineract-provider/dependencies.gradle +++ b/fineract-provider/dependencies.gradle @@ -44,7 +44,6 @@ dependencies { implementation(project(path: ':fineract-loan-origination')) implementation(project(path: ':fineract-security')) implementation(project(path: ':fineract-working-capital-loan')) - implementation(project(path: ':fineract-mix')) providedRuntime("org.springframework.boot:spring-boot-starter-tomcat") diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/JdbcConfig.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/JdbcConfig.java index 44c2a070e0d..947a8cb2d3d 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/JdbcConfig.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/JdbcConfig.java @@ -29,8 +29,7 @@ @Profile("!liquibase-only") @Configuration @EnableJdbcRepositories(basePackages = { "org.apache.fineract.command.jdbc.store.domain", - "org.apache.fineract.infrastructure.documentmanagement.domain", - "org.apache.fineract.mix.domain" }, jdbcOperationsRef = "namedParameterJdbcTemplate", transactionManagerRef = "jdbcTransactionManager") + "org.apache.fineract.infrastructure.documentmanagement.domain" }, jdbcOperationsRef = "namedParameterJdbcTemplate", transactionManagerRef = "jdbcTransactionManager") public class JdbcConfig { @Bean diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/SecurityConfig.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/SecurityConfig.java index 27a328d7b8c..8fb1cc9a895 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/SecurityConfig.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/SecurityConfig.java @@ -317,34 +317,7 @@ public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "UPDATE_PAYMENTTYPE") .requestMatchers(API_MATCHER.matcher(HttpMethod.POST, "/api/*/paymenttypes")) .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "DELETE_PAYMENTTYPE") - // mix: taxonomy - .requestMatchers(API_MATCHER.matcher(HttpMethod.GET, "/api/*/mixtaxonomy/*")) - .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_READ, "READ_MIX_TAXONOMY") - .requestMatchers(API_MATCHER.matcher(HttpMethod.POST, "/api/*/mixtaxonomy/*")) - .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "CREATE_MIX_TAXONOMY") - .requestMatchers(API_MATCHER.matcher(HttpMethod.PUT, "/api/*/mixtaxonomy/*")) - .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "UPDATE_MIX_TAXONOMY") - .requestMatchers(API_MATCHER.matcher(HttpMethod.DELETE, "/api/*/mixtaxonomy/*")) - .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "DELETE_MIX_TAXONOMY") - // mix: mapping - .requestMatchers(API_MATCHER.matcher(HttpMethod.GET, "/api/*/mixmapping/*")) - .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_READ, "READ_MIX_MAPPING") - .requestMatchers(API_MATCHER.matcher(HttpMethod.POST, "/api/*/mixmapping/*")) - .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "CREATE_MIX_MAPPING") - .requestMatchers(API_MATCHER.matcher(HttpMethod.PUT, "/api/*/mixmapping/*")) - // TODO: "UPDATE_XBRLMAPPING" is the legacy permission name; we should rename for consistency - .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "UPDATE_MIX_MAPPING", "UPDATE_XBRLMAPPING") - .requestMatchers(API_MATCHER.matcher(HttpMethod.DELETE, "/api/*/mixmapping/*")) - .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "DELETE_MIX_MAPPING") - // mix: report - .requestMatchers(API_MATCHER.matcher(HttpMethod.GET, "/api/*/mixreport/*")) - .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_READ, "READ_MIX_REPORT") - .requestMatchers(API_MATCHER.matcher(HttpMethod.POST, "/api/*/mixreport/*")) - .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "CREATE_MIX_REPORT") - .requestMatchers(API_MATCHER.matcher(HttpMethod.PUT, "/api/*/mixreport/*")) - .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "UPDATE_MIX_REPORT") - .requestMatchers(API_MATCHER.matcher(HttpMethod.DELETE, "/api/*/mixreport/*")) - .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_WRITE, "DELETE_MIX_REPORT") + // working days .requestMatchers(API_MATCHER.matcher(HttpMethod.GET, "/api/*/workingdays")) .hasAnyAuthority(ALL_FUNCTIONS, ALL_FUNCTIONS_READ, "READ_WORKING_DAYS") diff --git a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/jpa/JPAConfig.java b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/jpa/JPAConfig.java index c77515dad31..44e3a782647 100644 --- a/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/jpa/JPAConfig.java +++ b/fineract-provider/src/main/java/org/apache/fineract/infrastructure/core/config/jpa/JPAConfig.java @@ -61,8 +61,7 @@ @EnableJpaRepositories(basePackages = { "org.apache.fineract.**.domain", "org.apache.fineract.**.repository" }, excludeFilters = @ComponentScan.Filter(type = FilterType.REGEX, pattern = { "org\\.apache\\.fineract\\.command\\.jdbc\\.store\\.domain\\..*", - "org\\.apache\\.fineract\\.infrastructure\\.documentmanagement\\.domain\\..*Repository", - "org\\.apache\\.fineract\\.mix\\.domain\\..*Repository" })) + "org\\.apache\\.fineract\\.infrastructure\\.documentmanagement\\.domain\\..*Repository" })) @EnableConfigurationProperties(JpaProperties.class) @Import(JpaAuditingHandlerRegistrar.class) public class JPAConfig extends JpaBaseConfiguration { diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml index 35b255e874e..79b6c2d7324 100644 --- a/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml +++ b/fineract-provider/src/main/resources/db/changelog/tenant/changelog-tenant.xml @@ -261,4 +261,5 @@ + diff --git a/fineract-provider/src/main/resources/db/changelog/tenant/parts/0243_remove_mix_module.xml b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0243_remove_mix_module.xml new file mode 100644 index 00000000000..2e4eab77062 --- /dev/null +++ b/fineract-provider/src/main/resources/db/changelog/tenant/parts/0243_remove_mix_module.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + SELECT COUNT(1) FROM m_permission WHERE code = 'UPDATE_XBRLMAPPING' + + + code = 'UPDATE_XBRLMAPPING' + + + diff --git a/fineract-provider/src/test/java/org/apache/fineract/mix/report/MixXbrlBuilderStepDefinitions.java b/fineract-provider/src/test/java/org/apache/fineract/mix/report/MixXbrlBuilderStepDefinitions.java deleted file mode 100644 index e3d95611935..00000000000 --- a/fineract-provider/src/test/java/org/apache/fineract/mix/report/MixXbrlBuilderStepDefinitions.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * 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.mix.report; - -import static org.junit.jupiter.api.Assertions.assertEquals; -import static org.mockito.Mockito.lenient; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import io.cucumber.java8.En; -import java.math.BigDecimal; -import java.nio.charset.StandardCharsets; -import java.sql.Date; -import java.util.HashMap; -import org.apache.commons.io.IOUtils; -import org.apache.fineract.mix.data.MixReportXBRLNamespaceData; -import org.apache.fineract.mix.data.MixTaxonomyData; -import org.apache.fineract.mix.service.MixReportXBRLBuilder; -import org.apache.fineract.mix.service.MixReportXBRLNamespaceReadServiceImpl; -import org.apache.fineract.template.service.TemplateServiceStepDefinitions; -import org.mockito.ArgumentMatchers; - -public class MixXbrlBuilderStepDefinitions implements En { - - private MixReportXBRLNamespaceReadServiceImpl readNamespaceService; - - private MixReportXBRLBuilder xbrlBuilder; - - private Date start; - - private Date end; - - private String currency; - - private HashMap data = new HashMap<>(); - - private String result; - - public MixXbrlBuilderStepDefinitions() { - Given("/^The XBRL input parameters start date (.*), end date (.*), currency (.*), taxonomy (.*) and sample (.*)$/", - (String start, String end, String currency, String taxonomy, String sample) -> { - readNamespaceService = mock(MixReportXBRLNamespaceReadServiceImpl.class); - lenient().when(this.readNamespaceService.retrieveNamespaceByPrefix(ArgumentMatchers.anyString())) - .thenReturn(new MixReportXBRLNamespaceData().setId(1L).setPrefix("mockedprefix").setUrl("mockedurl")); - - xbrlBuilder = new MixReportXBRLBuilder(readNamespaceService); - - this.start = Date.valueOf(start); - this.end = Date.valueOf(end); - this.currency = currency; - - MixTaxonomyData taxonomyData = mock(MixTaxonomyData.class); - when(taxonomyData.getName()).thenReturn(taxonomy); - this.data.put(taxonomyData, BigDecimal.valueOf(Long.parseLong(sample))); - }); - - When("The user builds the XBRL report", () -> { - result = this.xbrlBuilder.build(data, start, end, currency); - }); - - Then("/^The XBRL result should match (.*)$/", (String file) -> { - String expected = IOUtils.resourceToString("results/" + file, StandardCharsets.UTF_8, - TemplateServiceStepDefinitions.class.getClassLoader()); - assertEquals(expected.trim(), result.trim()); - }); - } -} diff --git a/fineract-provider/src/test/java/org/apache/fineract/mix/report/MixXbrlTaxonomyStepDefinitions.java b/fineract-provider/src/test/java/org/apache/fineract/mix/report/MixXbrlTaxonomyStepDefinitions.java deleted file mode 100644 index b4772138669..00000000000 --- a/fineract-provider/src/test/java/org/apache/fineract/mix/report/MixXbrlTaxonomyStepDefinitions.java +++ /dev/null @@ -1,52 +0,0 @@ -/** - * 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.mix.report; - -import static org.junit.jupiter.api.Assertions.assertArrayEquals; -import static org.mockito.Mockito.mock; - -import io.cucumber.java8.En; -import java.util.List; -import org.apache.fineract.mix.service.MixReportXBRLResultServiceImpl; -import org.assertj.core.util.Arrays; -import org.springframework.jdbc.core.JdbcTemplate; - -public class MixXbrlTaxonomyStepDefinitions implements En { - - private MixReportXBRLResultServiceImpl readService; - - private String template; - - private List result; - - public MixXbrlTaxonomyStepDefinitions() { - Given("/^A XBRL template (.*)$/", (String template) -> { - this.readService = new MixReportXBRLResultServiceImpl(mock(JdbcTemplate.class), null, null); - this.template = template; - }); - - When("The user resolves GL codes", () -> { - this.result = this.readService.getGLCodes(template); - }); - - Then("/^The result should contain (.*)$/", (String line) -> { - assertArrayEquals(result.toArray(new String[0]), Arrays.array(line.split(","))); - }); - } -} diff --git a/fineract-provider/src/test/resources/features/mix/mix.report.feature b/fineract-provider/src/test/resources/features/mix/mix.report.feature deleted file mode 100644 index bac3f143b55..00000000000 --- a/fineract-provider/src/test/resources/features/mix/mix.report.feature +++ /dev/null @@ -1,40 +0,0 @@ -# -# 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. -# - -Feature: MIX XBRL - - @mix - Scenario Outline: Verify that GL codes resolve - Given A XBRL template